Refine search
@Override public void sgetri(int N, float[] A, int lda, int[] IPIV, float[] WORK, int lwork, int INFO) { LAPACK.getInstance().sgetri(N, A, lda, IPIV, WORK, lwork, new intW(INFO)); }
@Override public void dgetrf(int M, int N, double[] A, int lda, int[] IPIV, int INFO) { LAPACK.getInstance().dgetrf(M,N,A,lda,IPIV,new intW(INFO)); }
@Override public void dgetri(int N, double[] A, int lda, int[] IPIV, double[] WORK, int lwork, int INFO) { LAPACK.getInstance().dgetri(N,A,lda,IPIV,WORK,lwork,new intW(INFO)); }
@Override public void sgetrf(int M, int N, float[] A, int lda, int[] IPIV, int INFO) { LAPACK.getInstance().sgetrf(M, N, A, lda, IPIV, new intW(INFO)); }
public static DoubleMatrix blasInvert(DoubleMatrix myPrecision) { double[] b = new double[myPrecision.columns]; int[] p = new int[myPrecision.columns]; intW info = new intW(0); int m = myPrecision.columns; double [] a = myPrecision.toArray(); //LAPACK.getInstance().dgetri(m, a, m, p, b, -1, info); //log.info(m + " supposedly has optimal work of " + b[0]); //b = new double[(int)b[0]]; LAPACK.getInstance().dgetrf(m, m, a, m, p, info); if (info.val != 0) throw new IllegalArgumentException(); LAPACK.getInstance().dgetri(m, a, m, p, b, b.length, info); if (info.val != 0) throw new IllegalArgumentException(); DoubleMatrix pInv = new DoubleMatrix(a); return pInv.reshape(myPrecision.rows, myPrecision.columns); }
private SymmPackEVD factor(Matrix A, double[] data) throws NotConvergedException { if (A.numRows() != n) throw new IllegalArgumentException("A.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dspevd(job.netlib(), uplo.netlib(), n, data, w, job == JobEig.All ? Z.getData() : new double[0], Matrices.ld(n), work, work.length, iwork, iwork.length, info); if (info.val > 0) throw new NotConvergedException( NotConvergedException.Reason.Iterations); else if (info.val < 0) throw new IllegalArgumentException(); return this; }
private SymmPackEVD factor(Matrix A, double[] data) throws NotConvergedException { if (A.numRows() != n) throw new IllegalArgumentException("A.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dspevd(job.netlib(), uplo.netlib(), n, data, w, job == JobEig.All ? Z.getData() : new double[0], Matrices.ld(n), work, work.length, iwork, iwork.length, info); if (info.val > 0) throw new NotConvergedException( NotConvergedException.Reason.Iterations); else if (info.val < 0) throw new IllegalArgumentException(); return this; }
Matrix LUsolve(Matrix B, Matrix X) { if (!(X instanceof DenseMatrix)) throw new UnsupportedOperationException("X must be a DenseMatrix"); double[] Xd = ((DenseMatrix) X).getData(); X.set(B); int[] piv = new int[numRows]; intW info = new intW(0); LAPACK.getInstance().dgesv(numRows, B.numColumns(), data.clone(), Matrices.ld(numRows), piv, Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixSingularException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
private DenseMatrix solve(DenseMatrix B, Transpose trans) throws MatrixSingularException { if (singular) throw new MatrixSingularException(); if (B.numRows() != n) throw new IllegalArgumentException("B.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dgbtrs(trans.netlib(), n, kl, ku, B.numColumns(), LU.getData(), 2 * kl + ku + 1, ipiv, B.getData(), Matrices.ld(n), info); if (info.val < 0) throw new IllegalArgumentException(); return B; } }
private SymmBandEVD factor(Matrix A, double[] data, int kd) throws NotConvergedException { if (A.numRows() != n) throw new IllegalArgumentException("A.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dsbevd(job.netlib(), uplo.netlib(), n, kd, data, Matrices.ld(kd + 1), w, job == JobEig.All ? Z.getData() : new double[0], Matrices.ld(n), work, work.length, iwork, iwork.length, info); if (info.val > 0) throw new NotConvergedException( NotConvergedException.Reason.Iterations); else if (info.val < 0) throw new IllegalArgumentException(); return this; }
private SymmBandEVD factor(Matrix A, double[] data, int kd) throws NotConvergedException { if (A.numRows() != n) throw new IllegalArgumentException("A.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dsbevd(job.netlib(), uplo.netlib(), n, kd, data, Matrices.ld(kd + 1), w, job == JobEig.All ? Z.getData() : new double[0], Matrices.ld(n), work, work.length, iwork, iwork.length, info); if (info.val > 0) throw new NotConvergedException( NotConvergedException.Reason.Iterations); else if (info.val < 0) throw new IllegalArgumentException(); return this; }
private DenseMatrix solve(DenseMatrix B, Transpose trans) throws MatrixSingularException { if (singular) throw new MatrixSingularException(); if (B.numRows() != n) throw new IllegalArgumentException("B.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dgbtrs(trans.netlib(), n, kl, ku, B.numColumns(), LU.getData(), 2 * kl + ku + 1, ipiv, B.getData(), Matrices.ld(n), info); if (info.val < 0) throw new IllegalArgumentException(); return B; } }
Matrix LUsolve(Matrix B, Matrix X) { if (!(X instanceof DenseMatrix)) throw new UnsupportedOperationException("X must be a DenseMatrix"); double[] Xd = ((DenseMatrix) X).getData(); X.set(B); int[] piv = new int[numRows]; intW info = new intW(0); LAPACK.getInstance().dgesv(numRows, B.numColumns(), data.clone(), Matrices.ld(numRows), piv, Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixSingularException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
private PackCholesky decompose(AbstractPackMatrix A) { if (n != A.numRows()) throw new IllegalArgumentException("n != A.numRows()"); notspd = false; intW info = new intW(0); if (upper) LAPACK.getInstance().dpptrf(UpLo.Upper.netlib(), A.numRows(), A.getData(), info); else LAPACK.getInstance().dpptrf(UpLo.Lower.netlib(), A.numRows(), A.getData(), info); if (info.val > 0) notspd = true; else if (info.val < 0) throw new IllegalArgumentException(); if (upper) Cu.set(A); else Cl.set(A); return this; }
private SymmDenseEVD factor(Matrix A, double[] data) throws NotConvergedException { if (A.numRows() != n) throw new IllegalArgumentException("A.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dsyevr(job.netlib(), range.netlib(), uplo.netlib(), n, data, Matrices.ld(n), 0, 0, 0, 0, abstol, new intW(1), w, job == JobEig.All ? Z.getData() : new double[0], Matrices.ld(n), isuppz, work, work.length, iwork, iwork.length, info); if (info.val > 0) throw new NotConvergedException( NotConvergedException.Reason.Iterations); else if (info.val < 0) throw new IllegalArgumentException(); return this; }
private SymmDenseEVD factor(Matrix A, double[] data) throws NotConvergedException { if (A.numRows() != n) throw new IllegalArgumentException("A.numRows() != n"); intW info = new intW(0); LAPACK.getInstance().dsyevr(job.netlib(), range.netlib(), uplo.netlib(), n, data, Matrices.ld(n), 0, 0, 0, 0, abstol, new intW(1), w, job == JobEig.All ? Z.getData() : new double[0], Matrices.ld(n), isuppz, work, work.length, iwork, iwork.length, info); if (info.val > 0) throw new NotConvergedException( NotConvergedException.Reason.Iterations); else if (info.val < 0) throw new IllegalArgumentException(); return this; }
@Override public Matrix solve(Matrix B, Matrix X) { if (!(X instanceof DenseMatrix)) throw new UnsupportedOperationException("X must be a DenseMatrix"); checkSolve(B, X); double[] Xd = ((DenseMatrix) X).getData(); X.set(B); intW info = new intW(0); LAPACK.getInstance().dptsv(numRows, X.numColumns(), diag.clone(), offDiag.clone(), Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixNotSPDException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
Matrix SPDsolve(Matrix B, Matrix X) { if (!(X instanceof DenseMatrix)) throw new UnsupportedOperationException("X must be a DenseMatrix"); checkSolve(B, X); double[] Xd = ((DenseMatrix) X).getData(); X.set(B); intW info = new intW(0); LAPACK.getInstance().dppsv(uplo.netlib(), numRows, X.numColumns(), data.clone(), Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixNotSPDException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
Matrix SPDsolve(Matrix B, Matrix X) { if (!(X instanceof DenseMatrix)) throw new UnsupportedOperationException("X must be a DenseMatrix"); checkSolve(B, X); double[] Xd = ((DenseMatrix) X).getData(); X.set(B); intW info = new intW(0); LAPACK.getInstance().dppsv(uplo.netlib(), numRows, X.numColumns(), data.clone(), Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixNotSPDException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
/** * Creates an LU decomposition of the given matrix * * @param A * Matrix to decompose. Overwritten with the decomposition * @return The current decomposition */ public DenseLU factor(DenseMatrix A) { singular = false; intW info = new intW(0); LAPACK.getInstance().dgetrf(A.numRows(), A.numColumns(), A.getData(), Matrices.ld(A.numRows()), piv, info); if (info.val > 0) singular = true; else if (info.val < 0) throw new IllegalArgumentException(); LU.set(A); return this; }