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

How to use Matrix class with other scalar types

Tags: None
(comma "," separated)
User avatar
jamadagni
Registered Member
Posts
20
Karma
0
OS
Hello. I'm intending to use Eigen for linear algebra solving in relation to n degree Bezier curves. The equation is of the form of AL=B where A is a totally scalar (i.e. of float/decimal data type) square (n+1)*(n+1) matrix, and L and B are vectors containing coordinates of points as elements. The equation could be split into ALx=Bx, ALy=By etc for the x part, y part etc of the coordinates, but I'd like to handle it at one go if possible. Is it possible to do linear algebra using Eigen on such custom classes, and if so what concepts should the class representing the points model for that? I'd also like to know whether other arbitrary precision types like GMPQ, MPFR etc can be used with Eigen (for my A matrix).

The documentation at http://eigen.tuxfamily.org/dox/TutorialMatrixClass.html points to http://eigen.tuxfamily.org/dox/TopicScalarTypes.html for information on which data types are supported and how to extend Eigen to additional datatypes. However the latter page is still a to-do so I couldn't get my required info from there.

Any help is appreciated. Thanks!
Dee33
Registered Member
Posts
54
Karma
0
OS
If L and B are (n+1) x p dense matrices where each row contains the coordinates of one point, then you have nothing to do.
All decomposition classes in Eigen work for multiple right-hand side systems.
Now, if L and B are (n+1) x p one-dimensional vectors, you can use the Map class.
Code: Select all
Map<MatrixType, 0, OuterStride<> > matL(L.data(), n+1, p, <OuterStride<>(n+1));
Map<MatrixType, 0, OuterStride<> > matB(B.data(), n+1, p, <OuterStride<>(n+1));


In the unsupported module , there is a backend for MPFR C++ http://www.holoborodko.com/pavel/mpfr/
You can check it to see if it fits your needs.

Hope it helps !
User avatar
jamadagni
Registered Member
Posts
20
Karma
0
OS
Hello and thanks for replying. My further questions below:

Dee33 wrote:If L and B are (n+1) x p dense matrices where each row contains the coordinates of one point, then you have nothing to do.
All decomposition classes in Eigen work for multiple right-hand side systems.


Are you saying that I can make L and B contain the coordinates of the form:

Code: Select all
x1 y1
x2 y2
x3 y3
x4 y4


... and Eigen will automatically solve for the x and y coordinates separately?

Now, if L and B are (n+1) x p one-dimensional vectors

You mean (n+1) x 1, right?

Thanks!
Dee33
Registered Member
Posts
54
Karma
0
OS
Yes exactly !!!


Bookmarks



Who is online

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