This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Solving linear equations

Tags: None
(comma "," separated)
jonatan.olofsson
Registered Member
Posts
2
Karma
0
OS

Solving linear equations

Thu Jun 23, 2011 7:00 am
Hi,

I'm trying to implement some matrix equations
Code: Select all
// [2] eq. 9.7a: L = R\B'S
            L.noalias() = R.partialPivLu().solve(
                m.B.transpose()*S
            );


However, the above code yields the following compile error:
...eigen/Eigen/src/Core/DenseCoeffsBase.h:508: error: cannot convert 'const Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::PartialPivLU<Eigen::Matrix<double, 3, 3, 0, 3, 3> >, Eigen::Matrix<double, 9, 1, 0, 9, 1> > >::YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT' to 'double' in assignment


The headers I'm including are
Code: Select all
#include <Eigen/Core>
#include <Eigen/LU>



Does anyone have any suggestions as to what I'm doing wrong?

Best regards,
Jonatan Olofsson
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Solving linear equations

Thu Jun 23, 2011 7:57 am
you should evaluate m.B.transpose()*S:

(m.B.transpose()*S).eval()*

and no need for the noalias here.

EDIT: the evaluation should be done for you, I'm filling a bug report.
jonatan.olofsson
Registered Member
Posts
2
Karma
0
OS

Re: Solving linear equations

Thu Jun 23, 2011 8:21 am
Thank you very much ggael, it did indeed solve my problem!

I've been scratching my head for quite some time over this now =)

Best regards,
Jonatan


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar