Boost logo

Boost Users :

From: Chris Weed (chrisweed_at_[hidden])
Date: 2006-10-13 15:33:37


This is probably so all the matrix classes have the same interface.

This would allow functions on matrices to work generically for
rect_matrix and identity_matrix.

template<typename MatrixType>
size_t num_elements(MatrixType m)
{
return m.size1()*m.size2();
}

identity_matrix i;
rectangular_matrix r;
std::cout << num_elements(i) << std::endl;
std::cout << num_elements(r) << std::endl;

Chris

On 10/13/06, YYW <yyw1_25_at_[hidden]> wrote:
> Hi all,
> I'm a newcomer to uBlas.
> Please consider the following code:
>
> identity_matrix<double> matI(3);
> int row = matI.size1();
> int col = matI.size2();
>
> now that matI has the same number of rows and columns, why the
> identity_matrix template class has two "size" member functions: size1() and
> size2()? And has two "size" member variables: size1_ and size2_? Why not use
> just size() and size_?
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net