use of org.nd4j.linalg.api.blas.BlasException in project nd4j by deeplearning4j.
the class CpuLapack method dgeqrf.
@Override
public void dgeqrf(int M, int N, INDArray A, INDArray R, INDArray INFO) {
INDArray tau = Nd4j.create(N);
int status = LAPACKE_dgeqrf(getColumnOrder(A), M, N, (DoublePointer) A.data().addressPointer(), getLda(A), (DoublePointer) tau.data().addressPointer());
if (status != 0) {
throw new BlasException("Failed to execute dgeqrf", status);
}
// Copy R ( upper part of Q ) into result
if (R != null) {
R.assign(A.get(NDArrayIndex.interval(0, A.columns()), NDArrayIndex.all()));
INDArrayIndex[] ix = new INDArrayIndex[2];
for (int i = 1; i < Math.min(A.rows(), A.columns()); i++) {
ix[0] = NDArrayIndex.point(i);
ix[1] = NDArrayIndex.interval(0, i);
R.put(ix, 0);
}
}
status = LAPACKE_dorgqr(getColumnOrder(A), M, N, N, (DoublePointer) A.data().addressPointer(), getLda(A), (DoublePointer) tau.data().addressPointer());
if (status != 0) {
throw new BlasException("Failed to execute dorgqr", status);
}
}
use of org.nd4j.linalg.api.blas.BlasException in project nd4j by deeplearning4j.
the class CpuLapack method sgesvd.
// =========================
// U S V' DECOMP (aka SVD)
@Override
public void sgesvd(byte jobu, byte jobvt, int M, int N, INDArray A, INDArray S, INDArray U, INDArray VT, INDArray INFO) {
INDArray superb = Nd4j.create(M < N ? M : N);
int status = LAPACKE_sgesvd(getColumnOrder(A), jobu, jobvt, M, N, (FloatPointer) A.data().addressPointer(), getLda(A), (FloatPointer) S.data().addressPointer(), U == null ? null : (FloatPointer) U.data().addressPointer(), U == null ? 1 : getLda(U), VT == null ? null : (FloatPointer) VT.data().addressPointer(), VT == null ? 1 : getLda(VT), (FloatPointer) superb.data().addressPointer());
if (status != 0) {
throw new BlasException("Failed to execute sgesvd", status);
}
}
Aggregations