Boost logo

Boost Users :

From: speedsnaii speedsnaii_at_[hidden])
Date: 2003-02-16 05:44:30


First thank you for help, but I still find it very hard to use the
ublas (yes I am somewhat between an oldie and newbie).

I tried to find out what is happening in the case:

matrix<double> foo()
{
matrix<double> r(3);
    return r;
}

...

r1 = foo();

The matrix (that was constructed on the stack) is copied twice when
used in this manner. One copy for the returned temporary, a second
copy for the assignment. (I am using MSVC debug mode) And this
definitely is not a cheap operation. Both in terms of memory _and_
execution time.

Also a second question comes to me now:
Can I define a LHS that can be the target of an arbitrary size matrix?
I.e.:
matrix<double> lhs;
matrix<doubel> rhs(3,3);

lhs = rhs;

will give a runtime exeception because of different size. Can I do
anything about this?

I have the feeling, that I still do not well understand the overall
semantics of the matrix and vector classes. Are there any
books/examples which I can study to get a better understanding?

Thank you again,
Roland


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