11 ladel_sparse_matrix res{};
12 res.nzmax = mat.nonZeros();
13 res.nrow = mat.rows();
14 res.ncol = mat.cols();
15 res.p = mat.outerIndexPtr();
16 res.i = mat.innerIndexPtr();
17 res.x = mat.valuePtr();
18 res.nz = mat.innerNonZeroPtr();
20 res.symmetry = symmetry;
31 ladel_int nz = mat.innerNonZeroPtr() ==
nullptr ?
FALSE :
TRUE;
32 auto res = ::ladel_sparse_alloc(mat.rows(), mat.cols(), mat.nonZeros(),
33 UNSYMMETRIC,
TRUE, nz);
34 assert(mat.outerSize() + 1 <= res->ncol + 1);
35 std::copy_n(mat.outerIndexPtr(), mat.outerSize() + 1, res->p);
36 assert(mat.nonZeros() <= res->nzmax);
37 std::copy_n(mat.innerIndexPtr(), mat.nonZeros(), res->i);
38 assert(mat.nonZeros() <= res->nzmax);
39 std::copy_n(mat.valuePtr(), mat.nonZeros(), res->x);
40 if (mat.innerNonZeroPtr() !=
nullptr) {
41 assert(mat.outerSize() <= res->ncol);
42 std::copy_n(mat.innerNonZeroPtr(), mat.outerSize(), res->nz);
ladel_sparse_matrix eigen_to_ladel(sparse_mat_t &mat, ladel_int symmetry=UNSYMMETRIC)
Convert an Eigen sparse matrix to a LADEL sparse matrix, without creating a copy.
ladel_sparse_matrix_ptr eigen_to_ladel_copy(const sparse_mat_t &mat)
Similar to eigen_to_ladel, but creates a copy of all data, in such a way that the returned matrix is ...