Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60215 - trunk/libs/numeric/ublas/test
From: guwi17_at_[hidden]
Date: 2010-03-05 17:22:43


Author: guwi17
Date: 2010-03-05 17:22:42 EST (Fri, 05 Mar 2010)
New Revision: 60215
URL: http://svn.boost.org/trac/boost/changeset/60215

Log:
see #3968 : add missing file in yesterdays commit

test/test_coordinate_matrix_sort.cpp: test case for problem related to #3968

note to myself: do not commit after midnight!

Added:
   trunk/libs/numeric/ublas/test/test_coordinate_matrix_sort.cpp (contents, props changed)

Added: trunk/libs/numeric/ublas/test/test_coordinate_matrix_sort.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/ublas/test/test_coordinate_matrix_sort.cpp 2010-03-05 17:22:42 EST (Fri, 05 Mar 2010)
@@ -0,0 +1,65 @@
+#define BOOST_UBLAS_NO_ELEMENT_PROXIES
+
+#include<boost/numeric/ublas/matrix_sparse.hpp>
+#include<boost/numeric/ublas/io.hpp>
+
+#include "libs/numeric/ublas/test/utils.hpp"
+
+using std::cout;
+using std::endl;
+
+BOOST_UBLAS_TEST_DEF( test_coordinate_matrix_sort )
+{
+
+ boost::numeric::ublas::coordinate_matrix<double> matrix_mask(3, 3, 2);
+ cout << "Setting matrix(1,1) = 2.1" << endl;
+ matrix_mask(1,1) = 2.1;
+
+ cout << "Displaying matrix(1,1)" << endl;
+ std::cout << matrix_mask(1,1) << std::endl;
+
+ BOOST_UBLAS_DEBUG_TRACE( "Displaying matrix(1,1)" << matrix_mask(1,1) );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask(1,1) == 2.1 );
+
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index1_data()[0] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index2_data()[0] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.value_data()[0] == 2.1 );
+
+ BOOST_UBLAS_DEBUG_TRACE( "Setting matrix(0,1) = 1.1" );
+ matrix_mask(0, 1) = 1.1;
+
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index1_data()[0] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index2_data()[0] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.value_data()[0] == 2.1 );
+
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index1_data()[1] == 0 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index2_data()[1] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.value_data()[1] == 1.1 );
+
+ BOOST_UBLAS_DEBUG_TRACE( "Sort the matrix - this would be triggered by any element lookup." );
+ matrix_mask.sort();
+
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index1_data()[1] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index2_data()[1] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.value_data()[1] == 2.1 );
+
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index1_data()[0] == 0 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.index2_data()[0] == 1 );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask.value_data()[0] == 1.1 );
+
+ BOOST_UBLAS_DEBUG_TRACE( "Displaying matrix(1,1)" << matrix_mask(1,1) );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask(1,1) == 2.1 );
+
+ BOOST_UBLAS_DEBUG_TRACE( "Displaying matrix(0,1)" << matrix_mask(0,1) );
+ BOOST_UBLAS_TEST_CHECK( matrix_mask(1,1) == 1.1 );
+
+}
+
+int main()
+{
+ BOOST_UBLAS_TEST_BEGIN();
+
+ BOOST_UBLAS_TEST_DO( test_coordinate_matrix_sort );
+
+ BOOST_UBLAS_TEST_END();
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk