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

Custom (lazy) evaluated Matrix

Tags: None
(comma "," separated)
Defolos
Registered Member
Posts
4
Karma
0

Custom (lazy) evaluated Matrix

Thu Dec 03, 2015 2:45 pm
Hi folks,

I am using Eigen for a numerical solver and I have a peculiar problem: I want to create a matrix, which does not actually store the elements but computes them when accessed (I do not want to store it, because it should actually represent a slice of a 3d matrix and that's too large to fit into memory; it is also unfortunately not sparse). Basically I want to create something with a simple getter:
Code: Select all
double element(i, j) {
return /* simple calculation here */;
}

Is there an easy way how to achieve that in Eigen?


Thanks in advance for any suggestions
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Custom (lazy) evaluated Matrix

Thu Dec 03, 2015 9:45 pm
yes, you can use MatrixXd::NullaryExpr(my_functor), there is an example there: http://eigen.tuxfamily.org/dox-devel/cl ... f78b068a9b


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]