]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/numeric/ublas/test/test_banded_storage_layout.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / numeric / ublas / test / test_banded_storage_layout.cpp
index 6b4e68a7ad86c3f9fad338e5f99cba082c1b00b2..d5c640b93202abb392e4d38f6f9fe78cdecde23a 100644 (file)
@@ -9,7 +9,7 @@
 
 using namespace boost::numeric::ublas;
 
-int expected_index( int index, column_major ) {
+int expected_index( size_t index, column_major ) {
    // this is the data shown on http://www.netlib.org/lapack/lug/node124.html
    // read column-by-column, aka column_major
    int mapping[] = { 0, 11, 21, 31, 12, 22, 32, 42, 23, 33, 43, 53, 34, 44, 54, 0, 45, 55, 0, 0 };
@@ -17,32 +17,32 @@ int expected_index( int index, column_major ) {
 }
 
 
-int expected_index( int index, row_major ) {
+int expected_index( size_t index, row_major ) {
    // this is the data shown on http://www.netlib.org/lapack/lug/node124.html
    // read row-by-row, aka row_major
    int mapping[] = { 0, 0, 11, 12, 0, 21, 22, 23, 31, 32, 33, 34, 42, 43, 44, 45, 53, 54, 55, 0 };
    return mapping[ index ];
 }
 
-int expected_index_6_by_5( int index, column_major ) {
+int expected_index_6_by_5( size_t index, column_major ) {
    // read column-by-column, aka column_major
    int mapping[] = { 0, 11, 21, 31, 12, 22, 32, 42, 23, 33, 43, 53, 34, 44, 54, 64, 45, 55, 65, 0 };
    return mapping[ index ];
 }
 
-int expected_index_6_by_5( int index, row_major ) {
+int expected_index_6_by_5( size_t index, row_major ) {
    // read row-by-row, aka row_major
    int mapping[] = { 0, 0, 11, 12, 0, 21, 22, 23, 31, 32, 33, 34, 42, 43, 44, 45, 53, 54, 55, 0, 64, 65, 0, 0 };
    return mapping[ index ];
 }
 
-int expected_index_5_by_6( int index, column_major ) {
+int expected_index_5_by_6( size_t index, column_major ) {
    // read column-by-column, aka column_major
    int mapping[] = { 0, 11, 21, 31, 12, 22, 32, 42, 23, 33, 43, 53, 34, 44, 54, 0, 45, 55, 0, 0, 56, 0, 0, 0 };
    return mapping[ index ];
 }
 
-int expected_index_5_by_6( int index, row_major ) {
+int expected_index_5_by_6( size_t index, row_major ) {
    // read row-by-row, aka row_major
    int mapping[] = { 0, 0, 11, 12, 0, 21, 22, 23, 31, 32, 33, 34, 42, 43, 44, 45, 53, 54, 55, 56};
    return mapping[ index ];
@@ -58,7 +58,7 @@ bool test_band_storage() {
     
     banded_matrix< int, Orientation > test_matrix( m, n, kl, ku );
     test_matrix.clear();
-    int band_storage_size = test_matrix.data().size();
+    size_t band_storage_size = test_matrix.data().size();
     
     test_matrix( 0, 0 ) = 11;
     test_matrix( 0, 1 ) = 12;
@@ -81,20 +81,20 @@ bool test_band_storage() {
     BOOST_UBLAS_TEST_TRACE( std::setw( 3 ) << test_matrix );
     
     BOOST_UBLAS_TEST_TRACE( "data() of matrix" );
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
         std::cerr << test_matrix.data()[ i ] << " ";
     }
     std::cerr << std::endl;
    
     BOOST_UBLAS_TEST_TRACE( "Expected data() of matrix" );
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
         std::cerr << expected_index( i, Orientation() ) << " ";
     }
     std::cerr << std::endl;
     
     size_t mismatch = 0;
 
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
       if ( test_matrix.data()[ i ] != expected_index( i, Orientation() ) ) {
         ++mismatch;
       }
@@ -114,7 +114,7 @@ bool test_band_storage_6_by_5() {
 
     banded_matrix< int, Orientation > test_matrix( m, n, kl, ku );
     test_matrix.clear();
-    int band_storage_size = test_matrix.data().size();
+    size_t band_storage_size = test_matrix.data().size();
 
     test_matrix( 0, 0 ) = 11;
     test_matrix( 0, 1 ) = 12;
@@ -139,20 +139,20 @@ bool test_band_storage_6_by_5() {
     BOOST_UBLAS_TEST_TRACE( std::setw( 3 ) << test_matrix );
 
     BOOST_UBLAS_TEST_TRACE( "data() of matrix" );
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
         std::cerr << test_matrix.data()[ i ] << " ";
     }
     std::cerr << std::endl;
 
     BOOST_UBLAS_TEST_TRACE( "Expected data() of matrix" );
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
         std::cerr << expected_index_6_by_5( i, Orientation() ) << " ";
     }
     std::cerr << std::endl;
 
     size_t mismatch = 0;
 
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
       if ( test_matrix.data()[ i ] != expected_index_6_by_5( i, Orientation() ) ) {
         ++mismatch;
       }
@@ -171,7 +171,7 @@ bool test_band_storage_5_by_6() {
 
     banded_matrix< int, Orientation > test_matrix( m, n, kl, ku );
     test_matrix.clear();
-    int band_storage_size = test_matrix.data().size();
+    size_t band_storage_size = test_matrix.data().size();
 
     test_matrix( 0, 0 ) = 11;
     test_matrix( 0, 1 ) = 12;
@@ -195,20 +195,20 @@ bool test_band_storage_5_by_6() {
     BOOST_UBLAS_TEST_TRACE( std::setw( 3 ) << test_matrix );
 
     BOOST_UBLAS_TEST_TRACE( "data() of matrix" );
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
         std::cerr << test_matrix.data()[ i ] << " ";
     }
     std::cerr << std::endl;
 
     BOOST_UBLAS_TEST_TRACE( "Expected data() of matrix" );
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
         std::cerr << expected_index_5_by_6( i, Orientation() ) << " ";
     }
     std::cerr << std::endl;
 
     size_t mismatch = 0;
 
-    for ( int i = 0; i < band_storage_size; ++i ) {
+    for ( size_t i = 0; i < band_storage_size; ++i ) {
       if ( test_matrix.data()[ i ] != expected_index_5_by_6( i, Orientation() ) ) {
         ++mismatch;
       }
@@ -283,9 +283,5 @@ int main()
 
     BOOST_UBLAS_TEST_DO( banded_matrix_row_major_5_by_6 );
 
-       BOOST_UBLAS_TEST_END();
-
-    return EXIT_SUCCESS;
+    BOOST_UBLAS_TEST_END();
 }
-
-