Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns true if the matrix is positive-definite, false otherwise
 /// </summary>
 /// <param name="A"></param>
 /// <typeparam name="N">The square dimenion type</typeparam>
 public static bool posdef <N>(BlockMatrix <N, double> A)
     where N : ITypeNat, new()
 => potrf <N>(A.Replicate());