mirror of
https://github.com/boostorg/ublas.git
synced 2026-02-07 11:02:08 +00:00
Fixed most tab and min/max issues from trunk inspection report
svn path=/trunk/boost/numeric/ublas/; revision=53141
This commit is contained in:
@@ -446,7 +446,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
size_type size (e ().size ());
|
||||
for (size_type i = 0; i < size; ++ i) {
|
||||
real_type u (type_traits<value_type>::norm_2 (e () (i)));
|
||||
if ( real_type () /* zero */ == u ) continue;
|
||||
if ( real_type () /* zero */ == u ) continue;
|
||||
if (scale < u) {
|
||||
real_type v (scale / u);
|
||||
sum_squares = sum_squares * v * v + real_type (1);
|
||||
@@ -1727,7 +1727,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
bool other (size_type /* i */, size_type /* j */) {
|
||||
return true;
|
||||
}
|
||||
// FIXME: this should not be used at all
|
||||
// FIXME: this should not be used at all
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict1 (size_type i, size_type j) {
|
||||
@@ -1751,81 +1751,81 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template < class L >
|
||||
struct transposed_structure {
|
||||
typedef typename L::size_type size_type;
|
||||
template < class L >
|
||||
struct transposed_structure {
|
||||
typedef typename L::size_type size_type;
|
||||
|
||||
template<class LAYOUT>
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type packed_size (LAYOUT l, size_type size_i, size_type size_j) {
|
||||
return L::packed_size(l, size_j, size_i);
|
||||
}
|
||||
template<class LAYOUT>
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type packed_size (LAYOUT l, size_type size_i, size_type size_j) {
|
||||
return L::packed_size(l, size_j, size_i);
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool zero (size_type i, size_type j) {
|
||||
return L::zero(j, i);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool one (size_type i, size_type j) {
|
||||
return L::one(j, i);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool other (size_type i, size_type j) {
|
||||
return L::other(j, i);
|
||||
}
|
||||
template<class LAYOUT>
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type element (LAYOUT l, size_type i, size_type size_i, size_type j, size_type size_j) {
|
||||
return L::element(typename LAYOUT::transposed_layout(), j, size_j, i, size_i);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool zero (size_type i, size_type j) {
|
||||
return L::zero(j, i);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool one (size_type i, size_type j) {
|
||||
return L::one(j, i);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool other (size_type i, size_type j) {
|
||||
return L::other(j, i);
|
||||
}
|
||||
template<class LAYOUT>
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type element (LAYOUT l, size_type i, size_type size_i, size_type j, size_type size_j) {
|
||||
return L::element(typename LAYOUT::transposed_layout(), j, size_j, i, size_i);
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::restrict2(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict2 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::restrict1(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type mutable_restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::mutable_restrict2(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type mutable_restrict2 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::mutable_restrict1(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::restrict2(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict2 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::restrict1(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type mutable_restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::mutable_restrict2(j, i, size2, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type mutable_restrict2 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return L::mutable_restrict1(j, i, size2, size1);
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_restrict2(index2, size2, index1, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_restrict1(index2, size2, index1, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_mutable_restrict2(index2, size2, index1, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_mutable_restrict1(index2, size2, index1, size1);
|
||||
}
|
||||
};
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_restrict2(index2, size2, index1, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_restrict1(index2, size2, index1, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_mutable_restrict2(index2, size2, index1, size1);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return L::global_mutable_restrict1(index2, size2, index1, size1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class Z>
|
||||
@@ -1862,56 +1862,56 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
return L::lower_element (i, size_i, j, size_j);
|
||||
}
|
||||
|
||||
// return nearest valid index in column j
|
||||
// return nearest valid index in column j
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return (std::max)(j, (std::min) (size1, i));
|
||||
}
|
||||
// return nearest valid index in row i
|
||||
// return nearest valid index in row i
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict2 (size_type i, size_type j, size_type /* size1 */, size_type /* size2 */) {
|
||||
return (std::max)(size_type(0), (std::min) (i+1, j));
|
||||
}
|
||||
// return nearest valid mutable index in column j
|
||||
// return nearest valid mutable index in column j
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type mutable_restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return (std::max)(j, (std::min) (size1, i));
|
||||
}
|
||||
// return nearest valid mutable index in row i
|
||||
// return nearest valid mutable index in row i
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type mutable_restrict2 (size_type i, size_type j, size_type /* size1 */, size_type /* size2 */) {
|
||||
return (std::max)(size_type(0), (std::min) (i+1, j));
|
||||
}
|
||||
|
||||
// return an index between the first and (1+last) filled row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size1, index1) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size2, index2) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size1, index1) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size2, index2) );
|
||||
}
|
||||
|
||||
// return an index between the first and (1+last) filled mutable row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size1, index1) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled mutable column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size2, index2) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled mutable row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size1, index1) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled mutable column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(0), (std::min)(size2, index2) );
|
||||
}
|
||||
};
|
||||
|
||||
// the first row only contains a single 1. Thus it is not stored.
|
||||
@@ -1959,19 +1959,19 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
return (std::max)(size_type(0), (std::min) (i, j));
|
||||
}
|
||||
|
||||
// return an index between the first and (1+last) filled mutable row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(1), (std::min)(size1, index1) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled mutable column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
BOOST_UBLAS_CHECK( size2 >= 1 , external_logic() );
|
||||
return (std::max)(size_type(0), (std::min)(size2-1, index2) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled mutable row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return (std::max)(size_type(1), (std::min)(size1, index1) );
|
||||
}
|
||||
// return an index between the first and (1+last) filled mutable column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_mutable_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
BOOST_UBLAS_CHECK( size2 >= 1 , external_logic() );
|
||||
return (std::max)(size_type(0), (std::min)(size2-1, index2) );
|
||||
}
|
||||
};
|
||||
|
||||
// the first row only contains no element. Thus it is not stored.
|
||||
@@ -2016,26 +2016,26 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return mutable_restrict1(i, j, size1, size2);
|
||||
return mutable_restrict1(i, j, size1, size2);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type restrict2 (size_type i, size_type j, size_type size1, size_type size2) {
|
||||
return mutable_restrict2(i, j, size1, size2);
|
||||
return mutable_restrict2(i, j, size1, size2);
|
||||
}
|
||||
|
||||
// return an index between the first and (1+last) filled row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return global_mutable_restrict1(index1, size1, index2, size2);
|
||||
}
|
||||
// return an index between the first and (1+last) filled column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return global_mutable_restrict2(index1, size1, index2, size2);
|
||||
}
|
||||
// return an index between the first and (1+last) filled row
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return global_mutable_restrict1(index1, size1, index2, size2);
|
||||
}
|
||||
// return an index between the first and (1+last) filled column
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) {
|
||||
return global_mutable_restrict2(index1, size1, index2, size2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -296,32 +296,32 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
const_iterator1 find1 (int rank, size_type i, size_type j) const {
|
||||
if (rank == 1)
|
||||
i = triangular_type::restrict1 (i, j, size1_, size2_);
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_restrict1 (i, size1_, j, size2_);
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_restrict1 (i, size1_, j, size2_);
|
||||
return const_iterator1 (*this, i, j);
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator1 find1 (int rank, size_type i, size_type j) {
|
||||
if (rank == 1)
|
||||
i = triangular_type::mutable_restrict1 (i, j, size1_, size2_);
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_mutable_restrict1 (i, size1_, j, size2_);
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_mutable_restrict1 (i, size1_, j, size2_);
|
||||
return iterator1 (*this, i, j);
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator2 find2 (int rank, size_type i, size_type j) const {
|
||||
if (rank == 1)
|
||||
j = triangular_type::restrict2 (i, j, size1_, size2_);
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_restrict2 (i, size1_, j, size2_);
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_restrict2 (i, size1_, j, size2_);
|
||||
return const_iterator2 (*this, i, j);
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator2 find2 (int rank, size_type i, size_type j) {
|
||||
if (rank == 1)
|
||||
j = triangular_type::mutable_restrict2 (i, j, size1_, size2_);
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_mutable_restrict2 (i, size1_, j, size2_);
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_mutable_restrict2 (i, size1_, j, size2_);
|
||||
return iterator2 (*this, i, j);
|
||||
}
|
||||
|
||||
@@ -1153,34 +1153,34 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator1 find1 (int rank, size_type i, size_type j) const {
|
||||
if (rank == 1)
|
||||
i = triangular_type::restrict1 (i, j, size1(), size2());
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_restrict1 (i, size1(), j, size2());
|
||||
return const_iterator1 (*this, data ().find1 (rank, i, j));
|
||||
i = triangular_type::restrict1 (i, j, size1(), size2());
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_restrict1 (i, size1(), j, size2());
|
||||
return const_iterator1 (*this, data ().find1 (rank, i, j));
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator1 find1 (int rank, size_type i, size_type j) {
|
||||
if (rank == 1)
|
||||
i = triangular_type::mutable_restrict1 (i, j, size1(), size2());
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_mutable_restrict1 (i, size1(), j, size2());
|
||||
return iterator1 (*this, data ().find1 (rank, i, j));
|
||||
if (rank == 0)
|
||||
i = triangular_type::global_mutable_restrict1 (i, size1(), j, size2());
|
||||
return iterator1 (*this, data ().find1 (rank, i, j));
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator2 find2 (int rank, size_type i, size_type j) const {
|
||||
if (rank == 1)
|
||||
j = triangular_type::restrict2 (i, j, size1(), size2());
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_restrict2 (i, size1(), j, size2());
|
||||
return const_iterator2 (*this, data ().find2 (rank, i, j));
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_restrict2 (i, size1(), j, size2());
|
||||
return const_iterator2 (*this, data ().find2 (rank, i, j));
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator2 find2 (int rank, size_type i, size_type j) {
|
||||
if (rank == 1)
|
||||
j = triangular_type::mutable_restrict2 (i, j, size1(), size2());
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_mutable_restrict2 (i, size1(), j, size2());
|
||||
return iterator2 (*this, data ().find2 (rank, i, j));
|
||||
if (rank == 0)
|
||||
j = triangular_type::global_mutable_restrict2 (i, size1(), j, size2());
|
||||
return iterator2 (*this, data ().find2 (rank, i, j));
|
||||
}
|
||||
|
||||
// Iterators simply are indices.
|
||||
|
||||
@@ -14,126 +14,126 @@ namespace ublas = boost::numeric::ublas;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int sz = 4;
|
||||
ublas::symmetric_matrix<int, ublas::upper, ublas::column_major> UpCol (sz, sz);
|
||||
ublas::symmetric_matrix<int, ublas::upper, ublas::row_major> UpRow (sz, sz);
|
||||
ublas::symmetric_matrix<int, ublas::lower, ublas::column_major> LoCol (sz, sz);
|
||||
ublas::symmetric_matrix<int, ublas::lower, ublas::row_major> LoRow (sz, sz);
|
||||
int sz = 4;
|
||||
ublas::symmetric_matrix<int, ublas::upper, ublas::column_major> UpCol (sz, sz);
|
||||
ublas::symmetric_matrix<int, ublas::upper, ublas::row_major> UpRow (sz, sz);
|
||||
ublas::symmetric_matrix<int, ublas::lower, ublas::column_major> LoCol (sz, sz);
|
||||
ublas::symmetric_matrix<int, ublas::lower, ublas::row_major> LoRow (sz, sz);
|
||||
|
||||
ublas::triangular_matrix<int, ublas::upper, ublas::column_major> TrUpCol (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::upper, ublas::row_major> TrUpRow (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::lower, ublas::column_major> TrLoCol (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::lower, ublas::row_major> TrLoRow (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::upper, ublas::column_major> TrUpCol (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::upper, ublas::row_major> TrUpRow (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::lower, ublas::column_major> TrLoCol (sz, sz);
|
||||
ublas::triangular_matrix<int, ublas::lower, ublas::row_major> TrLoRow (sz, sz);
|
||||
|
||||
for(int i=0; i<sz; ++i)
|
||||
for(int j=i; j<sz; ++j)
|
||||
{
|
||||
// Symmetric
|
||||
UpCol(i,j) = 10*i + j;
|
||||
UpRow(i,j) = 10*i + j;
|
||||
LoCol(i,j) = 10*i + j;
|
||||
LoRow(i,j) = 10*i + j;
|
||||
// Triangular
|
||||
TrUpCol(i,j) = 10*i + j;
|
||||
TrUpRow(i,j) = 10*i + j;
|
||||
TrLoCol(j,i) = 10*i + j;
|
||||
TrLoRow(j,i) = 10*i + j;
|
||||
}
|
||||
for(int i=0; i<sz; ++i)
|
||||
for(int j=i; j<sz; ++j)
|
||||
{
|
||||
// Symmetric
|
||||
UpCol(i,j) = 10*i + j;
|
||||
UpRow(i,j) = 10*i + j;
|
||||
LoCol(i,j) = 10*i + j;
|
||||
LoRow(i,j) = 10*i + j;
|
||||
// Triangular
|
||||
TrUpCol(i,j) = 10*i + j;
|
||||
TrUpRow(i,j) = 10*i + j;
|
||||
TrLoCol(j,i) = 10*i + j;
|
||||
TrLoRow(j,i) = 10*i + j;
|
||||
}
|
||||
|
||||
//get pointers to data
|
||||
int* uc = &(UpCol.data()[0]);
|
||||
int* ur = &(UpRow.data()[0]);
|
||||
int* lc = &(LoCol.data()[0]);
|
||||
int* lr = &(LoRow.data()[0]);
|
||||
int* tuc = &(TrUpCol.data()[0]);
|
||||
int* tur = &(TrUpRow.data()[0]);
|
||||
int* tlc = &(TrLoCol.data()[0]);
|
||||
int* tlr = &(TrLoRow.data()[0]);
|
||||
//get pointers to data
|
||||
int* uc = &(UpCol.data()[0]);
|
||||
int* ur = &(UpRow.data()[0]);
|
||||
int* lc = &(LoCol.data()[0]);
|
||||
int* lr = &(LoRow.data()[0]);
|
||||
int* tuc = &(TrUpCol.data()[0]);
|
||||
int* tur = &(TrUpRow.data()[0]);
|
||||
int* tlc = &(TrLoCol.data()[0]);
|
||||
int* tlr = &(TrLoRow.data()[0]);
|
||||
|
||||
// upper, column_major
|
||||
// storage should be: 0 1 11 2 12 22 3 13 23 33
|
||||
int uc_correct[] = {0, 1, 11, 2, 12, 22, 3, 13, 23, 33};
|
||||
// upper, column_major
|
||||
// storage should be: 0 1 11 2 12 22 3 13 23 33
|
||||
int uc_correct[] = {0, 1, 11, 2, 12, 22, 3, 13, 23, 33};
|
||||
|
||||
// upper, row_major
|
||||
// storage should be: 0 1 2 3 11 12 13 22 23 33
|
||||
int ur_correct[] = {0, 1, 2, 3, 11, 12, 13, 22, 23, 33};
|
||||
// upper, row_major
|
||||
// storage should be: 0 1 2 3 11 12 13 22 23 33
|
||||
int ur_correct[] = {0, 1, 2, 3, 11, 12, 13, 22, 23, 33};
|
||||
|
||||
// lower, column_major
|
||||
// storage should be: 0 1 2 3 11 12 13 22 23 33
|
||||
int lc_correct[] = {0, 1, 2, 3, 11, 12, 13, 22, 23, 33};
|
||||
// lower, column_major
|
||||
// storage should be: 0 1 2 3 11 12 13 22 23 33
|
||||
int lc_correct[] = {0, 1, 2, 3, 11, 12, 13, 22, 23, 33};
|
||||
|
||||
// lower, row_major
|
||||
// storage should be: 0 1 11 2 12 22 3 13 23 33
|
||||
int lr_correct[] = {0, 1, 11, 2, 12, 22, 3, 13, 23, 33};
|
||||
// lower, row_major
|
||||
// storage should be: 0 1 11 2 12 22 3 13 23 33
|
||||
int lr_correct[] = {0, 1, 11, 2, 12, 22, 3, 13, 23, 33};
|
||||
|
||||
bool success = true;
|
||||
|
||||
// Test Symmetric
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(uc[i] != uc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Upper, Column major)" << endl;
|
||||
// Test Symmetric
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(uc[i] != uc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Upper, Column major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(ur[i] != ur_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Upper, Row major)" << endl;
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(ur[i] != ur_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Upper, Row major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(lc[i] != lc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Lower, Column major)" << endl;
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(lc[i] != lc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Lower, Column major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(lr[i] != lr_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Lower, Row major)" << endl;
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(lr[i] != lr_correct[i])
|
||||
{
|
||||
cout << "Storage error (Symmetric, Lower, Row major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Test Triangular
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tuc[i] != uc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Upper, Column major)" << endl;
|
||||
// Test Triangular
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tuc[i] != uc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Upper, Column major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tur[i] != ur_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Upper, Row major)" << endl;
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tur[i] != ur_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Upper, Row major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tlc[i] != lc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Lower, Column major)" << endl;
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tlc[i] != lc_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Lower, Column major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tlr[i] != lr_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Lower, Row major)" << endl;
|
||||
for(int i=0; i<sz*(sz+1)/2; ++i)
|
||||
if(tlr[i] != lr_correct[i])
|
||||
{
|
||||
cout << "Storage error (Triangular, Lower, Row major)" << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (success)?boost::exit_success:boost::exit_failure;
|
||||
|
||||
return (success)?boost::exit_success:boost::exit_failure;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user