|
Ublas : |
Subject: Re: [ublas] whole ublas matrix as vector
From: Michael Norel (minorlogic_at_[hidden])
Date: 2009-09-07 09:35:20
Hi All.
i tried to use "norm_inf" for matrices but i get unexpected result
//-------------------------------------------
Matrix m(2, 3);
Vector v(2*3);
for (SizeType i = 0; i < m.size1 (); ++ i)
{
for (SizeType j = 0; j < m.size2 (); ++ j)
{
v (i * m.size2() + j) = m (i, j) = -(Real)(3 * i + j);
}
}
std::cout << m << std::endl;
std::cout << v << std::endl;
std::cout << norm_inf(m) << std::endl;
std::cout << norm_inf(v) << std::endl;
//-------------------------------------------
.[2,3]((-0,-1,-2),(-3,-4,-5))
[6](-0,-1,-2,-3,-4,-5)
12
5
Is it expected result? what is math meaning of norm_inf(m) ?
Thanks
--- On Sun, 9/6/09, Gunter Winkler <guwi17_at_[hidden]> wrote:
> From: Gunter Winkler <guwi17_at_[hidden]>
> Subject: Re: [ublas] whole ublas matrix as vector
> To: "ublas mailing list" <ublas_at_[hidden]>
> Date: Sunday, September 6, 2009, 9:11 PM
> Michael Norel schrieb:
> > Hi all!
> >
> > I still need this functionality (matrix expression as
> vector expression)for intensive use of ublas.
> >
> >
> Please check out the latest development version from SVN:
> see
> https://svn.boost.org/trac/boost/wiki/BoostSubversion
> and have a look at
> experimental/sparse_view.hpp, class c_array_view. This
> class should
> fulfill the immutable part of storage array concept. Now
> only a class
> fulfilling the immutable part of the vector concept must be
> developed
> which can be used to present any storage array as a read
> only vector.
>
> > I need to
> > 1. compare 2 matrixes with some eplison threshold like
> "norm_2(m1-m2) < eps"
> >
> Why not using norm_inf or norm_1 for matrices?
>
> > 2. check if the submatrix of matrix is zero like
> "norm_2(m1) > 0"
> >
> I'd also suggest to use norm_inf or even better a customer
> function that
> aborts the check at the first non-zero element.
> > 3. find the absolute maximum element of matrix like
> norm_inf(m1)
> > and many others, where m1 and m2 is matrix
> expressions.
> >
> >
> Could you prepare a list of the most used matrix functions?
> Maybe there
> are others interested. Then we could easily add a
> matrix-tools header
> which contains such methods.
>
> There is a trac for boost: https://svn.boost.org/trac/boost/
>
> Here you can view, comment and create new tickets. Feel
> free to create a
> feature request for uBLAS. Try to add an example or
> pseudo-code to
> express the expected usage.
>
> > Where can a i post the functionality request for such
> adaptor? Or it is realy the right way to implement it
> myself?
> >
> The quickest way is always do it on yourself and to post
> the patch, an
> example and a unittest here. Then I can review the code and
> commit it to
> the repository.
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: minorlogic_at_[hidden]
>