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

SparseMatrix Function problem

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

SparseMatrix Function problem

Sun Aug 12, 2012 6:52 am
Hello

I have a problem implementing a mcl algorithm with Eigen SparseMatrix<float>. The documentation states that there is a cwisePow() function, but in fact there is none. I want to implement a <matlab> m2 = m .^ p; <matlab> function but got lost with power function. can someone help me pls?

Thx in advance
Peter
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: SparseMatrix Function problem

Sun Aug 12, 2012 8:03 am
There is indeed no cwisePow, nor .array().pow(exponent) for sparse objects. In the meantime:

mat2 = mat.unaryExpr(Eigen::internal::scalar_pow_op<float>(p));
szigetipeter
Registered Member
Posts
2
Karma
0

Re: SparseMatrix Function problem

Sun Aug 12, 2012 9:44 am
Thank you for the info big help.

i have a nother question there is a normalization problem, and the MatrixXf has a normalize function, but SparseMatrix has none.
dinv = diag(1./sum(m2))
m2 = m2 * dinv;
This is my matlab code. Could you help me pls?

Thx


Bookmarks



Who is online

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