Search code examples
matrixsparse-matrixojalgo

Resolve matrix differential equation with sparse matrix and ojAlgo


I am developping a java evolution tool with ojAlgo, and I try to resolve the following equation :

this differential equation

where A is a sparse matrix (for now the dimension of the matrix is 2000 x 2000, it will be scaled later on), A is not symmetric and use only real values.

I made some researchs and I tried to find the way to resolve this equation (using SparseStore) on github wiki/javadoc but I didn't find a way to do it. Can you help me find methods/class I should use ? Thank you


Solution

  • There is no direct/specific method to solve differential equations in ojAlgo. You have to know how to do it (using pen and paper) then ojAlgo can help you perform the calculations.

    The main problem here is finding the eigenpairs, right?

        Eigenvalue<Double> evd = Eigenvalue.PRIMITIVE.make(matrix);
    
        evd.decompose(matrix);
    
        Array1D<ComplexNumber> values = evd.getEigenvalues();
        MatrixStore<ComplexNumber> vectors = evd.getEigenvectors();
        Eigenpair pair = evd.getEigenpair(0); // One of the pairs