/** * Perform an copy matrix multiplication * * @param other the other matrix to perform matrix multiply with * @param transpose the transpose status of each ndarray * @return the result of the matrix multiplication */ @Override public INDArray mmuli(INDArray other, MMulTranspose transpose) { return dup().mmuli(other, this,transpose); }
/** * Perform an copy matrix multiplication * * @param other the other matrix to perform matrix multiply with * @return the result of the matrix multiplication */ @Override public INDArray mmuli(INDArray other) { return dup().mmuli(other, this); }
/** * Create an in-place random projection by using in-place matrix product with a random matrix * @param data * @return the projected matrix */ public INDArray projecti(INDArray data){ long[] tShape = targetShape(data.shape(), eps, components, autoMode); return data.mmuli(getProjectionMatrix(tShape, this.rng)); }
/** * Create an in-place random projection by using in-place matrix product with a random matrix * * @param data * @param result a placeholder result * @return */ public INDArray projecti(INDArray data, INDArray result){ long[] tShape = targetShape(data.shape(), eps, components, autoMode); return data.mmuli(getProjectionMatrix(tShape, this.rng), result); }
/** * Create a copy random projection by using matrix product with a random matrix * * @param data * @param result a placeholder result * @return */ public INDArray project(INDArray data, INDArray result){ long[] tShape = targetShape(data.shape(), eps, components, autoMode); return data.mmuli(getProjectionMatrix(tShape, this.rng), result); }
/** * Compute generalized eigenvalues of the problem A x = L B x. * The data will be unchanged, no eigenvectors returned unless calculateVectors is true. * If calculateVectors == true, A will contain a matrix with the eigenvectors as columns. * * @param A symmetric Matrix A. * @param B symmetric Matrix B. * @return a vector of eigenvalues L. */ public static INDArray symmetricGeneralizedEigenvalues(INDArray A, INDArray B, boolean calculateVectors) { assert A.rows() == A.columns(); assert B.rows() == B.columns(); INDArray W = Nd4j.create(A.rows()); if (calculateVectors) A.assign(InvertMatrix.invert(B, false).mmuli(A)); else A = InvertMatrix.invert(B, false).mmuli(A); Nd4j.getBlasWrapper().syev('V', 'L', A, W); return W; }
/** * Compute generalized eigenvalues of the problem A x = L B x. * The data will be unchanged, no eigenvectors returned. * * @param A symmetric Matrix A. * @param B symmetric Matrix B. * @return a vector of eigenvalues L. */ public static INDArray symmetricGeneralizedEigenvalues(INDArray A, INDArray B) { assert A.rows() == A.columns(); assert B.rows() == B.columns(); INDArray W = Nd4j.create(A.rows()); A = InvertMatrix.invert(B, false).mmuli(A); Nd4j.getBlasWrapper().syev('V', 'L', A, W); return W; }
/** * Perform an in place matrix multiplication * * @param other the other matrix to perform matrix multiply with * @param result the result ndarray * @return the result of the matrix multiplication */ @Override public INDArray mmuli(INDArray other, INDArray result, MMulTranspose transpose) { MMulTranspose mMulTranspose = MMulTranspose.builder() .a(this) .b(other) .transposeA(transpose.isTransposeA()) .transposeB(transpose.isTransposeB()) .transposeResult(transpose.isTransposeResult()) .build(); return mMulTranspose.getA().mmuli(mMulTranspose.getB(),result); }
return dup().mmuli(other, gemmResultArr);
/** * Perform an copy matrix multiplication * * @param other the other matrix to perform matrix multiply with * @return the result of the matrix multiplication */ @Override public INDArray mmuli(INDArray other) { return dup().mmuli(other, this); }
/** * Compute generalized eigenvalues of the problem A x = L B x. * The data will be unchanged, no eigenvectors returned unless calculateVectors is true. * If calculateVectors == true, A will contain a matrix with the eigenvectors as columns. * * @param A symmetric Matrix A. * @param B symmetric Matrix B. * @return a vector of eigenvalues L. */ public static INDArray symmetricGeneralizedEigenvalues(INDArray A, INDArray B, boolean calculateVectors) { assert A.rows() == A.columns(); assert B.rows() == B.columns(); INDArray W = Nd4j.create(A.rows()); if (calculateVectors) A.assign(InvertMatrix.invert(B, false).mmuli(A)); else A = InvertMatrix.invert(B, false).mmuli(A); Nd4j.getBlasWrapper().syev( 'V', 'L', A, W); return W; }
/** * Compute generalized eigenvalues of the problem A x = L B x. * The data will be unchanged, no eigenvectors returned. * * @param A symmetric Matrix A. * @param B symmetric Matrix B. * @return a vector of eigenvalues L. */ public static INDArray symmetricGeneralizedEigenvalues(INDArray A, INDArray B) { assert A.rows() == A.columns(); assert B.rows() == B.columns(); INDArray W = Nd4j.create(A.rows()); A = InvertMatrix.invert(B, false).mmuli(A); Nd4j.getBlasWrapper().syev( 'V', 'L', A, W); return W; }
return dup().mmuli(other,gemmResultArr);