ublas/test/test_assignment.cpp
2015-11-06 01:30:01 +01:00

791 lines
30 KiB
C++

//
// Copyright (c) 2010 Athanasios Iliopoulos
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/numeric/ublas/assignment.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/vector_sparse.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/timer.hpp>
#include <ctime>
#include "common/testhelper.hpp"
#include "utils.hpp"
using namespace boost::numeric::ublas;
template <class V>
bool test_vector() {
bool pass = true;
V a(3), ra(3);
a <<= 1, 2, 3;
ra(0) = typename V::value_type(1); ra(1) = typename V::value_type(2); ra(2) = typename V::value_type(3);
pass &= compare_distance(a, ra);
V b(7), rb(7);
b<<= a, 10, a;
rb(0) = typename V::value_type(1); rb(1) = typename V::value_type(2); rb(2) = typename V::value_type(3);
rb(3) = typename V::value_type(10); rb(4) = typename V::value_type(1); rb(5) = typename V::value_type(2); rb(6) = typename V::value_type(3);
pass &= compare_distance(b, rb);
{
V c(6), rc(6);
c <<= 1, move(2), 3 ,4, 5, move(-5), 10, 10;
rc(0) = typename V::value_type(1); rc(1) = typename V::value_type(10); rc(2) = typename V::value_type(10);
rc(3) = typename V::value_type(3); rc(4) = typename V::value_type(4); rc(5) = typename V::value_type(5);
pass &= compare_distance(c, rc);
V d(6), rd(6);
d <<= 1, move_to(3), 3 ,4, 5, move_to(1), 10, 10;
rd(0) = typename V::value_type(1); rd(1) = typename V::value_type(10); rd(2) = typename V::value_type(10);
rd(3) = typename V::value_type(3); rd(4) = typename V::value_type(4); rd(5) = typename V::value_type(5);
pass &= compare_distance(d, rd);
}
{
V c(6), rc(6);
c <<= 1, move<2>(), 3 ,4, 5, move<-5>(), 10, 10;
rc(0) = typename V::value_type(1); rc(1) = typename V::value_type(10); rc(2) = typename V::value_type(10);
rc(3) = typename V::value_type(3); rc(4) = typename V::value_type(4); rc(5) = typename V::value_type(5);
pass &= compare_distance(c, rc);
V d(6), rd(6);
d <<= 1, move_to<3>(), 3 ,4, 5, move_to<1>(), 10, 10;
rd(0) = typename V::value_type(1); rd(1) = typename V::value_type(10); rd(2) = typename V::value_type(10);
rd(3) = typename V::value_type(3); rd(4) = typename V::value_type(4); rd(5) = typename V::value_type(5);
pass &= compare_distance(d, rd);
}
{
V f(6), rf(6);
f <<= 5, 5, 5, 5, 5, 5;
V fa(3); fa<<= 1, 2, 3;
f <<= fill_policy::index_plus_assign(), fa;
rf <<= 6,7,8, 5, 5, 5;
pass &= compare_distance(f, rf);
}
{
V f(6), rf(6);
f <<= 5, 5, 5, 5, 5, 5;
V fa(3); fa<<= 1, 2, 3;
f <<= fill_policy::index_minus_assign(), fa;
rf <<= 4,3,2, 5, 5, 5;
pass &= compare_distance(f, rf);
}
return pass;
}
template <class V>
bool test_vector_sparse_push_back() {
bool pass = true;
V a(3), ra(3);
a <<= fill_policy::sparse_push_back(), 1, 2, 3;
ra(0) = typename V::value_type(1); ra(1) = typename V::value_type(2); ra(2) = typename V::value_type(3);
pass &= compare_distance(a, ra);
V b(7), rb(7);
b<<= fill_policy::sparse_push_back(), a, 10, a;
rb(0) = typename V::value_type(1); rb(1) = typename V::value_type(2); rb(2) = typename V::value_type(3);
rb(3) = typename V::value_type(10), rb(4)= typename V::value_type(1); rb(5) = typename V::value_type(2); rb(6) = typename V::value_type(3);
pass &= compare_distance(b, rb);
V c(6), rc(6);
c <<= fill_policy::sparse_push_back(), 1, move(2), 3 ,4, 5; // Move back (i.e. negative is dangerous for push_back)
rc(0) = typename V::value_type(1); rc(1) = typename V::value_type(0); rc(2) = typename V::value_type(0);
rc(3) = typename V::value_type(3); rc(4) = typename V::value_type(4); rc(5) = typename V::value_type(5);
pass &= compare_distance(c, rc);
V d(6), rd(6);
d <<= fill_policy::sparse_push_back(), 1, move_to(3), 3 ,4, 5; // Move back (i.e. before current index is dangerous for push_back)
rd(0) = typename V::value_type(1); rd(1) = typename V::value_type(0); rd(2) = typename V::value_type(0);
rd(3) = typename V::value_type(3); rd(4) = typename V::value_type(4); rd(5) = typename V::value_type(5);
pass &= compare_distance(d, rd);
V e(6), re(6);
e <<= fill_policy::sparse_push_back(), 1, move_to(3), 3 ,4, 5, fill_policy::sparse_insert(), move_to(1), 10, 10; // If you want to move back, use this
re(0) = typename V::value_type(1); re(1) = typename V::value_type(10); re(2) = typename V::value_type(10);
re(3) = typename V::value_type(3); re(4) = typename V::value_type(4); re(5) = typename V::value_type(5);
pass &= compare_distance(e, re);
return pass;
}
template <class V>
bool test_vector_sparse_insert() {
bool pass = true;
V a(3), ra(3);
a <<= fill_policy::sparse_insert(), 1, 2, 3;
ra(0) = typename V::value_type(1); ra(1) = typename V::value_type(2); ra(2) = typename V::value_type(3);
pass &= compare_distance(a, ra);
V b(7), rb(7);
b<<= fill_policy::sparse_insert(), a, 10, a;
rb(0) = typename V::value_type(1); rb(1) = typename V::value_type(2); rb(2) = typename V::value_type(3);
rb(3) = typename V::value_type(10), rb(4) = typename V::value_type(1); rb(5)= typename V::value_type(2); rb(6) = typename V::value_type(3);
pass &= compare_distance(b, rb);
V c(6), rc(6);
c <<= fill_policy::sparse_insert(), 1, move(2), 3 ,4, 5, move(-5), 10, 10; // Move back (i.e. negative is dangerous for sparse)
rc(0) = typename V::value_type(1); rc(1) = typename V::value_type(10); rc(2) = typename V::value_type(10);
rc(3) = typename V::value_type(3); rc(4) = typename V::value_type(4); rc(5) = typename V::value_type(5);
pass &= compare_distance(c, rc);
V d(6), rd(6);
d <<= fill_policy::sparse_insert(), 1, move_to(3), 3 ,4, 5, move_to(1), 10, 10; // Move back (i.e.before is dangerous for sparse)
rd(0) = typename V::value_type(1); rd(1) = typename V::value_type(10); rd(2) = typename V::value_type(10);
rd(3) = typename V::value_type(3); rd(4) = typename V::value_type(4); rd(5) = typename V::value_type(5);
pass &= compare_distance(d, rd);
return pass;
}
template <class V>
bool test_matrix() {
bool pass = true;
V A(3,3), RA(3,3);
A <<= 1, 2, 3, 4, 5, 6, 7, 8, 9;
RA(0,0)= typename V::value_type(1); RA(0,1)=typename V::value_type(2); RA(0,2)=typename V::value_type(3);
RA(1,0)= typename V::value_type(4); RA(1,1)=typename V::value_type(5); RA(1,2)=typename V::value_type(6);
RA(2,0)= typename V::value_type(7); RA(2,1)=typename V::value_type(8); RA(2,2)=typename V::value_type(9);
pass &= compare_distance(A, RA);
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(3);
b<<= 4,5,6;
B<<= 1, 2, 3, b, 7, project(b, range(1,3));
RB<<=1, 2, 3, 4, 5, 6, 7, 5, 6; // If the first worked we can now probably use it.
pass &= compare_distance(B, RB);
}
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(3);
b<<= 4,5,6;
B<<= move(1,0), b, move_to(0,0), 1, 2, 3, move(1,0), 7, project(b, range(1,3));
RB<<=1, 2, 3, 4, 5, 6, 7, 5, 6;
pass &= compare_distance(B, RB);
}
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(9);
b<<= 1, 2, 3, 4, 5, 6, 7, 8, 9;
B<<=b;
RB<<=1, 2, 3, 4, 5, 6, 7, 8, 9;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3,
4, 5;
B<<= C,C,
C,C;
RB <<= 2,3,2,3,
4,5,4,5,
2,3,2,3,
4,5,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3, 4, 5;
B<<= C, zero_matrix<typename V::value_type>(2,2),
zero_matrix<typename V::value_type>(2,2), C;
RB<<= 2,3,0,0,
4,5,0,0,
0,0,2,3,
0,0,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3, 4, 5;
B<<= C, zero_matrix<typename V::value_type>(2,2),
zero_matrix<typename V::value_type>(2,2), C;
RB<<= 2,3,0,0,
4,5,0,0,
0,0,2,3,
0,0,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4); // We need that because of the non-zero instatiation of dense types.
V C(2,2);
C <<= 2, 3, 4, 5;
B<<= move(1,1), C;
RB<<= 0,0,0,0,
0,2,3,0,
0,4,5,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<= move_to(0,1), 2, 3, next_row(), 1, 2, next_row(), 4, 5;
RB<<= 0,2,3,0,
1,2,0,0,
4,5,0,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=traverse_policy::by_column(), move_to(0,1), 2, 3, 6, next_column(), 4, 5;
RB<<= 0,2,4,0,
0,3,5,0,
0,6,0,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=traverse_policy::by_column(), move_to(0,1), 2, 3, next_row(), traverse_policy::by_row(), 4, 5;
RB<<= 0,2,0,0,
0,3,0,0,
0,0,0,0,
4,5,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=traverse_policy::by_column(), move_to(0,1), 2, 3, begin2(), traverse_policy::by_row(), 4, 5, 6, 7, 8;
RB<<= 0,2,0,0,
0,3,0,0,
4,5,6,7,
8,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=traverse_policy::by_column(), move_to(0,1), 2, 3, begin2(), traverse_policy::by_row(), 4, 5, 6, 7, 8,9, begin1(), 1, 2;
RB<<= 0,2,1,2,
0,3,0,0,
4,5,6,7,
8,9,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = scalar_matrix<typename V::value_type>(4,4,1);
V C(2,2);
C <<= 1, 2, 3, 4;
B<<= fill_policy::index_plus_assign(), move(1,1), C;
RB<<= 1,1,1,1,
1,2,3,1,
1,4,5,1,
1,1,1,1;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = scalar_matrix<typename V::value_type>(4,4,5);
V C(2,2);
C <<= 1, 2, 3, 4;
B<<= fill_policy::index_minus_assign(), move(1,1), C;
RB<<= 5,5,5,5,
5,4,3,5,
5,2,1,5,
5,5,5,5;
pass &= compare_distance(B, RB);
}
return pass;
}
template <class V>
bool test_matrix_sparse_push_back() {
bool pass = true;
V A(3,3), RA(3,3);
A <<= fill_policy::sparse_push_back(), 1, 2, 3, 4, 5, 6, 7, 8, 9;
RA(0,0)= typename V::value_type(1); RA(0,1)= typename V::value_type(2); RA(0,2)= typename V::value_type(3);
RA(1,0)= typename V::value_type(4); RA(1,1)= typename V::value_type(5); RA(1,2)= typename V::value_type(6);
RA(2,0)= typename V::value_type(7); RA(2,1)= typename V::value_type(8); RA(2,2)= typename V::value_type(9);
pass &= compare_distance(A, RA);
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(3);
b<<= 4,5,6;
B<<=fill_policy::sparse_push_back(), 1, 2, 3, b, 7, project(b, range(1,3));
RB<<= 1, 2, 3, 4, 5, 6, 7, 5, 6; // If the first worked we can now probably use it.
pass &= compare_distance(B, RB);
}
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(3);
b<<= 4,5,6;
B<<=fill_policy::sparse_push_back(), move(1,0), b, fill_policy::sparse_insert(), move_to(0,0), 1, 2, 3, move(1,0), 7, project(b, range(1,3));
RB<<=1, 2, 3, 4, 5, 6, 7, 5, 6;
pass &= compare_distance(B, RB);
}
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(9);
b<<= 1, 2, 3, 4, 5, 6, 7, 8, 9;
B<<=b;
RB<<=1, 2, 3, 4, 5, 6, 7, 8, 9;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3,
4, 5;
// It might get complicated for sparse push_back, this must go into the tutorial. (This way is not convient nor fast)
B<<=fill_policy::sparse_push_back(), C, move_to(2,2), C, fill_policy::sparse_insert(), move_to(0,2), C, C;
RB <<= 2,3,2,3,
4,5,4,5,
2,3,2,3,
4,5,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3, 4, 5;
B<<=fill_policy::sparse_push_back(), C, move_to(2,2), C;
RB<<= 2,3,0,0,
4,5,0,0,
0,0,2,3,
0,0,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3, 4, 5;
B<<=fill_policy::sparse_push_back(), move(1,1), C;
RB<<= 0,0,0,0,
0,2,3,0,
0,4,5,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_push_back(), move_to(0,1), 2, 3, next_row(), 1, 2, next_row(), 4, 5;
RB<<= 0,2,3,0,
1,2,0,0,
4,5,0,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
// The next will not work with sparse push_back because elements that are prior to the ones already in are attempted to be added
/*
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_push_back(),traverse_policy::by_column(), move_to(0,1), 2, 3, 6, next_column(), 4, 5;
RB<<= 0,2,4,0,
0,3,5,0,
0,6,0,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
*/
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_push_back(),traverse_policy::by_column(), move_to(0,1), 2, 3, next_row(), traverse_policy::by_row(), 4, 5;
RB<<= 0,2,0,0,
0,3,0,0,
0,0,0,0,
4,5,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_push_back(),traverse_policy::by_column(), move_to(0,1), 2, 3, begin2(), traverse_policy::by_row(), 4, 5, 6, 7, 8;
RB<<= 0,2,0,0,
0,3,0,0,
4,5,6,7,
8,0,0,0;
pass &= compare_distance(B, RB);
}
// The next will not work with sparse push_back because elements that are prior to the ones already in are attempted to be added
/*
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_push_back(),traverse_policy::by_column(), move_to(0,1), 2, 3, begin2(), traverse_policy::by_row(), 4, 5, 6, 7, 8,9, begin1(), 1, 2;
RB<<= 0,2,1,2,
0,3,0,0,
4,5,6,7,
8,9,0,0;
pass &= compare_distance(B, RB);
}
*/
return pass;
}
template <class V>
bool test_matrix_sparse_insert() {
bool pass = true;
V A(3,3), RA(3,3);
A <<= fill_policy::sparse_insert(), 1, 2, 3, 4, 5, 6, 7, 8, 9;
RA(0,0)= typename V::value_type(1); RA(0,1)= typename V::value_type(2); RA(0,2)= typename V::value_type(3);
RA(1,0)= typename V::value_type(4); RA(1,1)= typename V::value_type(5); RA(1,2)= typename V::value_type(6);
RA(2,0)= typename V::value_type(7); RA(2,1)= typename V::value_type(8); RA(2,2)= typename V::value_type(9);
pass &= compare_distance(A, RA);
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(3);
b<<= 4,5,6;
B<<=fill_policy::sparse_insert(), 1, 2, 3, b, 7, project(b, range(1,3));
RB<<=1, 2, 3, 4, 5, 6, 7, 5, 6; // If the first worked we can now probably use it.
pass &= compare_distance(B, RB);
}
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(3);
b<<= 4,5,6;
B<<=fill_policy::sparse_insert(), move(1,0), b, fill_policy::sparse_insert(), move_to(0,0), 1, 2, 3, move(1,0), 7, project(b, range(1,3));
RB<<=1, 2, 3, 4, 5, 6, 7, 5, 6;
pass &= compare_distance(B, RB);
}
{
V B(3,3), RB(3,3);
vector<typename V::value_type> b(9);
b<<= 1, 2, 3, 4, 5, 6, 7, 8, 9;
B<<=b;
RB<<=1, 2, 3, 4, 5, 6, 7, 8, 9;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3,
4, 5;
B<<=fill_policy::sparse_insert(), C, C, C, C;
RB <<= 2,3,2,3,
4,5,4,5,
2,3,2,3,
4,5,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3, 4, 5;
B<<=fill_policy::sparse_insert(), C, move_to(2,2), C;
RB<<= 2,3,0,0,
4,5,0,0,
0,0,2,3,
0,0,4,5;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
V C(2,2);
C <<= 2, 3, 4, 5;
B<<=fill_policy::sparse_insert(), move(1,1), C;
RB<<= 0,0,0,0,
0,2,3,0,
0,4,5,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_insert(), move_to(0,1), 2, 3, next_row(), 1, 2, next_row(), 4, 5;
RB<<= 0,2,3,0,
1,2,0,0,
4,5,0,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_insert(),traverse_policy::by_column(), move_to(0,1), 2, 3, 6, next_column(), 4, 5;
RB<<= 0,2,4,0,
0,3,5,0,
0,6,0,0,
0,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_insert(),traverse_policy::by_column(), move_to(0,1), 2, 3, next_row(), traverse_policy::by_row(), 4, 5;
RB<<= 0,2,0,0,
0,3,0,0,
0,0,0,0,
4,5,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_insert(),traverse_policy::by_column(), move_to(0,1), 2, 3, begin2(), traverse_policy::by_row(), 4, 5, 6, 7, 8;
RB<<= 0,2,0,0,
0,3,0,0,
4,5,6,7,
8,0,0,0;
pass &= compare_distance(B, RB);
}
{
V B(4,4), RB(4,4);
B = zero_matrix<typename V::value_type>(4,4);
B<<=fill_policy::sparse_insert(),traverse_policy::by_column(), move_to(0,1), 2, 3, begin2(), traverse_policy::by_row(), 4, 5, 6, 7, 8,9, begin1(), 1, 2;
RB<<= 0,2,1,2,
0,3,0,0,
4,5,6,7,
8,9,0,0;
pass &= compare_distance(B, RB);
}
return pass;
}
BOOST_UBLAS_TEST_DEF (test_vector) {
BOOST_UBLAS_DEBUG_TRACE( "Starting operator \"<<= \" vector assignment tests" );
BOOST_UBLAS_TEST_CHECK(test_vector<vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector<vector<char> >());
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<double,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<float,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<long,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<unsigned long,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<int,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<unsigned int,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<std::size_t,7> >()));
BOOST_UBLAS_TEST_CHECK((test_vector<bounded_vector<char,7> >()));
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<unsigned int> >())
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<std::size_t> >())
BOOST_UBLAS_TEST_CHECK(test_vector<mapped_vector<char> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector<compressed_vector<char> >());
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<long> >())
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<unsigned long> >())
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector<coordinate_vector<char> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<compressed_vector<char> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_push_back<coordinate_vector<char> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<compressed_vector<char> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<double> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<float> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_vector_sparse_insert<coordinate_vector<char> >());
}
BOOST_UBLAS_TEST_DEF (test_matrix) {
BOOST_UBLAS_DEBUG_TRACE( "Starting operator \"<<= \" matrix assignment tests" );
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<matrix<char> >());
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<double,7, 7> >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<float,7, 7> >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<long,7, 7> >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<unsigned long,7, 7> >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<int,7,7 > >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<unsigned int,7, 7> >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<char,7, 7> >()));
BOOST_UBLAS_TEST_CHECK((test_matrix<bounded_matrix<std::size_t,7, 7> >()));
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<unsigned int> >())
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<std::size_t> >())
BOOST_UBLAS_TEST_CHECK(test_matrix<mapped_matrix<char> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<compressed_matrix<char> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<long> >())
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<unsigned long> >())
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix<coordinate_matrix<char> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<compressed_matrix<char> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_push_back<coordinate_matrix<char> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<compressed_matrix<char> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<double> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<float> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<unsigned long> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<unsigned int> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<std::size_t> >());
BOOST_UBLAS_TEST_CHECK(test_matrix_sparse_insert<coordinate_matrix<char> >());
}
int main () {
BOOST_UBLAS_TEST_BEGIN();
BOOST_UBLAS_TEST_DO( test_vector );
BOOST_UBLAS_TEST_DO( test_matrix );
BOOST_UBLAS_TEST_END();
}