Answering myself,
without a symmetric type I can just check for a diagonal matrix inside the
pinv function and branch, see code below.
Are there some recommendations for namespaces for functions like "pinv" ?
Inside the loop, shall I use size_type?
Thx for your patience,
Patrick
template <class T>
boost::numeric::ublas::banded_matrix<T> pinv(const
boost::numeric::ublas::banded_matrix<T>& m)
{
if (m.lower()==0 && m.upper()==0) // just for reading
{
boost::numeric::ublas::banded_matrix<T> rm(m.size2(),m.size1());
for (size_t i=0;i
Dear all,
I can use a banded_matrix to represent a diagonal matrix, but while some math for a diagonal matrix is a little bit easier than for a rectangular matrix, it would be nice to have such a type.
In my case:
I use a SVD A = U * S * V.T to calculate the moore-penrose-inverse A+.
Therfore I use A+ = V * S+ * U.T (i do not remember exact, but focus on S+) with S+ as the moore-penrose-inverse of S which is very easy to calculate.
but to use something like pinv(S) , do I need a symmetric_matrix type? Or can I implement a pinv() for a banded_matrix wich must fulfil the constraint of being diagonal?
Thanks a lot Patrick
Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/