--- In Boost-Users@y..., "jhrwalter"
--- In Boost-Users@y..., John Lloyd
wrote: Hickman, Greg wrote:
Why isn't there an overloaded
matrix_expression operator* (const matrix_expression&, const matrix_expression&);
for peforming matrix multiplication?
Greg Hickman
Info: http://www.boost.org Wiki: <http://www.crystalclearsoftware.com/cgi- bin/boost_wiki/wiki.pl> Unsubscribe: mailto:boost-users-unsubscribe@y...
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
I think it has something to do with the fact that expression templates can be very inefficient for certain chained operations, e.g., A * B * v, where A and B are matrices and v is a vector.
Suppose you have a matrix expression like A = B * C * D. Using expression templates, this could result in an order n^5 time complexity as opposed to order n^3 complexity.
Exactly. I believe the theoretically more important signature is prod
(A, B), although prod (A, B) will be more frequently used practically (BTW: the complexity of prod (A, B) (i, j) is O(n) as opposed to O(n^3) for prod (A, B) (i, j)). Best regards
Joerg
Here are couple of thoughts:
1) matrix-matrix multiplication and matrix-vector multiplication are
ones of most used operators in matrix computations (especially
second), if these are not presented the value of expression framework
itself becomes questionable.
2) To avoid extra computational compexity temporaries can be used. In
some cases temporaries are presented in expressions already, like:
A = B * C;
Matrix A can be used as temporary. More complex expressions like:
A = B * C * D;
will require additional temp matrix.
3) To minimize performance penalty template specialization can be
used. For example:
matrix_matrix_prod