Boost logo

Ublas :

From: Brad Bell (old) (brad_at_[hidden])
Date: 2006-03-29 14:12:35


What is the best way to perform matrix element by element operations using
Ublas matrices; i.e., suppose
        C(i,j) = A(i,j) Op B(i,j)
where Op is +, -, *, or / ?

Is there a way to use all the elements of a matrix as a vector (in row
major or column major order) with out copying the elements of the matrix ?
If so, perhaps this is the best way; i.e., convert the matrices to
vector expressions, then perform the element by element operations, then
convert the vector expression to a resulting matrix ?

Perhaps it is best to store everything as vectors and only convert to
matrices expressions for matrix operations such as matrix multiplication
and solving linear equations ?