mirror of
https://github.com/boostorg/ublas.git
synced 2026-02-20 03:02:13 +00:00
Exceptions. No need to catch. We want test to halt for testing
on exception. [SVN r24752]
This commit is contained in:
@@ -31,8 +31,8 @@ struct test_my_vector {
|
||||
typedef typename ublas::type_traits<value_type>::real_type real_type;
|
||||
|
||||
template<class VP>
|
||||
void operator () (VP &v1, VP &v2, VP &v3) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, VP &v3) const {
|
||||
{
|
||||
value_type t;
|
||||
size_type i;
|
||||
real_type n;
|
||||
@@ -113,38 +113,26 @@ struct test_my_vector {
|
||||
t = ublas::inner_prod (v1, v2);
|
||||
std::cout << "inner_prod (v1, v2) = " << t << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N), v3 (N);
|
||||
(*this) (v1, v2, v3);
|
||||
test_with (v1, v2, v3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::vector_range<V> vr1 (v1, ublas::range (0, N)),
|
||||
vr2 (v2, ublas::range (0, N)),
|
||||
vr3 (v3, ublas::range (0, N));
|
||||
(*this) (vr1, vr2, vr3);
|
||||
test_with (vr1, vr2, vr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::vector_slice<V> vs1 (v1, ublas::slice (0, 1, N)),
|
||||
vs2 (v2, ublas::slice (0, 1, N)),
|
||||
vs3 (v3, ublas::slice (0, 1, N));
|
||||
(*this) (vs1, vs2, vs3);
|
||||
test_with (vs1, vs2, vs3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -248,4 +236,3 @@ void test_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ struct test_my_matrix_vector {
|
||||
typedef typename V::value_type value_type;
|
||||
|
||||
template<class VP, class MP>
|
||||
void operator () (VP &v1, VP &v2, MP &m1) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, MP &m1) const {
|
||||
{
|
||||
// Rows and columns
|
||||
initialize_matrix (m1);
|
||||
for (int i = 0; i < N; ++ i) {
|
||||
@@ -54,43 +54,31 @@ struct test_my_matrix_vector {
|
||||
v2 = ublas::prod (v1, m1);
|
||||
std::cout << "prod (v1, m1) = " << v2 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
(*this) (v1, v2, m1);
|
||||
test_with (v1, v2, m1);
|
||||
|
||||
ublas::matrix_row<M> mr1 (m1, 0), mr2 (m1, 1);
|
||||
(*this) (mr1, mr2, m1);
|
||||
test_with (mr1, mr2, m1);
|
||||
|
||||
ublas::matrix_column<M> mc1 (m1, 0), mc2 (m1, 1);
|
||||
(*this) (mc1, mc2, m1);
|
||||
test_with (mc1, mc2, m1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<M> mvr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (m1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, m1);
|
||||
test_with (mvr1, mvr2, m1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<M> mvs1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, m1);
|
||||
test_with (mvs1, mvs2, m1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ struct test_my_matrix {
|
||||
typedef typename M::value_type value_type;
|
||||
|
||||
template<class MP>
|
||||
void operator () (MP &m1, MP &m2, MP &m3) const {
|
||||
try {
|
||||
void test_with (MP &m1, MP &m2, MP &m3) const {
|
||||
{
|
||||
value_type t;
|
||||
|
||||
// Copy and swap
|
||||
@@ -105,38 +105,26 @@ struct test_my_matrix {
|
||||
m3 = ublas::prod (m1, m2);
|
||||
std::cout << "prod (m1, m2) = " << m3 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
(*this) (m1, m2, m3);
|
||||
test_with (m1, m2, m3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<M> mr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (m2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (m3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<M> ms1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (m2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (m3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -316,6 +304,3 @@ void test_matrix () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
template<class V, int N>
|
||||
void test_blas_1<V, N>::operator () () {
|
||||
try {
|
||||
{
|
||||
value_type t;
|
||||
real_type n;
|
||||
V v1 (N), v2 (N);
|
||||
@@ -88,12 +88,6 @@ void test_blas_1<V, N>::operator () () {
|
||||
ublas::blas_1::rot (value_type (1), v1, value_type (1), v2);
|
||||
std::cout << "rot (1, v1, 1, v2) = " << v1 << " " << v2 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_FLOAT
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
template<class V, class M, int N>
|
||||
void test_blas_2<V, M, N>::operator () () {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
M m (N, N);
|
||||
|
||||
@@ -140,12 +140,6 @@ void test_blas_2<V, M, N>::operator () () {
|
||||
std::cout << "hr2 (m, 1, v1, v2) = " << m << std::endl;
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_FLOAT
|
||||
@@ -165,4 +159,3 @@ template struct test_blas_2<ublas::vector<std::complex<float> >, ublas::matrix<s
|
||||
template struct test_blas_2<ublas::vector<std::complex<double> >, ublas::matrix<std::complex<double> >, 3>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
template<class M, int N>
|
||||
void test_blas_3<M, N>::operator () () {
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
|
||||
// _t_mm
|
||||
@@ -201,12 +201,6 @@ void test_blas_3<M, N>::operator () () {
|
||||
std::cout << "hr2k (m1, 1, 1, herm (m2), herm (m3)) = " << m1 << std::endl;
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_FLOAT
|
||||
|
||||
@@ -33,8 +33,8 @@ struct test_my_vector {
|
||||
typedef typename ublas::type_traits<value_type>::real_type real_type;
|
||||
|
||||
template<class VP>
|
||||
void operator () (VP &v1, VP &v2, VP &v3) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, VP &v3) const {
|
||||
{
|
||||
value_type t;
|
||||
size_type i;
|
||||
real_type n;
|
||||
@@ -115,38 +115,26 @@ struct test_my_vector {
|
||||
t = ublas::inner_prod (v1, v2);
|
||||
std::cout << "inner_prod (v1, v2) = " << t << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N, N), v2 (N, N), v3 (N, N);
|
||||
(*this) (v1, v2, v3);
|
||||
test_with (v1, v2, v3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::vector_range<V> vr1 (v1, ublas::range (0, N)),
|
||||
vr2 (v2, ublas::range (0, N)),
|
||||
vr3 (v3, ublas::range (0, N));
|
||||
(*this) (vr1, vr2, vr3);
|
||||
test_with (vr1, vr2, vr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::vector_slice<V> vs1 (v1, ublas::slice (0, 1, N)),
|
||||
vs2 (v2, ublas::slice (0, 1, N)),
|
||||
vs3 (v3, ublas::slice (0, 1, N));
|
||||
(*this) (vs1, vs2, vs3);
|
||||
test_with (vs1, vs2, vs3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -252,4 +240,3 @@ void test_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ struct test_my_matrix_vector {
|
||||
typedef typename V::value_type value_type;
|
||||
|
||||
template<class VP, class MP>
|
||||
void operator () (VP &v1, VP &v2, MP &m1) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, MP &m1) const {
|
||||
{
|
||||
// Rows and columns
|
||||
initialize_matrix (m1);
|
||||
for (int i = 0; i < N; ++ i) {
|
||||
@@ -57,44 +57,32 @@ struct test_my_matrix_vector {
|
||||
v2 = ublas::prod (v1, m1);
|
||||
std::cout << "prod (v1, m1) = " << v2 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N, N), v2 (N, N);
|
||||
M m1 (N, N, N * N);
|
||||
|
||||
(*this) (v1, v2, m1);
|
||||
test_with (v1, v2, m1);
|
||||
|
||||
ublas::matrix_row<M> mr1 (m1, 0), mr2 (m1, N - 1);
|
||||
(*this) (mr1, mr2, m1);
|
||||
test_with (mr1, mr2, m1);
|
||||
|
||||
ublas::matrix_column<M> mc1 (m1, 0), mc2 (m1, N - 1);
|
||||
(*this) (mc1, mc2, m1);
|
||||
test_with (mc1, mc2, m1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<M> mvr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (m1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, m1);
|
||||
test_with (mvr1, mvr2, m1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<M> mvs1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, m1);
|
||||
test_with (mvs1, mvs2, m1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -224,16 +212,16 @@ void test_matrix_vector () {
|
||||
std::cout << "float, map_array" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >,
|
||||
ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >,
|
||||
// ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >, ublas::map_array<std::size_t, ublas::sparse_vector<float, ublas::map_array<std::size_t, float> > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >,
|
||||
ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >, ublas::map_array<std::size_t, ublas::sparse_vector<float, ublas::map_array<std::size_t, float> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "double, map_array" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >,
|
||||
ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >,
|
||||
// ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >, ublas::map_array<std::size_t, ublas::sparse_vector<double, ublas::map_array<std::size_t, double> > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >,
|
||||
ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >, ublas::map_array<std::size_t, ublas::sparse_vector<double, ublas::map_array<std::size_t, double> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_STD_COMPLEX
|
||||
@@ -241,16 +229,16 @@ void test_matrix_vector () {
|
||||
std::cout << "std::complex<float>, map_array" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >,
|
||||
// ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "std::complex<double>, map_array" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >,
|
||||
// ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -260,16 +248,16 @@ void test_matrix_vector () {
|
||||
std::cout << "float, std::map" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >,
|
||||
ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::vector<ublas::sparse_vector<float, std::map<std::size_t, float> > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >,
|
||||
// ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >, std::map<std::size_t, ublas::sparse_vector<float, std::map<std::size_t, float> > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >,
|
||||
ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >, std::map<std::size_t, ublas::sparse_vector<float, std::map<std::size_t, float> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "double, std::map" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >,
|
||||
ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::vector<ublas::sparse_vector<double, std::map<std::size_t, double> > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >,
|
||||
// ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >, std::map<std::size_t, ublas::sparse_vector<double, std::map<std::size_t, double> > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >,
|
||||
ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >, std::map<std::size_t, ublas::sparse_vector<double, std::map<std::size_t, double> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_STD_COMPLEX
|
||||
@@ -277,16 +265,16 @@ void test_matrix_vector () {
|
||||
std::cout << "std::complex<float>, std::map" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >,
|
||||
// ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "std::complex<double>, std::map" << std::endl;
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > > > >, 3 > () ();
|
||||
// test_my_matrix_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >,
|
||||
// ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
test_my_matrix_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >,
|
||||
ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -348,4 +336,3 @@ void test_matrix_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ struct test_my_matrix {
|
||||
typedef typename M::value_type value_type;
|
||||
|
||||
template<class MP>
|
||||
void operator () (MP &m1, MP &m2, MP &m3) const {
|
||||
try {
|
||||
void test_with (MP &m1, MP &m2, MP &m3) const {
|
||||
{
|
||||
value_type t;
|
||||
|
||||
// Copy and swap
|
||||
@@ -107,38 +107,26 @@ struct test_my_matrix {
|
||||
m3 = ublas::prod (m1, m2);
|
||||
std::cout << "prod (m1, m2) = " << m3 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
M m1 (N, N, N * N), m2 (N, N, N * N), m3 (N, N, N * N);
|
||||
(*this) (m1, m2, m3);
|
||||
test_with (m1, m2, m3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<M> mr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (m2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (m3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<M> ms1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (m2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (m3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -251,26 +239,26 @@ void test_matrix () {
|
||||
#ifdef USE_FLOAT
|
||||
std::cout << "float, map_array" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >, ublas::map_array<std::size_t, ublas::sparse_vector<float, ublas::map_array<std::size_t, float> > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, ublas::map_array<std::size_t, float> >, ublas::map_array<std::size_t, ublas::sparse_vector<float, ublas::map_array<std::size_t, float> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "double, map_array" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >, ublas::map_array<std::size_t, ublas::sparse_vector<double, ublas::map_array<std::size_t, double> > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, ublas::map_array<std::size_t, double> >, ublas::map_array<std::size_t, ublas::sparse_vector<double, ublas::map_array<std::size_t, double> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_STD_COMPLEX
|
||||
#ifdef USE_FLOAT
|
||||
std::cout << "std::complex<float>, map_array" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<float>, ublas::map_array<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "std::complex<double>, map_array" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > >, ublas::map_array<std::size_t, ublas::sparse_vector<std::complex<double>, ublas::map_array<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -279,26 +267,26 @@ void test_matrix () {
|
||||
#ifdef USE_FLOAT
|
||||
std::cout << "float, std::map" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::vector<ublas::sparse_vector<float, std::map<std::size_t, float> > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >, std::map<std::size_t, ublas::sparse_vector<float, std::map<std::size_t, float> > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<float, std::map<std::size_t, float> >, std::map<std::size_t, ublas::sparse_vector<float, std::map<std::size_t, float> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "double, std::map" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::vector<ublas::sparse_vector<double, std::map<std::size_t, double> > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >, std::map<std::size_t, ublas::sparse_vector<double, std::map<std::size_t, double> > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<double, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<double, std::map<std::size_t, double> >, std::map<std::size_t, ublas::sparse_vector<double, std::map<std::size_t, double> > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_STD_COMPLEX
|
||||
#ifdef USE_FLOAT
|
||||
std::cout << "std::complex<float>, std::map" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<float>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<float>, std::map<std::size_t, std::complex<float> > > > > >, 3 > () ();
|
||||
#endif
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
std::cout << "std::complex<double>, std::map" << std::endl;
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > > > >, 3 > () ();
|
||||
// test_my_matrix<ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
test_my_matrix<ublas::generalized_vector_of_vector<std::complex<double>, ublas::row_major, ublas::sparse_vector<ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > >, std::map<std::size_t, ublas::sparse_vector<std::complex<double>, std::map<std::size_t, std::complex<double> > > > > >, 3 > () ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -352,5 +340,3 @@ void test_matrix () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ struct test_my_vector {
|
||||
typedef typename ublas::type_traits<value_type>::real_type real_type;
|
||||
|
||||
template<class VP>
|
||||
void operator () (VP &v1, VP &v2, VP &v3) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, VP &v3) const {
|
||||
{
|
||||
value_type t;
|
||||
size_type i;
|
||||
real_type n;
|
||||
@@ -113,38 +113,26 @@ struct test_my_vector {
|
||||
t = ublas::inner_prod (v1, v2);
|
||||
std::cout << "inner_prod (v1, v2) = " << t << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N), v3 (N);
|
||||
(*this) (v1, v2, v3);
|
||||
test_with (v1, v2, v3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::vector_range<V> vr1 (v1, ublas::range (0, N)),
|
||||
vr2 (v2, ublas::range (0, N)),
|
||||
vr3 (v3, ublas::range (0, N));
|
||||
(*this) (vr1, vr2, vr3);
|
||||
test_with (vr1, vr2, vr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::vector_slice<V> vs1 (v1, ublas::slice (0, 1, N)),
|
||||
vs2 (v2, ublas::slice (0, 1, N)),
|
||||
vs3 (v3, ublas::slice (0, 1, N));
|
||||
(*this) (vs1, vs2, vs3);
|
||||
test_with (vs1, vs2, vs3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -224,4 +212,3 @@ void test_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ struct test_my_matrix_vector {
|
||||
typedef typename V::value_type value_type;
|
||||
|
||||
template<class VP, class MP>
|
||||
void operator () (VP &v1, VP &v2, MP &m1) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, MP &m1) const {
|
||||
{
|
||||
#ifndef USE_DIAGONAL
|
||||
// Rows and columns
|
||||
initialize_matrix (m1);
|
||||
@@ -59,15 +59,9 @@ struct test_my_matrix_vector {
|
||||
std::cout << "prod (v1, m1) = " << v2 << std::endl;
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
#ifdef USE_BANDED
|
||||
M m1 (N, N, 1, 1);
|
||||
@@ -75,91 +69,80 @@ struct test_my_matrix_vector {
|
||||
#ifdef USE_DIAGONAL
|
||||
M m1 (N, N);
|
||||
#endif
|
||||
(*this) (v1, v2, m1);
|
||||
test_with (v1, v2, m1);
|
||||
|
||||
ublas::matrix_row<M> mr1 (m1, 1), mr2 (m1, 1);
|
||||
(*this) (mr1, mr2, m1);
|
||||
test_with (mr1, mr2, m1);
|
||||
|
||||
ublas::matrix_column<M> mc1 (m1, 1), mc2 (m1, 1);
|
||||
(*this) (mc1, mc2, m1);
|
||||
test_with (mc1, mc2, m1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<M> mvr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (m1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, m1);
|
||||
test_with (mvr1, mvr2, m1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<M> mvs1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, m1);
|
||||
test_with (mvs1, mvs2, m1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void operator () (int) const {
|
||||
#ifdef USE_ADAPTOR
|
||||
try {
|
||||
{
|
||||
#ifdef USE_BANDED
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N, 1, 1);
|
||||
ublas::banded_adaptor<M> bam1 (m1, 1, 1);
|
||||
(*this) (v1, v2, bam1);
|
||||
test_with (v1, v2, bam1);
|
||||
|
||||
ublas::matrix_row<ublas::banded_adaptor<M> > mr1 (bam1, 1), mr2 (bam1, 1);
|
||||
(*this) (mr1, mr2, bam1);
|
||||
test_with (mr1, mr2, bam1);
|
||||
|
||||
ublas::matrix_column<ublas::banded_adaptor<M> > mc1 (bam1, 1), mc2 (bam1, 1);
|
||||
(*this) (mc1, mc2, bam1);
|
||||
test_with (mc1, mc2, bam1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<ublas::banded_adaptor<M> > mvr1 (bam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (bam1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, bam1);
|
||||
test_with (mvr1, mvr2, bam1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<ublas::banded_adaptor<M> > mvs1 (bam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (bam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, bam1);
|
||||
test_with (mvs1, mvs2, bam1);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_DIAGONAL
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
ublas::diagonal_adaptor<M> dam1 (m1);
|
||||
(*this) (v1, v2, dam1);
|
||||
test_with (v1, v2, dam1);
|
||||
|
||||
ublas::matrix_row<ublas::diagonal_adaptor<M> > mr1 (dam1, 1), mr2 (dam1, 1);
|
||||
(*this) (mr1, mr2, dam1);
|
||||
test_with (mr1, mr2, dam1);
|
||||
|
||||
ublas::matrix_column<ublas::diagonal_adaptor<M> > mc1 (dam1, 1), mc2 (dam1, 1);
|
||||
(*this) (mc1, mc2, dam1);
|
||||
test_with (mc1, mc2, dam1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<ublas::diagonal_adaptor<M> > mvr1 (dam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (dam1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, dam1);
|
||||
test_with (mvr1, mvr2, dam1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<ublas::diagonal_adaptor<M> > mvs1 (dam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (dam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, dam1);
|
||||
test_with (mvs1, mvs2, dam1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -388,4 +371,3 @@ void test_matrix_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ struct test_my_matrix {
|
||||
typedef typename M::value_type value_type;
|
||||
|
||||
template<class MP>
|
||||
void operator () (MP &m1, MP &m2, MP &m3) const {
|
||||
try {
|
||||
void test_with (MP &m1, MP &m2, MP &m3) const {
|
||||
{
|
||||
value_type t;
|
||||
|
||||
// Copy and swap
|
||||
@@ -104,92 +104,74 @@ struct test_my_matrix {
|
||||
// Banded times banded isn't banded
|
||||
std::cout << "prod (m1, m2) = " << ublas::prod (m1, m2) << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
#ifdef USE_BANDED
|
||||
M m1 (N, N, 1, 1), m2 (N, N, 1, 1), m3 (N, N, 1, 1);
|
||||
#endif
|
||||
#ifdef USE_DIAGONAL
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
#endif
|
||||
(*this) (m1, m2, m3);
|
||||
test_with (m1, m2, m3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<M> mr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (m2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (m3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<M> ms1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (m2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (m3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () (int) const {
|
||||
#ifdef USE_ADAPTOR
|
||||
try {
|
||||
{
|
||||
#ifdef USE_BANDED
|
||||
M m1 (N, N, 1, 1), m2 (N, N, 1, 1), m3 (N, N, 1, 1);
|
||||
ublas::banded_adaptor<M> bam1 (m1, 1, 1), bam2 (m2, 1, 1), bam3 (m3, 1, 1);
|
||||
(*this) (bam1, bam2, bam3);
|
||||
test_with (bam1, bam2, bam3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<ublas::banded_adaptor<M> > mr1 (bam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (bam2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (bam3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<ublas::banded_adaptor<M> > ms1 (bam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (bam2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (bam3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_DIAGONAL
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
ublas::diagonal_adaptor<M> dam1 (m1), dam2 (m2), dam3 (m3);
|
||||
(*this) (dam1, dam2, dam3);
|
||||
test_with (dam1, dam2, dam3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<ublas::diagonal_adaptor<M> > mr1 (dam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (dam2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (dam3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<ublas::diagonal_adaptor<M> > ms1 (dam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (dam2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (dam3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -371,5 +353,3 @@ void test_matrix () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ struct test_my_vector {
|
||||
typedef typename ublas::type_traits<value_type>::real_type real_type;
|
||||
|
||||
template<class VP>
|
||||
void operator () (VP &v1, VP &v2, VP &v3) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, VP &v3) const {
|
||||
{
|
||||
value_type t;
|
||||
size_type i;
|
||||
real_type n;
|
||||
@@ -113,38 +113,26 @@ struct test_my_vector {
|
||||
t = ublas::inner_prod (v1, v2);
|
||||
std::cout << "inner_prod (v1, v2) = " << t << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N), v3 (N);
|
||||
(*this) (v1, v2, v3);
|
||||
test_with (v1, v2, v3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::vector_range<V> vr1 (v1, ublas::range (0, N)),
|
||||
vr2 (v2, ublas::range (0, N)),
|
||||
vr3 (v3, ublas::range (0, N));
|
||||
(*this) (vr1, vr2, vr3);
|
||||
test_with (vr1, vr2, vr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::vector_slice<V> vs1 (v1, ublas::slice (0, 1, N)),
|
||||
vs2 (v2, ublas::slice (0, 1, N)),
|
||||
vs3 (v3, ublas::slice (0, 1, N));
|
||||
(*this) (vs1, vs2, vs3);
|
||||
test_with (vs1, vs2, vs3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -224,4 +212,3 @@ void test_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ struct test_my_matrix_vector {
|
||||
typedef typename V::value_type value_type;
|
||||
|
||||
template<class VP, class MP>
|
||||
void operator () (VP &v1, VP &v2, MP &m1) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, MP &m1) const {
|
||||
{
|
||||
// Rows and columns
|
||||
initialize_matrix (m1, ublas::lower_tag ());
|
||||
for (int i = 0; i < N; ++ i) {
|
||||
@@ -57,76 +57,59 @@ struct test_my_matrix_vector {
|
||||
v2 = ublas::prod (v1, m1);
|
||||
std::cout << "prod (v1, m1) = " << v2 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
(*this) (v1, v2, m1);
|
||||
test_with (v1, v2, m1);
|
||||
|
||||
ublas::matrix_row<M> mr1 (m1, N - 1), mr2 (m1, N - 1);
|
||||
(*this) (mr1, mr2, m1);
|
||||
test_with (mr1, mr2, m1);
|
||||
|
||||
ublas::matrix_column<M> mc1 (m1, 0), mc2 (m1, 0);
|
||||
(*this) (mc1, mc2, m1);
|
||||
test_with (mc1, mc2, m1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<M> mvr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (m1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, m1);
|
||||
test_with (mvr1, mvr2, m1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<M> mvs1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, m1);
|
||||
test_with (mvs1, mvs2, m1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void operator () (int) const {
|
||||
#ifdef USE_ADAPTOR
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
ublas::triangular_adaptor<M> tam1 (m1);
|
||||
(*this) (v1, v2, tam1);
|
||||
test_with (v1, v2, tam1);
|
||||
|
||||
ublas::matrix_row<ublas::triangular_adaptor<M> > mr1 (tam1, N - 1), mr2 (tam1, N - 1);
|
||||
(*this) (mr1, mr2, tam1);
|
||||
test_with (mr1, mr2, tam1);
|
||||
|
||||
ublas::matrix_column<ublas::triangular_adaptor<M> > mc1 (tam1, 0), mc2 (tam1, 0);
|
||||
(*this) (mc1, mc2, tam1);
|
||||
test_with (mc1, mc2, tam1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<ublas::triangular_adaptor<M> > mvr1 (tam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (tam1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, tam1);
|
||||
test_with (mvr1, mvr2, tam1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<ublas::triangular_adaptor<M> > mvs1 (tam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (tam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, tam1);
|
||||
test_with (mvs1, mvs2, tam1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -239,4 +222,3 @@ void test_matrix_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ struct test_my_matrix {
|
||||
typedef typename M::value_type value_type;
|
||||
|
||||
template<class MP>
|
||||
void operator () (MP &m1, MP &m2, MP &m3) const {
|
||||
try {
|
||||
void test_with (MP &m1, MP &m2, MP &m3) const {
|
||||
{
|
||||
value_type t;
|
||||
|
||||
// Copy and swap
|
||||
@@ -104,66 +104,48 @@ struct test_my_matrix {
|
||||
m3 = ublas::prod (m1, m2);
|
||||
std::cout << "prod (m1, m2) = " << m3 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
(*this) (m1, m2, m3);
|
||||
test_with (m1, m2, m3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<M> mr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (m2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (m3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<M> ms1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (m2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (m3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () (int) const {
|
||||
#ifdef USE_ADAPTOR
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
ublas::triangular_adaptor<M> tam1 (m1), tam2 (m2), tam3 (m3);
|
||||
(*this) (tam1, tam2, tam3);
|
||||
test_with (tam1, tam2, tam3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<ublas::triangular_adaptor<M> > mr1 (tam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (tam2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (tam3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<ublas::triangular_adaptor<M> > ms1 (tam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (tam2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (tam3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -256,5 +238,3 @@ std::cout << "std::complex<double>, std::vector" << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ struct test_my_vector {
|
||||
typedef typename ublas::type_traits<value_type>::real_type real_type;
|
||||
|
||||
template<class VP>
|
||||
void operator () (VP &v1, VP &v2, VP &v3) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, VP &v3) const {
|
||||
{
|
||||
value_type t;
|
||||
size_type i;
|
||||
real_type n;
|
||||
@@ -114,38 +114,26 @@ struct test_my_vector {
|
||||
t = ublas::inner_prod (v1, v2);
|
||||
std::cout << "inner_prod (v1, v2) = " << t << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N), v3 (N);
|
||||
(*this) (v1, v2, v3);
|
||||
test_with (v1, v2, v3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::vector_range<V> vr1 (v1, ublas::range (0, N)),
|
||||
vr2 (v2, ublas::range (0, N)),
|
||||
vr3 (v3, ublas::range (0, N));
|
||||
(*this) (vr1, vr2, vr3);
|
||||
test_with (vr1, vr2, vr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::vector_slice<V> vs1 (v1, ublas::slice (0, 1, N)),
|
||||
vs2 (v2, ublas::slice (0, 1, N)),
|
||||
vs3 (v3, ublas::slice (0, 1, N));
|
||||
(*this) (vs1, vs2, vs3);
|
||||
test_with (vs1, vs2, vs3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -225,4 +213,3 @@ void test_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ struct test_my_matrix_vector {
|
||||
typedef typename V::value_type value_type;
|
||||
|
||||
template<class VP, class MP>
|
||||
void operator () (VP &v1, VP &v2, MP &m1) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, MP &m1) const {
|
||||
{
|
||||
// Rows and columns
|
||||
initialize_matrix (m1, ublas::lower_tag ());
|
||||
for (int i = 0; i < N; ++ i) {
|
||||
@@ -60,76 +60,59 @@ struct test_my_matrix_vector {
|
||||
v2 = ublas::prod (v1, m1);
|
||||
std::cout << "prod (v1, m1) = " << v2 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
(*this) (v1, v2, m1);
|
||||
test_with (v1, v2, m1);
|
||||
|
||||
ublas::matrix_row<M> mr1 (m1, N - 1), mr2 (m1, N - 1);
|
||||
(*this) (mr1, mr2, m1);
|
||||
test_with (mr1, mr2, m1);
|
||||
|
||||
ublas::matrix_column<M> mc1 (m1, 0), mc2 (m1, 0);
|
||||
(*this) (mc1, mc2, m1);
|
||||
test_with (mc1, mc2, m1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<M> mvr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (m1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, m1);
|
||||
test_with (mvr1, mvr2, m1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<M> mvs1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, m1);
|
||||
test_with (mvs1, mvs2, m1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void operator () (int) const {
|
||||
#ifdef USE_ADAPTOR
|
||||
try {
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
ublas::symmetric_adaptor<M> tam1 (m1);
|
||||
(*this) (v1, v2, tam1);
|
||||
test_with (v1, v2, tam1);
|
||||
|
||||
ublas::matrix_row<ublas::symmetric_adaptor<M> > mr1 (tam1, N - 1), mr2 (tam1, N - 1);
|
||||
(*this) (mr1, mr2, tam1);
|
||||
test_with (mr1, mr2, tam1);
|
||||
|
||||
ublas::matrix_column<ublas::symmetric_adaptor<M> > mc1 (tam1, 0), mc2 (tam1, 0);
|
||||
(*this) (mc1, mc2, tam1);
|
||||
test_with (mc1, mc2, tam1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<ublas::symmetric_adaptor<M> > mvr1 (tam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (tam1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, tam1);
|
||||
test_with (mvr1, mvr2, tam1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<ublas::symmetric_adaptor<M> > mvs1 (tam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (tam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, tam1);
|
||||
test_with (mvs1, mvs2, tam1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -246,4 +229,3 @@ void test_matrix_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ struct test_my_matrix {
|
||||
typedef typename M::value_type value_type;
|
||||
|
||||
template<class MP>
|
||||
void operator () (MP &m1, MP &m2, MP &m3) const {
|
||||
try {
|
||||
void test_with (MP &m1, MP &m2, MP &m3) const {
|
||||
{
|
||||
value_type t;
|
||||
|
||||
// Copy and swap
|
||||
@@ -105,66 +105,48 @@ struct test_my_matrix {
|
||||
m3 = ublas::prod (m1, m2);
|
||||
std::cout << "prod (m1, m2) = " << m3 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
(*this) (m1, m2, m3);
|
||||
test_with (m1, m2, m3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<M> mr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (m2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (m3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<M> ms1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (m2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (m3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () (int) const {
|
||||
#ifdef USE_ADAPTOR
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
ublas::symmetric_adaptor<M> sam1 (m1), sam2 (m2), sam3 (m3);
|
||||
(*this) (sam1, sam2, sam3);
|
||||
test_with (sam1, sam2, sam3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<ublas::symmetric_adaptor<M> > mr1 (sam1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (sam2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (sam3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<ublas::symmetric_adaptor<M> > ms1 (sam1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (sam2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (sam3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -257,5 +239,3 @@ void test_matrix () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ struct test_my_vector {
|
||||
typedef typename ublas::type_traits<value_type>::real_type real_type;
|
||||
|
||||
template<class VP>
|
||||
void operator () (VP &v1, VP &v2, VP &v3) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, VP &v3) const {
|
||||
{
|
||||
value_type t;
|
||||
size_type i;
|
||||
real_type n;
|
||||
@@ -115,38 +115,26 @@ struct test_my_vector {
|
||||
t = ublas::inner_prod (v1, v2);
|
||||
std::cout << "inner_prod (v1, v2) = " << t << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N), v3 (N);
|
||||
(*this) (v1, v2, v3);
|
||||
test_with (v1, v2, v3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::vector_range<V> vr1 (v1, ublas::range (0, N)),
|
||||
vr2 (v2, ublas::range (0, N)),
|
||||
vr3 (v3, ublas::range (0, N));
|
||||
(*this) (vr1, vr2, vr3);
|
||||
test_with (vr1, vr2, vr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::vector_slice<V> vs1 (v1, ublas::slice (0, 1, N)),
|
||||
vs2 (v2, ublas::slice (0, 1, N)),
|
||||
vs3 (v3, ublas::slice (0, 1, N));
|
||||
(*this) (vs1, vs2, vs3);
|
||||
test_with (vs1, vs2, vs3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -226,4 +214,3 @@ void test_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ struct test_my_matrix_vector {
|
||||
typedef typename V::value_type value_type;
|
||||
|
||||
template<class VP, class MP>
|
||||
void operator () (VP &v1, VP &v2, MP &m1) const {
|
||||
try {
|
||||
void test_with (VP &v1, VP &v2, MP &m1) const {
|
||||
{
|
||||
// Rows and columns
|
||||
initialize_matrix (m1);
|
||||
for (int i = 0; i < N; ++ i) {
|
||||
@@ -57,43 +57,31 @@ struct test_my_matrix_vector {
|
||||
v2 = ublas::prod (v1, m1);
|
||||
std::cout << "prod (v1, m1) = " << v2 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
V v1 (N), v2 (N);
|
||||
M m1 (N, N);
|
||||
(*this) (v1, v2, m1);
|
||||
test_with (v1, v2, m1);
|
||||
|
||||
ublas::matrix_row<M> mr1 (m1, 0), mr2 (m1, 1);
|
||||
(*this) (mr1, mr2, m1);
|
||||
test_with (mr1, mr2, m1);
|
||||
|
||||
ublas::matrix_column<M> mc1 (m1, 0), mc2 (m1, 1);
|
||||
(*this) (mc1, mc2, m1);
|
||||
test_with (mc1, mc2, m1);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_vector_range<M> mvr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mvr2 (m1, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mvr1, mvr2, m1);
|
||||
test_with (mvr1, mvr2, m1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_vector_slice<M> mvs1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
mvs2 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (mvs1, mvs2, m1);
|
||||
test_with (mvs1, mvs2, m1);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -273,5 +261,3 @@ void test_matrix_vector () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ struct test_my_matrix {
|
||||
typedef typename M::value_type value_type;
|
||||
|
||||
template<class MP>
|
||||
void operator () (MP &m1, MP &m2, MP &m3) const {
|
||||
try {
|
||||
void test_with (MP &m1, MP &m2, MP &m3) const {
|
||||
{
|
||||
value_type t;
|
||||
|
||||
// Copy and swap
|
||||
@@ -104,38 +104,26 @@ struct test_my_matrix {
|
||||
m3 = ublas::prod (m1, m2);
|
||||
std::cout << "prod (m1, m2) = " << m3 << std::endl;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
void operator () () const {
|
||||
try {
|
||||
{
|
||||
M m1 (N, N), m2 (N, N), m3 (N, N);
|
||||
(*this) (m1, m2, m3);
|
||||
test_with (m1, m2, m3);
|
||||
|
||||
#ifdef USE_RANGE
|
||||
ublas::matrix_range<M> mr1 (m1, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr2 (m2, ublas::range (0, N), ublas::range (0, N)),
|
||||
mr3 (m3, ublas::range (0, N), ublas::range (0, N));
|
||||
(*this) (mr1, mr2, mr3);
|
||||
test_with (mr1, mr2, mr3);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLICE
|
||||
ublas::matrix_slice<M> ms1 (m1, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms2 (m2, ublas::slice (0, 1, N), ublas::slice (0, 1, N)),
|
||||
ms3 (m3, ublas::slice (0, 1, N), ublas::slice (0, 1, N));
|
||||
(*this) (ms1, ms2, ms3);
|
||||
test_with (ms1, ms2, ms3);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
std::cout << e.what () << std::endl;
|
||||
}
|
||||
catch (...) {
|
||||
std::cout << "unknown exception" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -291,6 +279,3 @@ void test_matrix () {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user