From: Nizar Khalifa Sallem (nksallem_at_[hidden])
Date: 2008-07-23 11:09:28
Garret McGraw wrote:
> I've looked around at the wiki and previous mailing list posts and I
> cannot find the answer to my question there. What I need to do is
> define a custom class and set it to be stored in a matrix such as:
> matrix<MyCustomClass> mat1(300, 300);
> And then it must be able to be multiplied by another matrix of a
> different type.
> matrix<MyCustomClass2> mat2(300, 300);
> Then I want to be able to take the product of the two matrices have
> have it go into another matrix of a third type:
> matrix<MyCustomClass3> mat3(300, 300);
> mat3 = prod(mat1, mat2);
> Now I have defined operators to multiply MyCustomClass*MyCustomClass2
> and return MyCustomClass3 and also the operator MyCustomClass3 +=
> Is there any other operators that I must define for this to compile?
> Is this even possible with ublas?
> Thanks in advance,
> ublas mailing list
You need to redefine opertaor (row, col) and prod() I guess since there
are some product that only prod can handle ot opertaor * besides you
have to make operator (row, col) return also references on your
That's where I can go so far with my experience of ublas, may be others
could help better.