|
Ublas : |
Subject: [ublas] Lu_substitute is failing for matrix order >5
From: renn0xtek9_at_[hidden]
Date: 2013-01-31 18:34:39
Hello folks,
I am very new at using boost,
I wanted to invert a matrix, in order to solve a least_square_mean problem
Sadly the inversion works for a matrix order less then 6 but not for more
The code I am using is from http://savingyoutime.wordpress.com/2009/09/21/c-matrix-inversion-boostublas/
Apparently it fails while executing lu_subsitute
Any hints ont what happen ?
thanks
template
bool InvertMatrix(const matrix& input, matrix& inverse){ //thks to
typedef permutation_matrix pmatrix;
// create a working copy of the input
matrix A(input);
// create a permutation matrix for the LU-factorization
pmatrix pm(A.size1());
// perform LU-factorization
int res = lu_factorize(A, pm);
cout<<"\n No fail while factorization";
if (res != 0){
return false;
}
cout<<"\n A is:\n"< (A.size1()));
// backsubstitute to get the inverse
cout<<"\n Isgoing to inver";
lu_substitute(A, pm, inverse);
return true;
}
Output of A and pm are in this past
http://paste.opensuse.org/32062940
The error message
Check failed in file /usr/include/boost/numeric/ublas/lu.hpp at line 299:
detail::expression_type_check (prod (triangular_adaptor (m), e), cm2)
terminate called after throwing an instance of 'boost::numeric::ublas::internal_logic'
what(): internal logic
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net