public static int dsyev(char jobz, char uplo, fastmath.AbstractMatrix A, fastmath.Vector W, fastmath.Vector work, int lwork) { System.Diagnostics.Debug.Assert(work.getOffset(0) == 0, "work offset must be 0"); System.Diagnostics.Debug.Assert(A.isColMajor(), "A must be col major"); System.Diagnostics.Debug.Assert(W.isContiguous(), "W must be contiguous"); System.Diagnostics.Debug.Assert(W.getOffset(0) == 0, "W offset must be 0"); System.Diagnostics.Debug.Assert(W.Count == A.numRows, "A.length != A.rows"); return(dsyev(jobz, uplo, A.getRowCount(), A.getBuffer(), A.getOffset(0, 0), A.getRowCount (), W.getBuffer(), work.getBuffer(), lwork)); }
/// <summary>Constructs a new matrix, copied from X</summary> public DoubleColMatrix(fastmath.AbstractMatrix x) : base(x.getRowCount(), x.getColCount()) { baseOffset = 0; columnCapacity = getColCount(); setName(x.getName()); for (int i = 0; i < numCols; i++) { fastmath.Vector src = x.col(i); fastmath.Vector dst = col(i); dst.assign(src); } }
/// <summary> /// DGEEV computes for an N-by-N real nonsymmetric matrix A, the eigenvalues and, /// optionally, the left and/or right eigenvectors. /// </summary> /// <remarks> /// DGEEV computes for an N-by-N real nonsymmetric matrix A, the eigenvalues and, /// optionally, the left and/or right eigenvectors. /// The right eigenvector v(j) of A satisfies A * v(j) = lambda(j) * v(j) where /// lambda(j) is its eigenvalue. The left eigenvector u(j) of A satisfies u(j)**H /// * A = lambda(j) * u(j)**H where u(j)**H denotes the conjugate transpose of /// u(j). /// The computed eigenvectors are normalized to have Euclidean norm equal to 1 /// and largest component real. /// </remarks> /// <param name="A">On entry, the N-by-N matrix A. On exit, A has been overwritten.</param> /// <param name="wr"> /// real parts of the computed eigenvalues. Complex conjugate pairs of /// eigenvalues appear consecutively with the eigenvalue having the /// positive imaginary part first. /// </param> /// <param name="wi"> /// imaginary parts of the computed eigenvalues. Complex conjugate pairs /// of eigenvalues appear consecutively with the eigenvalue having the /// positive imaginary part first. /// </param> /// <param name="vl"> /// left eigenvectors u(j) are stored one after another in the columns /// of VL, in the same order as their eigenvalues. If JOBVL = 'N', VL is /// not referenced. If the j-th eigenvalue is real, then u(j) = VL(:,j), /// the j-th column of VL. If the j-th and (j+1)-st eigenvalues form a /// complex conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and u(j+1) /// = VL(:,j) - i*VL(:,j+1). /// </param> /// <param name="vr"> /// right eigenvectors v(j) are stored one after another in the columns /// of VR, in the same order as their eigenvalues. If JOBVR = 'N', VR is /// not referenced. If the j-th eigenvalue is real, then v(j) = VR(:,j), /// the j-th column of VR. If the j-th and (j+1)-st eigenvalues form a /// complex conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and v(j+1) /// = VR(:,j) - i*VR(:,j+1). /// </param> /// <param name="work">On exit,if return value is 0 then WORK(1) returns the optimal LWORK. /// </param> /// <param name="workSize"> /// The dimension of the array WORK. LWORK >= max(1,3*N), and if JOBVL = /// 'V' or JOBVR = 'V', LWORK >= 4*N. For good performance, LWORK must /// generally be larger. /// If LWORK = -1, then a workspace query is assumed; the routine only /// calculates the optimal size of the WORK array, returns this value as /// the first entry of the WORK array, and no error message related to /// LWORK is issued by XERBLA. /// </param> /// <returns> /// 0: successful exit < 0: if INFO = -i, the i-th argument had an /// illegal value. > 0: if INFO = i, the QR algorithm failed to compute /// all the eigenvalues, and no eigenvectors have been computed; elements /// i+1:N of WR and WI contain eigenvalues which have converged. /// </returns> /// <exception cref="fastmath.exceptions.FastMathException"/> public static int dgeev(fastmath.AbstractMatrix A, fastmath.Vector wr, fastmath.Vector wi, fastmath.AbstractMatrix vl, fastmath.AbstractMatrix vr, fastmath.Vector work , int workSize) { // TODO: how much of a performance hit is this? if (wr.getOffset(0) != 0 || wi.getOffset(0) != 0 || wr.getIncrement() != 1 || wi. getIncrement() != 1) { throw new fastmath.exceptions.FastMathException("wr and wi cannot be subvectors"); } return(dgeev(vl != null ? 'V' : 'N', vr != null ? 'V' : 'N', A.getRowCount(), A.getBuffer (), A.getOffset(0, 0), A.getRowCount(), wr.getBuffer(), wi.getBuffer(), vl == null ? null : vl.getBuffer(), vl == null ? 0 : vl.getOffset(0, 0), A.getRowCount(), vr == null ? null : vr.getBuffer(), vr == null ? 0 : vr.getOffset(0, 0), A.getRowCount (), work.getBuffer(), workSize)); }
// Fastmath.instance.dcopy(X.size, X.getBuffer().asDoubleBuffer(), // X.getIncrement(), Y.getBuffer().asDoubleBuffer(), Y.getIncrement()); public static int dgetrf(fastmath.AbstractMatrix A, fastmath.IntVector ipiv) { return(dgetrf(A.isColMajor(), A.getRowCount(), A.getColCount(), A.getBuffer(), A. getOffset(0, 0), A.getRowCount(), ipiv.getBuffer())); }
public abstract T assign <T>(fastmath.AbstractMatrix x) where T : fastmath.DoubleMatrix;
public ColIterator(fastmath.AbstractMatrix x) { this.x = x; i = 0; }