Ok, so then let me ask you the questions directly.
I want to use eigen for containing matrices or arbitrary size
with coefficients in a template class which could be
a) float point like "float", "double" but also higher precision like
"quadmath" or "mpreal"
b) or a number type arithmetic like "mpq_class", "flintxx" or "int"
or some number field types.
I already have my own type with
template<typename T>
struct MyMatrix
{
public:
.
.
.
private:
int nbRow;
int nbCol;
T *ListElt;
};
but it depends on copy operators all around (though I should be
able to use the move semantic). So I was wondering if I could
use eigen as a more advanced matrix operation container.
I have no problem using eigen in a single routine and computing
inverse, which are actually of better quality than the one I computed
with my own stupid Gauss elimination code. However, I have
problems with the copy operators and how to acess to the class
capabilities.
Q1: How to write a function that returns a matrix?
the following code does not compile:
Eigen::Matrix<double> HilbertMatrix(int const& n)
{
Eigen::Matrix<double,Dynamic,Dynamic> eMat(n, n);
for (int i=0; i<n; i++)
for (int j=0; j<n; j++)
eMat[i][j]=double(1)/(double(i+j+1));
return eMat;
}
Q2: What is the list of individual operations? I imagine
inverses function should be different between a floating
point type and an exact number theoretic type. How can
I acces exact inverse functions?
Q3: For the number theoretic operations, the technique
is to do Gauss rows and columns operations. I understand
Gauss elimination is out of consideration for floating
point operations. But for number theory this is what is
needed. Can we have access to operation like
Ci <----- >Ci - a Cj ?
Q4: I sometimes need higher dimensional containers.
I wrote one inspired by "MyMatrix". Is there something
similar in Eigen? I guess no, just asking.
Q5: There are many examples of use eigen in the code
but they are all more or less of the same kind.
a) Could we get examples that use template parameters?
double and float are fine but that is not what all there is
b) Could we get examples with variable matrix size?
c) Could we get use of copy constructors and assignment
operators?
Thank you very much in advance.
Best,
Mathieu