2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-22 03:42:19 +00:00

BOOST_UBLAS_SIMPLE_ET_DEBUG

svn path=/trunk/boost/boost/numeric/ublas/; revision=24220
This commit is contained in:
Michael Stevens
2004-08-01 09:30:45 +00:00
parent 8847847916
commit 400e00e4e5
5 changed files with 46 additions and 58 deletions

View File

@@ -149,7 +149,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class M, class T, class V1, class V2>
M &
gr (M &m, const T &t, const V1 &v1, const V2 &v2) {
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
return m += t * outer_prod (v1, v2);
#else
return m = m + t * outer_prod (v1, v2);
@@ -162,7 +162,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class M, class T, class V>
M &
sr (M &m, const T &t, const V &v) {
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
return m += t * outer_prod (v, v);
#else
return m = m + t * outer_prod (v, v);
@@ -174,7 +174,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class M, class T, class V>
M &
hr (M &m, const T &t, const V &v) {
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
return m += t * outer_prod (v, conj (v));
#else
return m = m + t * outer_prod (v, conj (v));
@@ -188,7 +188,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class M, class T, class V1, class V2>
M &
sr2 (M &m, const T &t, const V1 &v1, const V2 &v2) {
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
return m += t * (outer_prod (v1, v2) + outer_prod (v2, v1));
#else
return m = m + t * (outer_prod (v1, v2) + outer_prod (v2, v1));
@@ -202,7 +202,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class M, class T, class V1, class V2>
M &
hr2 (M &m, const T &t, const V1 &v1, const V2 &v2) {
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
return m += t * outer_prod (v1, conj (v2)) + type_traits<T>::conj (t) * outer_prod (v2, conj (v1));
#else
return m = m + t * outer_prod (v1, conj (v2)) + type_traits<T>::conj (t) * outer_prod (v2, conj (v1));

View File

@@ -68,6 +68,14 @@
// MSVC doesn't support long double
#define BOOST_UBLAS_NO_LONG_DOUBLE
#ifdef NDEBUG
// MSVC has special inlining options
#pragma inline_recursion (on)
#pragma inline_depth (255)
#pragma auto_inline (on)
// #define BOOST_UBLAS_INLINE __forceinline
#define BOOST_UBLAS_INLINE __inline
#endif
// With MSVC we could perform IO via basic_stream
// #define BOOST_UBLAS_USE_BASIC_STREAM
@@ -238,68 +246,53 @@ namespace std {
// Enable performance options in release mode
// Enable performance options in RELEASE mode
#ifdef NDEBUG
#ifdef BOOST_MSVC
// MSVC has special inlining options
#pragma inline_recursion (on)
#pragma inline_depth (255)
#pragma auto_inline (on)
// #define BOOST_UBLAS_INLINE __forceinline
#define BOOST_UBLAS_INLINE __inline
#else
#ifndef BOOST_UBLAS_INLINE
#define BOOST_UBLAS_INLINE inline
#endif
// Do not check sizes!
#define BOOST_UBLAS_USE_FAST_SAME
// Use expression templates.
#ifndef BOOST_UBLAS_USE_ET
#define BOOST_UBLAS_USE_ET
#endif // BOOST_UBLAS_USE_ET
// NO runtime error checks with BOOST_UBLAS_CHECK macro
#ifndef BOOST_UBLAS_CHECK_ENABLE
#define BOOST_UBLAS_CHECK_ENABLE 0
#endif
// NO numeric checks for non dense matrices
#ifndef BOOST_UBLAS_TYPE_CHECK
// NO type compatibility numeric checks
#ifndef BOOST_UBLAS_TYPE_CHECK
#define BOOST_UBLAS_TYPE_CHECK 0
#endif
// Disable performance options in debug mode
// Disable performance options in DEBUG mode
#else
#ifdef BOOST_MSVC
// MSVC has special inlining options
// #pragma inline_recursion (off)
// #pragma inline_depth ()
// #pragma auto_inline (off)
#endif
#define BOOST_UBLAS_INLINE
// In order to simplify debugging is is possible to simplify expression template
// so they are restricted to a single operation
// #define BOOST_UBLAS_SIMPLE_ET_DEBUG
#ifdef BOOST_MSVC
// Use expression templates (otherwise we get many ICE's)
#ifndef BOOST_UBLAS_USE_ET
#define BOOST_UBLAS_USE_ET
#endif // BOOST_UBLAS_USE_ET
#endif // BOOST_MSVC
#ifndef BOOST_UBLAS_INLINE
#define BOOST_UBLAS_INLINE
#endif
// Enable runtime error checks with BOOST_UBLAS_CHECK macro. Check bounds etc
#ifndef BOOST_UBLAS_CHECK_ENABLE
#define BOOST_UBLAS_CHECK_ENABLE 1
#endif
// Type compatible numeric checks for non dense matrices (requires additional storage and complexity)
#ifndef BOOST_UBLAS_TYPE_CHECK
// Type compatibiltity numeric checks
#ifndef BOOST_UBLAS_TYPE_CHECK
#define BOOST_UBLAS_TYPE_CHECK 1
#endif
#endif
// Control type compatibility numeric runtime checks for non dense matrices.
// Require additional storage and complexity
#if BOOST_UBLAS_TYPE_CHECK
template <class Dummy>
struct disable_type_check

View File

@@ -1137,7 +1137,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E1, class E2, class F>
struct vector_matrix_binary_traits {
typedef vector_matrix_binary<E1, E2, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef matrix<typename F::result_type> result_type;
@@ -1562,7 +1562,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E, class F>
struct matrix_unary1_traits {
typedef matrix_unary1<E, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef matrix<typename F::result_type> result_type;
@@ -2036,7 +2036,7 @@ namespace boost { namespace numeric { namespace ublas {
struct matrix_unary2_traits {
typedef matrix_unary2<E, F> expression_type;
//FIXME
// #ifdef BOOST_UBLAS_USE_ET
// #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
// #else
// typedef matrix<typename F::result_type> result_type;
@@ -2757,7 +2757,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E1, class E2, class F>
struct matrix_binary_traits {
typedef matrix_binary<E1, E2, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef matrix<typename F::result_type> result_type;
@@ -3244,7 +3244,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class T1, class E2, class F>
struct matrix_binary_scalar1_traits {
typedef matrix_binary_scalar1<scalar_const_reference<T1>, E2, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef matrix<typename F::result_type> result_type;
@@ -3693,7 +3693,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E1, class T2, class F>
struct matrix_binary_scalar2_traits {
typedef matrix_binary_scalar2<E1, scalar_const_reference<T2>, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef matrix<typename F::result_type> result_type;
@@ -4017,7 +4017,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef row_major_tag orientation_category;
typedef typename promote_traits<T1, T2>::promote_type promote_type;
typedef matrix_vector_binary1<E1, E2, matrix_vector_prod1<T1, T2, promote_type> > expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef vector<promote_type> result_type;
@@ -4412,7 +4412,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef column_major_tag orientation_category;
typedef typename promote_traits<T1, T2>::promote_type promote_type;
typedef matrix_vector_binary2<E1, E2, matrix_vector_prod2<T1, T2, promote_type> > expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef vector<promote_type> result_type;
@@ -5122,7 +5122,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef unknown_orientation_tag orientation_category;
typedef typename promote_traits<T1, T2>::promote_type promote_type;
typedef matrix_matrix_binary<E1, E2, matrix_matrix_prod<T1, T2, promote_type> > expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef matrix<promote_type> result_type;
@@ -5254,7 +5254,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E, class F>
struct matrix_scalar_unary_traits {
typedef matrix_scalar_unary<E, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef typename F::result_type result_type;

View File

@@ -263,11 +263,6 @@ namespace boost { namespace numeric { namespace ublas {
void insert (size_type i, size_type j, const_reference t) {
BOOST_UBLAS_CHECK (i < size_, bad_index ());
BOOST_UBLAS_CHECK (j < size_, bad_index ());
// FIXME: is this ugly check still needed?!
// #ifndef BOOST_UBLAS_USE_ET
// if (t == value_type ())
// return;
// #endif
if (functor1_type::other (i, j)) {
size_type k = functor1_type::element (functor2_type (), i, size_, j, size_);
BOOST_UBLAS_CHECK (type_traits<value_type>::equals (data () [k], value_type ()) ||

View File

@@ -758,7 +758,7 @@ namespace boost { namespace numeric { namespace ublas {
struct vector_unary_traits {
typedef vector_unary<E, F> expression_type;
//FIXME
// #ifdef BOOST_UBLAS_USE_ET
// #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
// #else
// typedef vector<typename F::result_type> result_type;
@@ -1160,7 +1160,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E1, class E2, class F>
struct vector_binary_traits {
typedef vector_binary<E1, E2, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef vector<typename F::result_type> result_type;
@@ -1439,7 +1439,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class T1, class E2, class F>
struct vector_binary_scalar1_traits {
typedef vector_binary_scalar1<scalar_const_reference<T1>, E2, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef vector<typename F::result_type> result_type;
@@ -1680,7 +1680,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E1, class T2, class F>
struct vector_binary_scalar2_traits {
typedef vector_binary_scalar2<E1, scalar_const_reference<T2>, F> expression_type;
#ifdef BOOST_UBLAS_USE_ET
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef vector<typename F::result_type> result_type;
@@ -1775,7 +1775,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E, class F>
struct vector_scalar_unary_traits {
typedef vector_scalar_unary<E, F> expression_type;
#if defined (BOOST_UBLAS_USE_ET) && defined (BOOST_UBLAS_USE_SCALAR_ET)
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef typename F::result_type result_type;
@@ -1907,7 +1907,7 @@ namespace boost { namespace numeric { namespace ublas {
template<class E1, class E2, class F>
struct vector_scalar_binary_traits {
typedef vector_scalar_binary<E1, E2, F> expression_type;
#if defined (BOOST_UBLAS_USE_ET) && defined (BOOST_UBLAS_USE_SCALAR_ET)
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
typedef expression_type result_type;
#else
typedef typename F::result_type result_type;