Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-08-24 06:37:31


Hello,

what is the best way to fill a triangular matrix with a constant value?
Should I use a dense rhs and rely on the fact that the assign knows the
structure, or should I give a rhs with the correct structure?

(IMHO the second is better, but uBLAS currently supports both.)

triangular_matrix<double, lower> A(n,n);
A = scalar_matrix<double>(n,n, 1.0);
A = triangular( scalar_matrix<double>(n,n, 1.0), lower());

mfg
Gunter

---8x-----

Should we add this to triangular.hpp?

/** \brief make a immutable triangular adaptor from a matrix
 *
 * \usage
<code>
 A = triangular< lower >(B);
 A = triangular(B, lower());
</code>
 */
template < class TYPE, class MATRIX >
ublas::triangular_adaptor<const MATRIX, TYPE>
triangular(const MATRIX & A, const TYPE& uplo = TYPE())
{
  return ublas::triangular_adaptor<const MATRIX, TYPE>(A);
}