Boost logo

Boost Users :

Subject: Re: [Boost-users] symmetric_matrix operation
From: Kim Kuen Tang (kuentang_at_[hidden])
Date: 2009-05-26 15:12:59


Hi Archie14,

hth:

# include <boost/numeric/ublas/symmetric.hpp>
# include <boost/numeric/ublas/io.hpp>
# include <boost/spirit/include/phoenix.hpp>

# include <vector>
# include <algorithm>

using namespace boost::phoenix;
using namespace boost::phoenix::arg_names;
using namespace boost::numeric::ublas;

int main () {

    symmetric_matrix<double,lower> m(3, 3), n(3,3), u(3,3);
    generate(arg1, lambda[val(1.0)] )(m.data());
    generate(arg1, lambda[val(2.0)] )(n.data());
    
transform(arg1,n.data().begin(),u.data().begin(),lambda[arg1/arg2])(m.data());

    std::cout << u << std::endl;
}

Best regards,
Kim

Archie14 schrieb:
> My questions are:
> 1. Can I use iterators (begin1, begin2) and if yes, then how? Examples in the
> doc use above method of iterating through elements, without using iterators.
> 2. I did not find built-in operators in the symmetric_matrix to do this
> division, but may be I overlooked smth or did not understand the docs?
> 3. If matrix "msecond" contains zeros - what is the "boost-way" to deal with
> this?
>
>
>
>
>
> _______________________________________________
> 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