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

Use of power function on VectorXd

Tags: None
(comma "," separated)
rodolfofaria
Registered Member
Posts
2
Karma
0

Use of power function on VectorXd

Fri Apr 24, 2015 10:41 pm
Dear all,

I found that

array1.pow(exponent)

can be done. But I need to perform the analogous operation on a vector. For example:

VectorXd a(x), b(x), c(x) ;

a = scalar * b * c.pow(0.75);

If this can also be done, could you please point that out ? Thank you.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You view any vector/matrix as an array using the .array() method, e.g.:

a = scalar * b .array() * c.array().pow(0.75);

.array() cost nothing, it only changes the semantic/API.
rodolfofaria
Registered Member
Posts
2
Karma
0

Re: Use of power function on VectorXd

Tue Apr 28, 2015 10:18 pm
Thanks a lot. :)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]