[Developers] linear algebra (matrix algebra)
Arni Magnusson
arnima at hafro.is
Thu Jun 17 09:36:30 PDT 2010
I experimented with Saang-Yoon's example and also reached the m(1,1)
solution that Dave points out, but wanted to hear from someone more
experienced whether that was the best way.
Do you know if it would be easy and sensible to implement a DWIM (do what
I mean) coercion here, where
named_dvariable& operator = (_CONST dvar_matrix& m);
would check if the matrix is 1x1 and then return the (1,1) element as
dvariable, otherwise return an error?
I think Dave's design, that Matrix*Matrix should always return Matrix, is
what most users want. But we could still implement the coercion that
Saang-Yoon expected to work, right?
Arni
On Thu, 17 Jun 2010, dave fournier wrote:
> a matrix times a matrix returns a matrix even if it is 1x1.
> (I'm not checking for this case). If it is 1x1
>
> !!sC=(trans(mA)*mB)(1,1);
>
> should do the trick for you.
>
More information about the Developers
mailing list