2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-28 05:42:14 +00:00

This patch now lets the Sun compiler work for most of uBLAS. 'test4' is now failing.

Too avoid other compilers complaining about missing return values in some functions where exceptions are thrown, code was added so an arbitatry were chosen.
This commit is contained in:
Gunter Winkler
2007-11-15 20:52:37 +00:00
parent 03cae389ab
commit 24f9934c73
3 changed files with 25 additions and 38 deletions

View File

@@ -175,21 +175,24 @@ namespace boost { namespace numeric { namespace ublas {
#ifdef BOOST_UBLAS_OWN_BANDED
const size_type k = (std::max) (i, j);
const size_type l = lower_ + j - i;
if (k < (std::max) (size1_, size2_) &&
l < lower_ + 1 + upper_)
return data () [layout_type::element (k, (std::max) (size1_, size2_),
if (! (k < (std::max) (size1_, size2_) &&
l < lower_ + 1 + upper_) ) {
bad_index ().raise ();
// NEVER reached
}
return data () [layout_type::element (k, (std::max) (size1_, size2_),
l, lower_ + 1 + upper_)];
#else
const size_type k = j;
const size_type l = upper_ + i - j;
if (k < size2_ &&
l < lower_ + 1 + upper_)
return data () [layout_type::element (k, size2_,
if (! (k < size2_ &&
l < lower_ + 1 + upper_) ) {
bad_index ().raise ();
// NEVER reached
}
return data () [layout_type::element (k, size2_,
l, lower_ + 1 + upper_)];
#endif
bad_index ().raise ();
// arbitary return value
return const_cast<reference>(zero_);
}
// Element assignment

View File

@@ -354,13 +354,11 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
reference operator () (size_type i, size_type j) {
#ifndef BOOST_UBLAS_STRICT_HERMITIAN
if (triangular_type::other (i, j))
return at_element (i, j);
else {
external_logic ().raise ();
// arbitary return value
return data () [triangular_type::element (layout_type (), j, size_, i, size_)];
if (!triangular_type::other (i, j)) {
bad_index ().raise ();
// NEVER reached
}
return at_element (i, j);
#else
if (triangular_type::other (i, j))
return reference (*this, i, j, data () [triangular_type::element (layout_type (), i, size_, j, size_)]);

View File

@@ -173,13 +173,11 @@ namespace boost { namespace numeric { namespace ublas {
reference operator () (size_type i, size_type j) {
BOOST_UBLAS_CHECK (i < size1_, bad_index ());
BOOST_UBLAS_CHECK (j < size2_, bad_index ());
if (triangular_type::other (i, j))
return data () [triangular_type::element (layout_type (), i, size1_, j, size2_)];
else {
if (!triangular_type::other (i, j)) {
bad_index ().raise ();
// arbitary return value
return const_cast<reference>(zero_);
// NEVER reached
}
return data () [triangular_type::element (layout_type (), i, size1_, j, size2_)];
}
// Element assignment
@@ -1019,34 +1017,22 @@ namespace boost { namespace numeric { namespace ublas {
reference operator () (size_type i, size_type j) {
BOOST_UBLAS_CHECK (i < size1 (), bad_index ());
BOOST_UBLAS_CHECK (j < size2 (), bad_index ());
if (triangular_type::other (i, j))
return data () (i, j);
else if (triangular_type::one (i, j)) {
if (!triangular_type::other (i, j)) {
bad_index ().raise ();
// arbitary return value
return const_cast<reference>(one_);
} else {
bad_index ().raise ();
// arbitary return value
return const_cast<reference>(zero_);
// NEVER reached
}
return data () (i, j);
}
#else
BOOST_UBLAS_INLINE
reference operator () (size_type i, size_type j) const {
BOOST_UBLAS_CHECK (i < size1 (), bad_index ());
BOOST_UBLAS_CHECK (j < size2 (), bad_index ());
if (triangular_type::other (i, j))
return data () (i, j);
else if (triangular_type::one (i, j)) {
if (!triangular_type::other (i, j)) {
bad_index ().raise ();
// arbitary return value
return const_cast<reference>(one_);
} else {
bad_index ().raise ();
// arbitary return value
return const_cast<reference>(zero_);
// NEVER reached
}
return data () (i, j);
}
#endif