From ef8eacfb6f491127be809cd0a5154c1800e5a7d5 Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Thu, 26 Aug 2004 12:42:23 +0000 Subject: [PATCH] Exceptions. No need to catch. We want test to halt for testing on exception. [SVN r24752] --- test1/test11.cpp | 25 +++++--------------- test1/test12.cpp | 28 +++++++--------------- test1/test13.cpp | 27 +++++---------------- test2/test21.cpp | 8 +------ test2/test22.cpp | 9 +------ test2/test23.cpp | 8 +------ test3/test31.cpp | 25 +++++--------------- test3/test32.cpp | 61 +++++++++++++++++++----------------------------- test3/test33.cpp | 42 +++++++++++---------------------- test4/test41.cpp | 25 +++++--------------- test4/test42.cpp | 58 ++++++++++++++++----------------------------- test4/test43.cpp | 46 +++++++++++------------------------- test5/test51.cpp | 25 +++++--------------- test5/test52.cpp | 48 ++++++++++++------------------------- test5/test53.cpp | 40 ++++++++----------------------- test6/test61.cpp | 25 +++++--------------- test6/test62.cpp | 46 +++++++++++------------------------- test6/test63.cpp | 40 ++++++++----------------------- test7/test71.cpp | 25 +++++--------------- test7/test72.cpp | 30 +++++++----------------- test7/test73.cpp | 27 +++++---------------- 21 files changed, 187 insertions(+), 481 deletions(-) diff --git a/test1/test11.cpp b/test1/test11.cpp index 5d821b12..9b3f23a8 100644 --- a/test1/test11.cpp +++ b/test1/test11.cpp @@ -31,8 +31,8 @@ struct test_my_vector { typedef typename ublas::type_traits::real_type real_type; template - 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 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 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 } - diff --git a/test1/test12.cpp b/test1/test12.cpp index 905ca612..7b8f50db 100644 --- a/test1/test12.cpp +++ b/test1/test12.cpp @@ -29,8 +29,8 @@ struct test_my_matrix_vector { typedef typename V::value_type value_type; template - 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 mr1 (m1, 0), mr2 (m1, 1); - (*this) (mr1, mr2, m1); + test_with (mr1, mr2, m1); ublas::matrix_column mc1 (m1, 0), mc2 (m1, 1); - (*this) (mc1, mc2, m1); + test_with (mc1, mc2, m1); #ifdef USE_RANGE ublas::matrix_vector_range 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 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; - } } }; diff --git a/test1/test13.cpp b/test1/test13.cpp index 93d33eae..f0893bb9 100644 --- a/test1/test13.cpp +++ b/test1/test13.cpp @@ -29,8 +29,8 @@ struct test_my_matrix { typedef typename M::value_type value_type; template - 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 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 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 } - - - diff --git a/test2/test21.cpp b/test2/test21.cpp index e72f53f8..20bf9987 100644 --- a/test2/test21.cpp +++ b/test2/test21.cpp @@ -28,7 +28,7 @@ template void test_blas_1::operator () () { - try { + { value_type t; real_type n; V v1 (N), v2 (N); @@ -88,12 +88,6 @@ void test_blas_1::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 diff --git a/test2/test22.cpp b/test2/test22.cpp index 3835fed6..2f00b4db 100644 --- a/test2/test22.cpp +++ b/test2/test22.cpp @@ -28,7 +28,7 @@ template void test_blas_2::operator () () { - try { + { V v1 (N), v2 (N); M m (N, N); @@ -140,12 +140,6 @@ void test_blas_2::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::matrix >, ublas::matrix >, 3>; #endif #endif - diff --git a/test2/test23.cpp b/test2/test23.cpp index 6c7aaff4..1023d388 100644 --- a/test2/test23.cpp +++ b/test2/test23.cpp @@ -28,7 +28,7 @@ template void test_blas_3::operator () () { - try { + { M m1 (N, N), m2 (N, N), m3 (N, N); // _t_mm @@ -201,12 +201,6 @@ void test_blas_3::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 diff --git a/test3/test31.cpp b/test3/test31.cpp index 80115221..62c6cfb0 100644 --- a/test3/test31.cpp +++ b/test3/test31.cpp @@ -33,8 +33,8 @@ struct test_my_vector { typedef typename ublas::type_traits::real_type real_type; template - 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 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 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 } - diff --git a/test3/test32.cpp b/test3/test32.cpp index c8d2fa54..6c858632 100644 --- a/test3/test32.cpp +++ b/test3/test32.cpp @@ -32,8 +32,8 @@ struct test_my_matrix_vector { typedef typename V::value_type value_type; template - 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 mr1 (m1, 0), mr2 (m1, N - 1); - (*this) (mr1, mr2, m1); + test_with (mr1, mr2, m1); ublas::matrix_column mc1 (m1, 0), mc2 (m1, N - 1); - (*this) (mc1, mc2, m1); + test_with (mc1, mc2, m1); #ifdef USE_RANGE ublas::matrix_vector_range 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 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::generalized_vector_of_vector > > >, 3 > () (); - // test_my_matrix_vector >, - // ublas::generalized_vector_of_vector >, ublas::map_array > > > >, 3 > () (); + test_my_matrix_vector >, + ublas::generalized_vector_of_vector >, ublas::map_array > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "double, map_array" << std::endl; test_my_matrix_vector >, ublas::generalized_vector_of_vector > > >, 3 > () (); - // test_my_matrix_vector >, - // ublas::generalized_vector_of_vector >, ublas::map_array > > > >, 3 > () (); + test_my_matrix_vector >, + ublas::generalized_vector_of_vector >, ublas::map_array > > > >, 3 > () (); #endif #ifdef USE_STD_COMPLEX @@ -241,16 +229,16 @@ void test_matrix_vector () { std::cout << "std::complex, map_array" << std::endl; test_my_matrix_vector, ublas::map_array > >, ublas::generalized_vector_of_vector, ublas::row_major, ublas::vector, ublas::map_array > > > >, 3 > () (); - // test_my_matrix_vector, ublas::map_array > >, - // ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); + test_my_matrix_vector, ublas::map_array > >, + ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "std::complex, map_array" << std::endl; test_my_matrix_vector, ublas::map_array > >, ublas::generalized_vector_of_vector, ublas::row_major, ublas::vector, ublas::map_array > > > >, 3 > () (); - // test_my_matrix_vector, ublas::map_array > >, - // ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); + test_my_matrix_vector, ublas::map_array > >, + ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); #endif #endif #endif @@ -260,16 +248,16 @@ void test_matrix_vector () { std::cout << "float, std::map" << std::endl; test_my_matrix_vector >, ublas::generalized_vector_of_vector > > >, 3 > () (); - // test_my_matrix_vector >, - // ublas::generalized_vector_of_vector >, std::map > > > >, 3 > () (); + test_my_matrix_vector >, + ublas::generalized_vector_of_vector >, std::map > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "double, std::map" << std::endl; test_my_matrix_vector >, ublas::generalized_vector_of_vector > > >, 3 > () (); - // test_my_matrix_vector >, - // ublas::generalized_vector_of_vector >, std::map > > > >, 3 > () (); + test_my_matrix_vector >, + ublas::generalized_vector_of_vector >, std::map > > > >, 3 > () (); #endif #ifdef USE_STD_COMPLEX @@ -277,16 +265,16 @@ void test_matrix_vector () { std::cout << "std::complex, std::map" << std::endl; test_my_matrix_vector, std::map > >, ublas::generalized_vector_of_vector, ublas::row_major, ublas::vector, std::map > > > >, 3 > () (); - // test_my_matrix_vector, std::map > >, - // ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); + test_my_matrix_vector, std::map > >, + ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "std::complex, std::map" << std::endl; test_my_matrix_vector, std::map > >, ublas::generalized_vector_of_vector, ublas::row_major, ublas::vector, std::map > > > >, 3 > () (); - // test_my_matrix_vector, std::map > >, - // ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); + test_my_matrix_vector, std::map > >, + ublas::generalized_vector_of_vector, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); #endif #endif #endif @@ -348,4 +336,3 @@ void test_matrix_vector () { #endif #endif } - diff --git a/test3/test33.cpp b/test3/test33.cpp index f5d7a778..55c695cc 100644 --- a/test3/test33.cpp +++ b/test3/test33.cpp @@ -32,8 +32,8 @@ struct test_my_matrix { typedef typename M::value_type value_type; template - 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 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 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 > > >, 3 > () (); - // test_my_matrix >, ublas::map_array > > > >, 3 > () (); + test_my_matrix >, ublas::map_array > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "double, map_array" << std::endl; test_my_matrix > > >, 3 > () (); - // test_my_matrix >, ublas::map_array > > > >, 3 > () (); + test_my_matrix >, ublas::map_array > > > >, 3 > () (); #endif #ifdef USE_STD_COMPLEX #ifdef USE_FLOAT std::cout << "std::complex, map_array" << std::endl; test_my_matrix, ublas::row_major, ublas::vector, ublas::map_array > > > >, 3 > () (); - // test_my_matrix, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); + test_my_matrix, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "std::complex, map_array" << std::endl; test_my_matrix, ublas::row_major, ublas::vector, ublas::map_array > > > >, 3 > () (); - // test_my_matrix, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); + test_my_matrix, ublas::row_major, ublas::sparse_vector, ublas::map_array > >, ublas::map_array, ublas::map_array > > > > >, 3 > () (); #endif #endif #endif @@ -279,26 +267,26 @@ void test_matrix () { #ifdef USE_FLOAT std::cout << "float, std::map" << std::endl; test_my_matrix > > >, 3 > () (); - // test_my_matrix >, std::map > > > >, 3 > () (); + test_my_matrix >, std::map > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "double, std::map" << std::endl; test_my_matrix > > >, 3 > () (); - // test_my_matrix >, std::map > > > >, 3 > () (); + test_my_matrix >, std::map > > > >, 3 > () (); #endif #ifdef USE_STD_COMPLEX #ifdef USE_FLOAT std::cout << "std::complex, std::map" << std::endl; test_my_matrix, ublas::row_major, ublas::vector, std::map > > > >, 3 > () (); - // test_my_matrix, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); + test_my_matrix, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); #endif #ifdef USE_DOUBLE std::cout << "std::complex, std::map" << std::endl; test_my_matrix, ublas::row_major, ublas::vector, std::map > > > >, 3 > () (); - // test_my_matrix, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); + test_my_matrix, ublas::row_major, ublas::sparse_vector, std::map > >, std::map, std::map > > > > >, 3 > () (); #endif #endif #endif @@ -352,5 +340,3 @@ void test_matrix () { #endif #endif } - - diff --git a/test4/test41.cpp b/test4/test41.cpp index cbf3036c..b0cc5fe9 100644 --- a/test4/test41.cpp +++ b/test4/test41.cpp @@ -32,8 +32,8 @@ struct test_my_vector { typedef typename ublas::type_traits::real_type real_type; template - 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 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 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 } - diff --git a/test4/test42.cpp b/test4/test42.cpp index 1d57b2e2..e0c9717c 100644 --- a/test4/test42.cpp +++ b/test4/test42.cpp @@ -30,8 +30,8 @@ struct test_my_matrix_vector { typedef typename V::value_type value_type; template - 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 mr1 (m1, 1), mr2 (m1, 1); - (*this) (mr1, mr2, m1); + test_with (mr1, mr2, m1); ublas::matrix_column mc1 (m1, 1), mc2 (m1, 1); - (*this) (mc1, mc2, m1); + test_with (mc1, mc2, m1); #ifdef USE_RANGE ublas::matrix_vector_range 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 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 bam1 (m1, 1, 1); - (*this) (v1, v2, bam1); + test_with (v1, v2, bam1); ublas::matrix_row > mr1 (bam1, 1), mr2 (bam1, 1); - (*this) (mr1, mr2, bam1); + test_with (mr1, mr2, bam1); ublas::matrix_column > mc1 (bam1, 1), mc2 (bam1, 1); - (*this) (mc1, mc2, bam1); + test_with (mc1, mc2, bam1); #ifdef USE_RANGE ublas::matrix_vector_range > 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 > 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 dam1 (m1); - (*this) (v1, v2, dam1); + test_with (v1, v2, dam1); ublas::matrix_row > mr1 (dam1, 1), mr2 (dam1, 1); - (*this) (mr1, mr2, dam1); + test_with (mr1, mr2, dam1); ublas::matrix_column > mc1 (dam1, 1), mc2 (dam1, 1); - (*this) (mc1, mc2, dam1); + test_with (mc1, mc2, dam1); #ifdef USE_RANGE ublas::matrix_vector_range > 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 > 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 } - diff --git a/test4/test43.cpp b/test4/test43.cpp index 77e09ae0..3d074602 100644 --- a/test4/test43.cpp +++ b/test4/test43.cpp @@ -30,8 +30,8 @@ struct test_my_matrix { typedef typename M::value_type value_type; template - 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 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 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 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 > 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 > 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 dam1 (m1), dam2 (m2), dam3 (m3); - (*this) (dam1, dam2, dam3); + test_with (dam1, dam2, dam3); #ifdef USE_RANGE ublas::matrix_range > 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 > 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 } - - diff --git a/test5/test51.cpp b/test5/test51.cpp index ed61e358..716c4678 100644 --- a/test5/test51.cpp +++ b/test5/test51.cpp @@ -32,8 +32,8 @@ struct test_my_vector { typedef typename ublas::type_traits::real_type real_type; template - 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 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 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 } - diff --git a/test5/test52.cpp b/test5/test52.cpp index 6fa8679f..5921715a 100644 --- a/test5/test52.cpp +++ b/test5/test52.cpp @@ -30,8 +30,8 @@ struct test_my_matrix_vector { typedef typename V::value_type value_type; template - 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 mr1 (m1, N - 1), mr2 (m1, N - 1); - (*this) (mr1, mr2, m1); + test_with (mr1, mr2, m1); ublas::matrix_column mc1 (m1, 0), mc2 (m1, 0); - (*this) (mc1, mc2, m1); + test_with (mc1, mc2, m1); #ifdef USE_RANGE ublas::matrix_vector_range 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 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 tam1 (m1); - (*this) (v1, v2, tam1); + test_with (v1, v2, tam1); ublas::matrix_row > mr1 (tam1, N - 1), mr2 (tam1, N - 1); - (*this) (mr1, mr2, tam1); + test_with (mr1, mr2, tam1); ublas::matrix_column > mc1 (tam1, 0), mc2 (tam1, 0); - (*this) (mc1, mc2, tam1); + test_with (mc1, mc2, tam1); #ifdef USE_RANGE ublas::matrix_vector_range > 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 > 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 } - diff --git a/test5/test53.cpp b/test5/test53.cpp index 78afa1c2..c51a61ca 100644 --- a/test5/test53.cpp +++ b/test5/test53.cpp @@ -30,8 +30,8 @@ struct test_my_matrix { typedef typename M::value_type value_type; template - 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 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 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 tam1 (m1), tam2 (m2), tam3 (m3); - (*this) (tam1, tam2, tam3); + test_with (tam1, tam2, tam3); #ifdef USE_RANGE ublas::matrix_range > 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 > 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, std::vector" << std::endl; #endif #endif } - - diff --git a/test6/test61.cpp b/test6/test61.cpp index 5329cc57..f22deae1 100644 --- a/test6/test61.cpp +++ b/test6/test61.cpp @@ -33,8 +33,8 @@ struct test_my_vector { typedef typename ublas::type_traits::real_type real_type; template - 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 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 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 } - diff --git a/test6/test62.cpp b/test6/test62.cpp index 829e32aa..e20b52d2 100644 --- a/test6/test62.cpp +++ b/test6/test62.cpp @@ -31,8 +31,8 @@ struct test_my_matrix_vector { typedef typename V::value_type value_type; template - 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 mr1 (m1, N - 1), mr2 (m1, N - 1); - (*this) (mr1, mr2, m1); + test_with (mr1, mr2, m1); ublas::matrix_column mc1 (m1, 0), mc2 (m1, 0); - (*this) (mc1, mc2, m1); + test_with (mc1, mc2, m1); #ifdef USE_RANGE ublas::matrix_vector_range 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 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 tam1 (m1); - (*this) (v1, v2, tam1); + test_with (v1, v2, tam1); ublas::matrix_row > mr1 (tam1, N - 1), mr2 (tam1, N - 1); - (*this) (mr1, mr2, tam1); + test_with (mr1, mr2, tam1); ublas::matrix_column > mc1 (tam1, 0), mc2 (tam1, 0); - (*this) (mc1, mc2, tam1); + test_with (mc1, mc2, tam1); #ifdef USE_RANGE ublas::matrix_vector_range > 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 > 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 } - diff --git a/test6/test63.cpp b/test6/test63.cpp index fa3a3464..95267e17 100644 --- a/test6/test63.cpp +++ b/test6/test63.cpp @@ -31,8 +31,8 @@ struct test_my_matrix { typedef typename M::value_type value_type; template - 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 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 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 sam1 (m1), sam2 (m2), sam3 (m3); - (*this) (sam1, sam2, sam3); + test_with (sam1, sam2, sam3); #ifdef USE_RANGE ublas::matrix_range > 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 > 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 } - - diff --git a/test7/test71.cpp b/test7/test71.cpp index d1832229..b01bdfd1 100644 --- a/test7/test71.cpp +++ b/test7/test71.cpp @@ -34,8 +34,8 @@ struct test_my_vector { typedef typename ublas::type_traits::real_type real_type; template - 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 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 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 } - diff --git a/test7/test72.cpp b/test7/test72.cpp index afd64983..09cd8b1c 100644 --- a/test7/test72.cpp +++ b/test7/test72.cpp @@ -32,8 +32,8 @@ struct test_my_matrix_vector { typedef typename V::value_type value_type; template - 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 mr1 (m1, 0), mr2 (m1, 1); - (*this) (mr1, mr2, m1); + test_with (mr1, mr2, m1); ublas::matrix_column mc1 (m1, 0), mc2 (m1, 1); - (*this) (mc1, mc2, m1); + test_with (mc1, mc2, m1); #ifdef USE_RANGE ublas::matrix_vector_range 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 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 } - - diff --git a/test7/test73.cpp b/test7/test73.cpp index 688bbed6..66e2b92f 100644 --- a/test7/test73.cpp +++ b/test7/test73.cpp @@ -30,8 +30,8 @@ struct test_my_matrix { typedef typename M::value_type value_type; template - 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 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 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 } - - -