Re: [eigen] Not able to solve the system of equation having vector as coefficient of the matrix |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Not able to solve the system of equation having vector as coefficient of the matrix*From*: Sameer Agarwal <sameeragarwal@xxxxxxxxxx>*Date*: Wed, 5 Jun 2019 13:43:11 -0700*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=C2fDDStzSR/VxSxe6spAVXkxTyEGC5koH0+F2gTtSN8=; b=rMc87/YUtB9k1sC3ND+UZTkQpKazopUMgRjTGGZHoUdCbkz0TgqZLOdg4iIKDKMUUy loyRSeNdPR2foZAgS86uc/AuCkdeHTEAcmk9jR+O/Jm2xNuXl1LXBibS+fHeTbN5P4VQ UFHbaCoBJliObTxtidqw+wDsceho37XuMvgDxU36vVFOOL5b9GArTqgXD+HY7+mokeEX C6jXDrGeq/oJw0zC9OMLIs4F2Mx9q7x+F86zjGCESOPUEzpq71Kpy56ucNld6UsNBb/u KW6URFu1adUVlWqgd8xNXRasdDWNSML6ZJvdY/bXMsFVDlOgfxeX39LLiwFNDeuk5+iE 7Wqw==

Since the two linear systems share nothing but the size, beyond some sort of function call overhead, you should not expect there to be any savings in actually solving the linear system.

On Tue, Jun 4, 2019 at 10:54 PM Rohit Aggarwal <cs18mtech11030@xxxxxxxxxx> wrote:

Dear Adrien,Thanks for your quick reply.As you said in your reply "Is it really what you are looking for, or do you want to solve two separate systems, one with the first elements of all your vectors, and the other with the second elements?"Yes, I am looking for the same thing. I just wanted to know whether there exists some implementation which can do this in an efficient way rather than posing it as two separate systems?Thanks,Rohit AggarwalOn Wed, Jun 5, 2019 at 5:55 AM Adrien Escande <adrien.escande@xxxxxxxxx> wrote:Dear Rohit,is there any particular reasons that you explicitely want the elements in your matrices to be 2d vectors? From a mathematical point of view, your problem seems ill-formed: 2d-vectors are not invertible.If you just need to form matrices from 2d-vector, replace every Eigen::Matrix<Eigen::RowVector2d, 2, 2> with Eigen::Matrix<double, 4, 2> in your code, and you're set.Note that A being 4-by-2, your system is under-determined, and your solution will be a 2-by-2 matrix. Is it really what you are looking for, or do you want to solve two separate systems, one with the first elements of all your vectors, and the other with the second elements?Best regards,Adrien

On Wed, Jun 5, 2019 at 4:07 AM Rohit Aggarwal <cs18mtech11030@xxxxxxxxxx> wrote:Hi All,

We are trying to use eigen solver api to solve the problem in which we have a matrix containing vector as the coefficient of it.

Form Ax=B

Able to create a matrix for A(2,2) having a vector like

[ [1,2],[3,4]

[5,6],[7,8] ]

Matrix B(2,1)

[ [1,2]

[1,1] ]

But when I am trying to pass the value to the solver, it is giving fatal error (Eigen/src/SVD/JacobiSVD.h:714:15: error: no matching function for call to ‘abs(const Scalar&)’ if(abs(m_workMatrix.coeff(p,q))>threshold || abs(m_workMatrix.coeff(q,p)) > threshold).)

Please look into it and suggest what I m missing.

#include <iostream>

#include "Eigen/Dense"

using namespace std;

using namespace Eigen;

int main()

{

Eigen::Matrix< Eigen::RowVector2d, 2, 2> A;

Eigen::Matrix< Eigen::RowVector2d, 2, 1> B;

RowVector2d rv1;

RowVector2d rv2;

RowVector2d rv3;

RowVector2d rv4;

rv1 << 1,2;

rv2 << 3,4;

rv3 << 5,6;

rv4 << 7,8;

cout << "Here is the matrix rv1:\n" << rv1 << endl;

cout << "Here is the matrix rv2:\n" << rv2 << endl;

cout << "Here is the matrix rv3:\n" << rv3 << endl;

cout << "Here is the matrix rv4:\n" << rv4 << endl;

A << rv1,rv2, rv3, rv4;

RowVector2d b1;

RowVector2d b2;

b1 << 1,2;

b2 << 2,1;

B << b1, b2;

cout << "Here is the matrix B(0,0):\n" << B(0,0) << endl;

cout << "Here is the matrix B(0,1):\n" << B(1,0) << endl;

JacobiSVD<Eigen::Matrix<Eigen::RowVector2d, 2, 2>> dec(A);}-Rohit Aggarwal

**References**:**[eigen] Not able to solve the system of equation having vector as coefficient of the matrix***From:*Rohit Aggarwal

**Re: [eigen] Not able to solve the system of equation having vector as coefficient of the matrix***From:*Adrien Escande

**Re: [eigen] Not able to solve the system of equation having vector as coefficient of the matrix***From:*Rohit Aggarwal

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Not able to solve the system of equation having vector as coefficient of the matrix** - Next by Date:
**Re: [eigen] 3.3 branch state** - Previous by thread:
**Re: [eigen] Not able to solve the system of equation having vector as coefficient of the matrix** - Next by thread:
**Re: [eigen] 3.3 branch state**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |