Kronecker sparse product

83 Views Asked by At

I found these:

http://eigen.tuxfamily.org/dox/unsupported/classEigen_1_1KroneckerProductSparse.html http://eigen.tuxfamily.org/dox/unsupported/classEigen_1_1KroneckerProductBase.html

However I'm wondering if i can put csr or coo arrays directly into it. Not going through insert, set from triplets etc, cause i peeked inside those and a lot of things happen.

Something simple like this class:

class sparse_matrix_csr{
    public: 
    uint size;
    double *nnz_arr;
    int *col_arr;
    int *row_arr;

    //Row Major order
    sparse_matrix_csr(uint size_ext){ //constructor
        size = size_ext;
        nnz_arr = ALLOCATE_ARRAY(double, size*size*size);
        col_arr = ALLOCATE_ARRAY(int, size*size*size);
        row_arr = ALLOCATE_ARRAY(int, (size*size)+1 );
    }  
};

(Currently working on the destructor cause I'm always bad at these grammar-like things and chat-gpt doesn't aknowledge the existence of malloc).

Simple arrays are faster if you just need to create them and delete them.

So, i created an algorithm to give the 3 csr arrays i need for the initial sparse matrices (mkl documentation explains them. I think they are different from Eigen Inner and Outer Indices though), but i can rewrite it to give other formats too. I will put them inside an arpack diagonalizator, so csr should be better though, as i have that, coo or csc choices. There is no overlap with eigen, as they don't provide lanczos algorithms (they are provided by one library built upon it though, but that's a totally different usecase and style of writing).

So: is it possible to do so without rewriting all the algorithm, or is there something I could base this one on?

0

There are 0 best solutions below