c++ - A^T*A sparse product, results Store in Dense Matrix / Eigen Lib -


sparsematrix<double> mata(rows, cols); sparsematrix<double> ata(rows, cols); ... ata = (sparsematrix<double>(mata.transpose()) * mata).pruned(); //.triangularview<lower>(); 

if want store results dense matrix ex. data = ..., returns strange error of pruned function.

  1. smaller question:

if use .triangularview<lower>(); store in heap n/2+n elements of (ata or data) in dynamic allocation?

log:

jni/eigen/src/sparsecore/sparsesparseproductwithpruning.h: in function 'void eigen::internal::sparse_sparse_product_with_pruning_impl(const lhs&, const rhs&, resulttype&, const typename resulttype::realscalar&) [with lhs = eigen::sparsematrix<double>, rhs = eigen::sparsematrix<double>, resulttype = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>, typename resulttype::realscalar = double]': jni/eigen/src/sparsecore/sparsesparseproductwithpruning.h:91:5:   instantiated 'static void eigen::internal::sparse_sparse_product_with_pruning_selector<lhs, rhs, resulttype, 0, 0, 0>::run(const lhs&, const rhs&, resulttype&, const realscalar&) [with lhs = eigen::sparsematrix<double>, rhs = eigen::sparsematrix<double>, resulttype = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>, eigen::internal::sparse_sparse_product_with_pruning_selector<lhs, rhs, resulttype, 0, 0, 0>::realscalar = double]' jni/eigen/src/sparsecore/sparseproduct.h:121:9:   instantiated 'void eigen::sparsesparseproduct<lhs, rhs>::evalto(dest&) const [with dest = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>, lhsnested = eigen::sparsematrix<double>, rhsnested = const eigen::sparsematrix<double>&]' jni/eigen/src/core/assign.h:522:101:   instantiated 'static derived& eigen::internal::assign_selector<derived, otherderived, false, false>::evalto(actualderived&, const actualotherderived&) [with actualderived = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>, actualotherderived = eigen::sparsesparseproduct<eigen::sparsematrix<double>, const eigen::sparsematrix<double>&>, derived = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>, otherderived = eigen::sparsesparseproduct<eigen::sparsematrix<double>, const eigen::sparsematrix<double>&>]' jni/eigen/src/core/assign.h:571:98:   instantiated 'derived& eigen::matrixbase<derived>::operator=(const eigen::eigenbase<otherderived>&) [with otherderived = eigen::sparsesparseproduct<eigen::sparsematrix<double>, const eigen::sparsematrix<double>&>, derived = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>]' jni/eigen/src/core/plainobjectbase.h:453:7:   instantiated 'derived& eigen::plainobjectbase<derived>::operator=(const eigen::eigenbase<otherderived>&) [with otherderived = eigen::sparsesparseproduct<eigen::sparsematrix<double>, const eigen::sparsematrix<double>&>, derived = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>]' jni/eigen/src/core/matrix.h:184:35:   instantiated 'eigen::matrix<_scalar, _rows, _cols, _options, _maxrows, _maxcols>& eigen::matrix<_scalar, _rows, _cols, _options, _maxrows, _maxcols>::operator=(const eigen::eigenbase<otherderived>&) [with otherderived = eigen::sparsesparseproduct<eigen::sparsematrix<double>, const eigen::sparsematrix<double>&>, _scalar = double, int _rows = -0x00000000000000001, int _cols = -0x00000000000000001, int _options = 0, int _maxrows = -0x00000000000000001, int _maxcols = -0x00000000000000001, eigen::matrix<_scalar, _rows, _cols, _options, _maxrows, _maxcols> = eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>]' jni/after.cpp:429:36:   instantiated here jni/eigen/src/sparsecore/sparsesparseproductwithpruning.h:50:3: error: 'class eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>' has no member named 'reserve' jni/eigen/src/sparsecore/sparsesparseproductwithpruning.h:69:5: error: 'class eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>' has no member named 'startvec' jni/eigen/src/sparsecore/sparsesparseproductwithpruning.h:71:7: error: 'class eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>' has no member named 'insertbackbyouterinner' jni/eigen/src/sparsecore/sparsesparseproductwithpruning.h:73:3: error: 'class eigen::matrix<double, -0x00000000000000001, -0x00000000000000001>' has no member named 'finalize' make.exe: *** [obj/local/armeabi-v7a/objs/com_jp_algi_corec/after.o] error 1  **** build finished **** 

for future reference, lot easier people (and yourself) if prepare minimal, complete, , verifiable example, did below. me, helped me understand tried ask. you, understand problem better , maybe solve it.

int main(int argc, char *argv[]) {     sparsematrix<double> a(3,3), ata;     a.coeffref(1,2) = 0.;     a.coeffref(1,1) = 2.;     a.coeffref(1,0) = 6.;     a.coeffref(0,1) = 1.;     cout << << endl;     ata = (a.transpose() * a).pruned();     cout << ata << endl;     ata = (sparsematrix<double>(a.transpose()) * a).pruned();     cout << ata << endl;     matrixxd dense = ata.todense();     cout << dense << endl;     /*****************************************************/     // works fine until point     /*****************************************************/      //dense = (sparsematrix<double>(a.transpose()) * a).pruned(); // doesn't compile      // compile if written following line     dense = sparsematrix<double>((sparsematrix<double>(a.transpose()) * a).pruned()).todense(); // works     cout << dense << endl;     return 0; } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -