Exemple #1
0
Fichier : geev.cs Projet : 0xCM/z0
        public static EigenResult <N, double> geev <N>(Matrix256 <N, double> A)
            where N : unmanaged, ITypeNat
        {
            var n        = nat32i <N>();
            var lda      = n;
            var ldvl     = n;
            var ldvr     = n;
            var wslen    = n * n;
            var exitcode = 0;
            var v        = 'V';
            var wr       = NatSpans.alloc <N, double>();
            var wi       = NatSpans.alloc <N, double>();
            var lVec     = A.Replicate();
            var rVec     = A.Replicate();

            exitcode = LAPACK.LAPACKE_dgeev(RowMajor, v, v, n, ref head(A), lda, ref wr.First, ref wi.First,
                                            ref head(lVec), ldvl, ref head(rVec), ldvr);

            if (exitcode != 0)
            {
                MklException.Throw(exitcode);
            }

            return(EigenResult.Define(FromPaired <N, double>(wr, wi), lVec, rVec));
        }
Exemple #2
0
        public static EigenResult <N, double> geev <N>(BlockMatrix <N, double> A)
            where N : ITypeNat, new()
        {
            var n        = nati <N>();
            var lda      = n;
            var ldvl     = n;
            var ldvr     = n;
            var wslen    = n * n;
            var exitcode = 0;
            var v        = 'V';
            var wr       = NatSpan.Alloc <N, double>();
            var wi       = NatSpan.Alloc <N, double>();
            var lVec     = A.Replicate(true);
            var rVec     = A.Replicate(true);

            exitcode = LAPACK.LAPACKE_dgeev(RowMajor, v, v, n, ref head(A), lda, ref head(wr), ref head(wi),
                                            ref head(lVec), ldvl, ref head(rVec), ldvr);

            if (exitcode != 0)
            {
                MklException.Throw(exitcode);
            }

            return(EigenResult.Define(ComplexNumber.FromPaired <N, double>(wr, wi), lVec, rVec));
        }