Re: [eigen] Eigen objects as vectors and matrices |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Eigen objects as vectors and matrices*From*: Billy Araujo <billyaraujo@xxxxxxxxx>*Date*: Mon, 2 Jul 2012 16:48:05 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=xlab0Fw9ZmFQl71XRJ2w+aP1MoVG02mtIKnvT9f3gdE=; b=C0Kzo0Tql9/ten0chERSUBDP0BAVOnMbk+cs0q3Q6Ax9qU0m5faqkN8YzEHfdu4Pvm 4faDv+JO8v5XalG6m0YFDYd72utOT8PMWnVw72Req36DbB4COW0EW7YnWqT/vKV6zPP+ DbMX5XZ9xaLQkNsanfFDfM8Tsq+Z+Wiz2eUikJDI3dCZxnoM+VF00QCXwGO5oJdcP34J FlQkaShHJFRZ6SinMpjjV5Glds2SLrRL/5cq9usZoCAfPst+QtnJjNpPJJq2hqGbtkfz O6GPBULhp5U7/BZujxkZxhbO72GzpUCdTiK7R/hBf0heIbh/GmaDbJrIbqREDvKhZsIt kkzw==

You could just make a n*m vector then.

But why would you want that? It seems very inefficient.

On Mon, Jul 2, 2012 at 4:41 PM, Brad Bell <bradbell@xxxxxxxxxx> wrote:

I want to an object both as a matrix and as a vector, so I am constructing the object using

Matrix<double, Dynamic, Dynamic> object(m*n, 1);

and then plan to do an

object. conservativeResize(m, n)

before using it as a matrix. The problem is that the bracket operator

object[i]

does not seem to work when object is a vector (and the software I am using access vectors this way).

For example, the following source code does not compile:

# include <Eigen/Dense>

int main(void)

{

using Eigen::Matrix;

using Eigen::Dynamic;

typedef Matrix<double, Dynamic, Dynamic> matrix;

matrix v(2,1);

v[0] = 1.0;

v[1] = 2.0;

return 0;

}

~

**References**:**[eigen] Eigen objects as vectors and matrices***From:*Brad Bell

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Eigen objects as vectors and matrices** - Next by Date:
**Re: [eigen] Eigen objects as vectors and matrices** - Previous by thread:
**[eigen] Eigen objects as vectors and matrices** - Next by thread:
**Re: [eigen] Eigen objects as vectors and matrices**

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