kaleidicassociates / lubeck

High level linear algebra library for Dlang
http://lubeck.libmir.org/
Boost Software License 1.0
66 stars 14 forks source link

eigSymmetric - #18

Closed max-gains closed 5 years ago

max-gains commented 5 years ago

I am trying to use lubeck to calculate the eigenvalues of a symmetric matrix. My code is as follows:

import std.stdio;
import mir.ndslice;
import lubeck;

void main()
{
    // Test eigSymmetric
    auto n = 4;
    auto A = slice!double(n, n);
    A[] = [[  0.239960151286054,                  0,  0.178712872351482,    0],
           [ -0.372217567033019,  1.000000000000000,  0.270264106474929,    0],
           [ -0.990087548834596,                  0,  0.138859726355787,    0],
           [-48.935406546734953, 64.100000000000009,  2.399234111713982,  1.0]];

    auto ATA = slice!double(n, n);
    ATA = A.transposed.mtimes(A);
    auto eigs = ATA.eigSymmetric;
}

In my dub.json file I have the following:

    "dependencies": {
        "mir"   : ">=3.1.0",
        "lubeck": ">=1.1.0"
    },

When I try to build to code using ldc-1.9 I get the following error: Error: template lubeck.eigSymmetric cannot deduce function from argument types !()(Slice!(double*, 2LU, cast(mir_slice_kind)2)),

Could this be a bug?

Thanks,

Max

9il commented 5 years ago

Hi,

https://github.com/kaleidicassociates/lubeck/blob/master/source/lubeck.d#L1052

Take a look into the example. Add the first parameter, L or U character.

Also, you may want to update LDC to 1.12.0, 1.9.0 may still compile however

max-gains commented 5 years ago

Thanks, I have been your libraries for a while now for control systems purposes and they perform very well. I was going off an example in the following link that now appears to be outdated: https://lubeck.dpldocs.info/lubeck.eigSymmetric.html Maybe this should be removed?

9il commented 5 years ago

Thanks. Dpldocs are generated for all packages and we don't support it. The lack of proper docs is defenetely an issue.