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 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; }
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().dpbsv(uplo.netlib(), numRows, kd, X.numColumns(), data.clone(), Matrices.ld(kd + 1), Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixNotSPDException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
Matrix solve(Matrix B, Matrix X, Transpose trans) { 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().dtbtrs(uplo.netlib(), trans.netlib(), diag.netlib(), numRows, kd, X.numColumns(), data, Matrices.ld(kd + 1), Xd, Matrices.ld(n), info); if (info.val > 0) throw new MatrixSingularException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
Matrix solve(Matrix B, Matrix X, Transpose trans) { 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().dtbtrs(uplo.netlib(), trans.netlib(), diag.netlib(), numRows, kd, X.numColumns(), data, Matrices.ld(kd + 1), Xd, Matrices.ld(n), info); if (info.val > 0) throw new MatrixSingularException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
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 DenseMatrix solve(DenseMatrix B, Transpose trans) throws MatrixSingularException { if (singular) throw new MatrixSingularException(); if (B.numRows() != LU.numRows()) throw new IllegalArgumentException("B.numRows() != LU.numRows()"); intW info = new intW(0); LAPACK.getInstance().dgetrs(trans.netlib(), LU.numRows(), B.numColumns(), LU.getData(), Matrices.ld(LU.numRows()), piv, B.getData(), Matrices.ld(LU.numRows()), info); if (info.val < 0) throw new IllegalArgumentException(); return B; }
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 DenseMatrix solve(DenseMatrix B, Transpose trans) throws MatrixSingularException { if (singular) throw new MatrixSingularException(); if (B.numRows() != LU.numRows()) throw new IllegalArgumentException("B.numRows() != LU.numRows()"); intW info = new intW(0); LAPACK.getInstance().dgetrs(trans.netlib(), LU.numRows(), B.numColumns(), LU.getData(), Matrices.ld(LU.numRows()), piv, B.getData(), Matrices.ld(LU.numRows()), info); if (info.val < 0) throw new IllegalArgumentException(); return B; }
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; } }
@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; }
@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); int[] ipiv = new int[numRows]; intW info = new intW(0); LAPACK.getInstance().dspsv(uplo.netlib(), numRows, X.numColumns(), data.clone(), ipiv, Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixSingularException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
@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().dgtsv(numRows, X.numColumns(), offDiag.clone(), diag.clone(), offDiag.clone(), Xd, Matrices.ld(numRows), info); if (info.val > 0) throw new MatrixSingularException(); else if (info.val < 0) throw new IllegalArgumentException(); return X; }
public Matrix mult(Matrix B, DenseMatrix C) { if (pivots == null) return super.mult(B, C); checkMultAdd(B, C); C.set(B); LAPACK.getInstance().dlaswp(C.numColumns(), C.getData(), Matrices.ld(C.numRows()), 1, pivots.length, pivots, transposed ? -1 : 1); return C; }
public Matrix mult(Matrix B, DenseMatrix C) { if (pivots == null) return super.mult(B, C); checkMultAdd(B, C); C.set(B); LAPACK.getInstance().dlaswp(C.numColumns(), C.getData(), Matrices.ld(C.numRows()), 1, pivots.length, pivots, transposed ? -1 : 1); return C; }
public Matrix transAmult(Matrix B, DenseMatrix C) { if (pivots == null) return super.transAmult(B, C); checkTransAmultAdd(B, C); C.set(B); LAPACK.getInstance().dlaswp(C.numColumns(), C.getData(), Matrices.ld(C.numRows()), 1, pivots.length, pivots, transposed ? 1 : -1); return C; }
public Matrix transAmult(Matrix B, DenseMatrix C) { if (pivots == null) return super.transAmult(B, C); checkTransAmultAdd(B, C); C.set(B); LAPACK.getInstance().dlaswp(C.numColumns(), C.getData(), Matrices.ld(C.numRows()), 1, pivots.length, pivots, transposed ? 1 : -1); return C; }