Boost logo

Ublas :

Subject: Re: [ublas] Matrix with vector interface.
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2014-04-07 10:23:19


Joaquim,
The problem was with bool equals... function in vector_assign. I
modified it to work with integral types and not only floating point. The
changes have been pushed in
https://github.com/uBLAS/ublas/tree/ublas_feature0011_mvrange_interface_t7411

Can you please check if the tests pass now?

-Nasos

On 04/06/2014 07:17 PM, Joaquim Duran wrote:
> I've found the found the reason of that error: dense matrix could be
> resized by preserving its contents, but spare matrix must be resized
> without preserving its contents. So the resize test, should be
> modified, as in this patch (pending of commit to git):
>
> diff --git a/test/test_matrix_vector.cpp b/test/test_matrix_vector.cpp
> index a95763e..955f8dc 100644
> --- a/test/test_matrix_vector.cpp
> +++ b/test/test_matrix_vector.cpp
> @@ -68,7 +68,7 @@ bool test_matrix_row_facade() {
> pass &= (matrix.size2() == num_cols);
>
> typename Matrix::size_type new_num_rows = 6;
> - rows.resize(new_num_rows);
> + rows.resize(new_num_rows, false);
> pass &= (matrix.size1() == new_num_rows);
> pass &= (rows.size() == new_num_rows);
> pass &= (matrix.size2() == num_cols);
> @@ -222,7 +222,7 @@ bool test_matrix_column_facade() {
> pass &= (matrix.size1() == num_rows);
>
> typename Matrix::size_type new_num_cols = 6;
> - columns.resize(new_num_cols);
> + columns.resize(new_num_cols, false);
> pass &= (matrix.size2() == new_num_cols);
> pass &= (columns.size() == new_num_cols);
> pass &= (matrix.size1() == num_rows);
>
>
> OTOH, there are other issues:
>
> [Debug>> Testing mapped_matrix...
> [Debug>> test_matrix_row_facade: resize
> [Debug>> test_matrix_row_facade: operator()
> [Debug>> test_matrix_row_facade: operator[]
> [Debug>> test_matrix_row_facade: operator[] const
> [Debug>> test_matrix_row_facade: const iterator
> [Debug>> test_matrix_row_facade: iterator
> [Debug>> test_matrix_row_facade: reverse iterator
> [Debug>> test_matrix_row_facade: const reverse iterator
> [Debug>> test_matrix_row_facade: resize
> [Debug>> test_matrix_row_facade: operator()
> [Debug>> test_matrix_row_facade: operator[]
> [Debug>> test_matrix_row_facade: operator[] const
> [Debug>> test_matrix_row_facade: const iterator
> [Debug>> test_matrix_row_facade: iterator
> [Debug>> test_matrix_row_facade: reverse iterator
> [Debug>> test_matrix_row_facade: const reverse iterator
> [Debug>> test_matrix_row_facade: resize
> [Debug>> test_matrix_row_facade: operator()
> Check failed in file
> ../include/boost/numeric/ublas/detail/vector_assign.hpp at line 370:
> detail::expression_type_check (v, cv)
> [Error (test_matrix_vector.cpp:main:471)>> external logic or bad
> condition of inputs
>
> This error happens in the 3rd type <long>, why does the tests pass in
> <double> and <float>?
>
> Joaquim Duran
>
>
>
>
> 2014-04-04 2:24 GMT+02:00 Joaquim Duran <jduran.gm_at_[hidden]
> <mailto:jduran.gm_at_[hidden]>>:
>
> Hello,
>
> I've modified your traces to see where the tests fails, but no one
> fails. There are some checks in matrices that fails. The log has
> been attached. I'll continue checking.
>
>
> Joaquim Duran
>
>
>
> 2014-04-03 2:11 GMT+02:00 Nasos Iliopoulos <nasos_i_at_[hidden]
> <mailto:nasos_i_at_[hidden]>>:
>
> Hmm, my message seems chopped, so here we go again:
>
>
> Joaquim,
> I merged your pull request into
> https://github.com/uBLAS/ublas/tree/ublas_feature0011_mvrange_interface_t7411,
> but it seems that the unit test fails for sparse matrices.
> Before I start investigating it, do you have any ideas why?
>
> Please note that I made some minor changes for debugging
> reasons in test_matrix_vector.cpp.
>
> -Nasos
> ------------------------------------------------------------------------
> From: nasos_i_at_[hidden] <mailto:nasos_i_at_[hidden]>
> To: ublas_at_[hidden] <mailto:ublas_at_[hidden]>
> Date: Wed, 2 Apr 2014 11:49:30 -0400
>
> Subject: Re: [ublas] Matrix with vector interface.
>
> Joaquim,
> I merged your pull request into
> https://github.com/uBLAS/ublas/tree/ublas_feature0011_mvrange_interface_t7411,
> but it seems that the unit test fails for sparse matrices.
> Before I start investigating it, do you have any ideas why?
>
> Please note that I made some minor changes for debuging
> reasons in test_matrix_vector.cpp
> <https://github.com/uBLAS/ublas/blob/ublas_feature0011_mvrange_interface_t7411/test/test_matrix_vector.cpp>.
>
> -Nasos
>
> ------------------------------------------------------------------------
> Date: Sat, 17 Aug 2013 17:36:32 +0200
> From: jduran.gm_at_[hidden] <mailto:jduran.gm_at_[hidden]>
> To: ublas_at_[hidden] <mailto:ublas_at_[hidden]>
> Subject: Re: [ublas] Matrix with vector interface.
>
> Hello all,
>
> I've been used the matrix row/column range successfully.
> Also, I've modified the code of Oswin and I've generalized a
> little:
>
> - Added reverse iterators.
> - Resize of matrix
> * From matrix_row facade the number of rows of the matrix
> could be changed but not the number of columns.
> * From matrix_column facade the number of columns of the
> matrix could be changed but not the number of rows.
>
> I would like to update the source code to ticked 7411 if there
> is no inconvenient for your part. I've followed the style of
> Oswin. Also, I've provided an executable but not tests cases,
> as Oswin did,
>
> Joaquim Duran
>
>
> 2012/9/23 Gunter Winkler <guwi17_at_[hidden] <mailto:guwi17_at_[hidden]>>
>
> Hello,
>
> Am Saturday 22 September 2012 schrieb Oswin Krause:
> > Hi,
> >
> > Here is my slightly adapted version of the range. I
> didn't find the
> > boost coding guidelines so i just tried to fit it to
> other ublas
> > headers(with limited success). Since i am not breathing
> standardese,
> > I am not sure whether i am 100% correct in every aspect.
> >
> > Out of standard reasons, the implementation using proxy
> objects like
> > matrix_row does not lead to a random_access_iterator
> even though it
> > meets all traversal requirements. So algorithms like
> > random_shuffle(and sort(?)) will work in practice but
> overeager
> > compilers as for example MSVC will complain in debug mode. A
> > solution to this is lying about the iterator category,
> but since i
> > am a honest person, i don't ;)
> >
> > the implementation comes with a short test case, but i
> can also add a
> > bit more if required.
>
> see https://svn.boost.org/trac/boost/ticket/7411
>
> @Joaquim: does this solve your problem?
>
> mfg
> Gunter
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden] <mailto:ublas_at_[hidden]>
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: jduran.gm_at_[hidden] <mailto:jduran.gm_at_[hidden]>
>
>
>
> _______________________________________________ ublas mailing
> list ublas_at_[hidden] <mailto:ublas_at_[hidden]>
> http://lists.boost.org/mailman/listinfo.cgi/ublas Sent to:
> nasos_i_at_[hidden] <mailto:nasos_i_at_[hidden]>
>
> _______________________________________________ ublas mailing
> list ublas_at_[hidden] <mailto:ublas_at_[hidden]>
> http://lists.boost.org/mailman/listinfo.cgi/ublas Sent to:
> nasos_i_at_[hidden] <mailto:nasos_i_at_[hidden]>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden] <mailto:ublas_at_[hidden]>
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: jduran.gm_at_[hidden] <mailto:jduran.gm_at_[hidden]>
>
>
>
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: athanasios.iliopoulos.ctr.gr_at_[hidden]