2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-23 16:12:09 +00:00

More fixes.

This commit is contained in:
Jörg Walter
2003-11-11 21:21:29 +00:00
parent bef18df03a
commit c94a5a5b00
10 changed files with 66 additions and 42 deletions

View File

@@ -1023,7 +1023,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F, class A>
typename banded_matrix<T, F, A>::value_type banded_matrix<T, F, A>::zero_ = 0;
typename banded_matrix<T, F, A>::value_type banded_matrix<T, F, A>::zero_ =
banded_matrix<T, F, A>::value_type ();
// Diagonal matrix class
template<class T, class F, class A>
@@ -2063,7 +2064,8 @@ namespace boost { namespace numeric { namespace ublas {
template<class M>
typename banded_adaptor<M>::matrix_type banded_adaptor<M>::nil_;
template<class M>
typename banded_adaptor<M>::value_type banded_adaptor<M>::zero_ = 0;
typename banded_adaptor<M>::value_type banded_adaptor<M>::zero_ =
banded_adaptor<M>::value_type ();
// Diagonal matrix adaptor class
template<class M>

View File

@@ -1038,7 +1038,7 @@ namespace boost { namespace numeric { namespace ublas {
AdditiveAbelianGroupConcept<value_type>::constraints ();
bool r;
value_type a = value_type (), b = value_type (), c = value_type ();
r = prod (prod<T> (a, b), c) == prod (a, prod<T> (b, c)) ;
r = prod (T (prod (a, b)), c) == prod (a, T (prod (b, c)));
r = prod (a + b, c) == prod (a, c) + prod (b, c);
r = prod (OneElement (value_type ()), a) == a;
r = prod (a, OneElement (value_type ())) == a;

View File

@@ -2387,9 +2387,11 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T>
typename identity_matrix<T>::value_type identity_matrix<T>::zero_ = 0;
typename identity_matrix<T>::value_type identity_matrix<T>::zero_ =
identity_matrix<T>::value_type ();
template<class T>
typename identity_matrix<T>::value_type identity_matrix<T>::one_ = 1;
typename identity_matrix<T>::value_type identity_matrix<T>::one_ =
identity_matrix<T>::value_type (1);
// Zero matrix class
template<class T>
@@ -2841,7 +2843,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T>
typename zero_matrix<T>::value_type zero_matrix<T>::zero_ = 0;
typename zero_matrix<T>::value_type zero_matrix<T>::zero_ =
zero_matrix<T>::value_type ();
// Scalar matrix class
template<class T>

View File

@@ -516,7 +516,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename M::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
matrix<value_type, row_major> cm (m.size1 (), m.size2 ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_matrix_assign (scalar_assign<typename matrix<value_type, row_major>::reference, value_type> (), cm, m, row_major_tag ());
indexing_matrix_assign (functor1_type::template make_debug_functor<typename matrix<value_type, row_major>::reference, value_type> (), cm, e, row_major_tag ());
#else
@@ -651,7 +651,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename M::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
matrix<value_type, column_major> cm (m.size1 (), m.size2 ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_matrix_assign (scalar_assign<typename matrix<value_type, column_major>::reference, value_type> (), cm, m, column_major_tag ());
indexing_matrix_assign (functor1_type::template make_debug_functor<typename matrix<value_type, column_major>::reference, value_type> (), cm, e, column_major_tag ());
#else
@@ -784,7 +784,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename M::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
matrix<value_type, row_major> cm (m.size1 (), m.size2 ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_matrix_assign (scalar_assign<typename matrix<value_type, row_major>::reference, value_type> (), cm, m, row_major_tag ());
indexing_matrix_assign (functor_type::template make_debug_functor<typename matrix<value_type, row_major>::reference, value_type> (), cm, e, row_major_tag ());
#else
@@ -827,7 +827,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename M::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
matrix<value_type, column_major> cm (m.size1 (), m.size2 ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_matrix_assign (scalar_assign<typename matrix<value_type, column_major>::reference, value_type> (), cm, m, column_major_tag ());
indexing_matrix_assign (functor_type::template make_debug_functor<typename matrix<value_type, column_major>::reference, value_type> (), cm, e, column_major_tag ());
#else
@@ -872,7 +872,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename M::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
matrix<value_type, row_major> cm (m.size1 (), m.size2 ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_matrix_assign (scalar_assign<typename matrix<value_type, row_major>::reference, value_type> (), cm, m, row_major_tag ());
indexing_matrix_assign (functor1_type::template make_debug_functor<typename matrix<value_type, row_major>::reference, value_type> (), cm, e, row_major_tag ());
#else
@@ -1084,7 +1084,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename M::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
matrix<value_type, column_major> cm (m.size1 (), m.size2 ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_matrix_assign (scalar_assign<typename matrix<value_type, column_major>::reference, value_type> (), cm, m, column_major_tag ());
indexing_matrix_assign (functor1_type::template make_debug_functor<typename matrix<value_type, column_major>::reference, value_type> (), cm, e, column_major_tag ());
#else

View File

@@ -53,9 +53,7 @@ namespace boost { namespace numeric { namespace ublas {
sparse_matrix_element (matrix_type &m, size_type i, size_type j):
container_reference<matrix_type> (m), it_ (), i_ (i), j_ (j), d_ (), dirty_ (false) {
pointer it = (*this) ().find_element (i_, j_);
if (! it)
(*this) ().insert (i_, j_, d_);
else
if (it)
d_ = *it;
}
BOOST_UBLAS_INLINE
@@ -64,10 +62,14 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
~sparse_matrix_element () {
if (dirty_) {
if (! it_)
if (! it_) {
it_ = (*this) ().find_element (i_, j_);
BOOST_UBLAS_CHECK (it_, internal_logic ());
*it_ = d_;
if (! it_)
(*this) ().insert (i_, j_, d_);
else
*it_ = d_;
} else
*it_ = d_;
}
}
@@ -1394,7 +1396,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F, class A>
typename sparse_matrix<T, F, A>::value_type sparse_matrix<T, F, A>::zero_ = 0;
typename sparse_matrix<T, F, A>::value_type sparse_matrix<T, F, A>::zero_ =
sparse_matrix<T, F, A>::value_type ();
// Array based sparse matrix class
template<class T, class F, class A>
@@ -2552,7 +2555,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F, class A>
typename sparse_vector_of_sparse_vector<T, F, A>::value_type sparse_vector_of_sparse_vector<T, F, A>::zero_ = 0;
typename sparse_vector_of_sparse_vector<T, F, A>::value_type sparse_vector_of_sparse_vector<T, F, A>::zero_ =
sparse_vector_of_sparse_vector<T, F, A>::value_type ();
// Array based sparse matrix class
// Thanks to Kresimir Fresl for extending this to cover different index bases.
@@ -3861,7 +3865,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F, std::size_t IB, class IA, class TA>
typename compressed_matrix<T, F, IB, IA, TA>::value_type compressed_matrix<T, F, IB, IA, TA>::zero_ = 0;
typename compressed_matrix<T, F, IB, IA, TA>::value_type compressed_matrix<T, F, IB, IA, TA>::zero_ =
compressed_matrix<T, F, IB, IA, TA>::value_type ();
// Array based sparse matrix class
// Thanks to Kresimir Fresl for extending this to cover different index bases.
@@ -5168,7 +5173,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F, std::size_t IB, class IA, class TA>
typename coordinate_matrix<T, F, IB, IA, TA>::value_type coordinate_matrix<T, F, IB, IA, TA>::zero_ = 0;
typename coordinate_matrix<T, F, IB, IA, TA>::value_type coordinate_matrix<T, F, IB, IA, TA>::zero_ =
coordinate_matrix<T, F, IB, IA, TA>::value_type ();
}}}

View File

@@ -952,9 +952,11 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F1, class F2, class A>
typename triangular_matrix<T, F1, F2, A>::value_type triangular_matrix<T, F1, F2, A>::zero_ = 0;
typename triangular_matrix<T, F1, F2, A>::value_type triangular_matrix<T, F1, F2, A>::zero_ =
triangular_matrix<T, F1, F2, A>::value_type ();
template<class T, class F1, class F2, class A>
typename triangular_matrix<T, F1, F2, A>::value_type triangular_matrix<T, F1, F2, A>::one_ = 1;
typename triangular_matrix<T, F1, F2, A>::value_type triangular_matrix<T, F1, F2, A>::one_ =
triangular_matrix<T, F1, F2, A>::value_type (1);
// Triangular matrix adaptor class
template<class M, class F>
@@ -1879,9 +1881,11 @@ namespace boost { namespace numeric { namespace ublas {
template<class M, class F>
typename triangular_adaptor<M, F>::matrix_type triangular_adaptor<M, F>::nil_;
template<class M, class F>
typename triangular_adaptor<M, F>::value_type triangular_adaptor<M, F>::zero_ = 0;
typename triangular_adaptor<M, F>::value_type triangular_adaptor<M, F>::zero_ =
triangular_adaptor<M, F>::value_type ();
template<class M, class F>
typename triangular_adaptor<M, F>::value_type triangular_adaptor<M, F>::one_ = 1;
typename triangular_adaptor<M, F>::value_type triangular_adaptor<M, F>::one_ =
triangular_adaptor<M, F>::value_type (1);
template<class E1, class E2>
struct matrix_vector_solve_traits {

View File

@@ -794,9 +794,11 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T>
typename unit_vector<T>::value_type unit_vector<T>::zero_ = 0;
typename unit_vector<T>::value_type unit_vector<T>::zero_ =
unit_vector<T>::value_type ();
template<class T>
typename unit_vector<T>::value_type unit_vector<T>::one_ = 1;
typename unit_vector<T>::value_type unit_vector<T>::one_ =
unit_vector<T>::value_type (1);
// Zero vector class
template<class T>
@@ -1002,7 +1004,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T>
typename zero_vector<T>::value_type zero_vector<T>::zero_ = 0;
typename zero_vector<T>::value_type zero_vector<T>::zero_ =
zero_vector<T>::value_type ();
// Scalar vector class
template<class T>

View File

@@ -284,7 +284,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename V::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
vector<value_type> cv (v.size ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_vector_assign (scalar_assign<typename vector<value_type>::reference, value_type> (), cv, v);
indexing_vector_assign (functor_type::template make_debug_functor<typename vector<value_type>::reference, value_type> (), cv, e);
#else
@@ -344,7 +344,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename V::value_type value_type;
#ifdef BOOST_UBLAS_TYPE_CHECK
vector<value_type> cv (v.size ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_vector_assign (scalar_assign<typename vector<value_type>::reference, value_type> (), cv, v);
indexing_vector_assign (functor_type::template make_debug_functor<typename vector<value_type>::reference, value_type> (), cv, e);
#else
@@ -378,7 +378,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef typename V::reference reference;
#ifdef BOOST_UBLAS_TYPE_CHECK
vector<value_type> cv (v.size ());
#ifndef BOOST_MSVC
#ifndef BOOST_UBLAS_NO_ELEMENT_PROXIES
indexing_vector_assign (scalar_assign<typename vector<value_type>::reference, value_type> (), cv, v);
indexing_vector_assign (functor_type::template make_debug_functor<typename vector<value_type>::reference, value_type> (), cv, e);
#else

View File

@@ -1198,7 +1198,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class F, class A>
typename generalized_vector_of_vector<T, F, A>::value_type generalized_vector_of_vector<T, F, A>::zero_ = 0;
typename generalized_vector_of_vector<T, F, A>::value_type generalized_vector_of_vector<T, F, A>::zero_ =
generalized_vector_of_vector<T, F, A>::value_type ();
}}}

View File

@@ -52,9 +52,7 @@ namespace boost { namespace numeric { namespace ublas {
sparse_vector_element (vector_type &v, size_type i):
container_reference<vector_type> (v), it_ (), i_ (i), d_ (), dirty_ (false) {
pointer it = (*this) ().find_element (i_);
if (! it)
(*this) ().insert (i_, d_);
else
if (it)
d_ = *it;
}
BOOST_UBLAS_INLINE
@@ -63,10 +61,14 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
~sparse_vector_element () {
if (dirty_) {
if (! it_)
if (! it_) {
it_ = (*this) ().find_element (i_);
BOOST_UBLAS_CHECK (it_, internal_logic ());
*it_ = d_;
if (! it_)
(*this) ().insert (i_, d_);
else
*it_ = d_;
} else
*it_ = d_;
}
}
@@ -772,7 +774,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, class A>
typename sparse_vector<T, A>::value_type sparse_vector<T, A>::zero_ = 0;
typename sparse_vector<T, A>::value_type sparse_vector<T, A>::zero_ =
sparse_vector<T, A>::value_type ();
// Array based sparse vector class
// Thanks to Kresimir Fresl for extending this to cover different index bases.
@@ -1336,7 +1339,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, std::size_t IB, class IA, class TA>
typename compressed_vector<T, IB, IA, TA>::value_type compressed_vector<T, IB, IA, TA>::zero_ = 0;
typename compressed_vector<T, IB, IA, TA>::value_type compressed_vector<T, IB, IA, TA>::zero_ =
compressed_vector<T, IB, IA, TA>::value_type ();
// Array based sparse vector class
// Thanks to Kresimir Fresl for extending this to cover different index bases.
@@ -1931,7 +1935,8 @@ namespace boost { namespace numeric { namespace ublas {
};
template<class T, std::size_t IB, class IA, class TA>
typename coordinate_vector<T, IB, IA, TA>::value_type coordinate_vector<T, IB, IA, TA>::zero_ = 0;
typename coordinate_vector<T, IB, IA, TA>::value_type coordinate_vector<T, IB, IA, TA>::zero_ =
coordinate_vector<T, IB, IA, TA>::value_type ();
}}}