当前位置: 首页 > 工具软件 > ND4J > 使用案例 >

ND4J计算特征值和特征向量

袁志专
2023-12-01

    ND4J是java环境下的n维向量计算框架。线性代数的核心是计算特征值和特征向量。但ND4J无法计算,原因如下:

    ND4J中有方法类Eigen,计算特征值和特征向量的方法包含其中。主要有三个:

eigenvalues()
eigenvectors()
symmetricGeneralizedEigenvalues()

    以上三个方法会引用BaseBlasWrapper类中的函数。但关键函数的实现未开源,源代码如下:

    @Override
    public INDArray gesv(INDArray a, int[] ipiv, INDArray b) {
        throw new UnsupportedOperationException();
    }
    @Override
    public void checkInfo(String name, int info) {
    }
    @Override
    public INDArray sysv(char uplo, INDArray a, int[] ipiv, INDArray b) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int syev(char jobz, char uplo, INDArray a, INDArray w) {
        return lapack().syev(jobz, uplo, a, w);
    }
    @Override
    public int syevx(char jobz, char range, char uplo, INDArray a, double vl, double vu, int il, int iu, double abstol,
                    INDArray w, INDArray z) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int syevx(char jobz, char range, char uplo, INDArray a, float vl, float vu, int il, int iu, float abstol,
                    INDArray w, INDArray z) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int syevd(char jobz, char uplo, INDArray A, INDArray w) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int syevr(char jobz, char range, char uplo, INDArray a, double vl, double vu, int il, int iu, double abstol,
                    INDArray w, INDArray z, int[] isuppz) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int syevr(char jobz, char range, char uplo, INDArray a, float vl, float vu, int il, int iu, float abstol,
                    INDArray w, INDArray z, int[] isuppz) {
        throw new UnsupportedOperationException();
    }
    @Override
    public void posv(char uplo, INDArray A, INDArray B) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int geev(char jobvl, char jobvr, INDArray A, INDArray WR, INDArray WI, INDArray VL, INDArray VR) {
        throw new UnsupportedOperationException();
    }
    @Override
    public int sygvd(int itype, char jobz, char uplo, INDArray A, INDArray B, INDArray W) {
        throw new UnsupportedOperationException();
    }
    @Override
    public void gelsd(INDArray A, INDArray B) {
        throw new UnsupportedOperationException();
    }
    @Override
    public void geqrf(INDArray A, INDArray tau) {
        throw new UnsupportedOperationException();
    }
    @Override
    public void ormqr(char side, char trans, INDArray A, INDArray tau, INDArray C) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void saxpy(double alpha, INDArray x, INDArray y) {
        axpy(alpha, x, y);
    }
    @Override
    public void saxpy(float alpha, INDArray x, INDArray y) {
        axpy(alpha, x, y);
    }

 类似资料: