$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
From: Chen Jiusheng (atitos_at_[hidden])
Date: 2005-11-10 09:09:45
Hi
        
     I writed a small piece of codes here
/////////////////////////////////////////////////////////////////
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/storage.hpp>	//range
#include <boost/numeric/ublas/matrix_sparse.hpp> //sparse matrix
int main () {
    using namespace boost::numeric::ublas;
    coordinate_matrix<double> m (3, 3);  //matrix<double> works well
    for (unsigned i = 0; i < m.size1 (); ++ i)
        for (unsigned j = 0; j < m.size2 (); ++ j)
            m (i, j) = 3 * i + j;
        std::cout<< m << std::endl;
        m.resize(4, 3);     //root of evil
        std::cout<< m << std::endl;
}
these codes generate a runtime error, here is the error message:
[3,3]((0,1,2),(3,4,5),(6,7,8))
Assertion failed in file D:\Work\Algos\Boost\boost_1_33_0\boost/numeric/ublas/m
trix_sparse.hpp at line 4002:
!preserve
δ´¦ÀíµÄÒì³££º System.Runtime.InteropServices.SEHException: Íⲿ×é¼þ·¢ÉúÒì³£¡£
   at _CxxThrowException(Void* , _s__ThrowInfo* )
   at boost.numeric.ublas.internal_logic.raise(internal_logic* ) in d:\work\alg
s\boost\boost_1_33_0\boost\numeric\ublas\exception.hpp:line 62
   at boost.numeric.ublas.coordinate_matrix<double,boost::numeric::ublas::basic
row_major<unsigned int,int>,0,boost::numeric::ublas::unbounded_array<unsigned i
t,std::allocator<unsigned int> >,boost::numeric::ublas::unbounded_array<double,
td::allocator<double> > >.resize(coordinate_matrix<double,boost::numeric::ublas
:basic_row_major<unsigned int,int>,0,boost::numeric::ublas::unbounded_array<uns
gned int,std::allocator<unsigned int> >,boost::numeric::ublas::unbounded_array<
ouble,std::allocator<double> > >* , UInt32 size1, UInt32 size2, Boolean preserv
) in d:\work\algos\boost\boost_1_33_0\boost\numeric\ublas\matrix_sparse.hpp:lin
 4002
   at main() in d:\work\mfa\codes\libcleml_1.0.1\mfa_tests\test1.cpp:line 27
 Press any key to continue
after i have changed 'coordinate_matrix' to 'matrix', these errors disappeared, so i think there is a bug
in the method 'resize' of coordinate_matrix. 
        
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Best regards£¡
                                 
Chen Jiusheng
Department of Computer Science and Technology,
University of Science and Technology of China,
HeFei, China