From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2002-07-10 08:28:23
Recently I adviced using uBLAS to our Linear Algebra experts who have been
working mostly in f77, fortran90 and Matlab. And although pleased with the
functionality of uBLAS, we learned that probably a weak point is the
notation. To make it easier on people in mathematics, we probably should try
to support an interface that resembles that of matlab (which _is_ the
So here are his comments :
---------- Forwarded Message ----------
First of all I want to congratulate with your contribution. This is great
work and I expect many people will use the templates. Though, I have one
major question, that was raised when a colleague and I started to use ublas.
We find its use fairly complicated and believe that it can be simplified (I
give examples further). Simplification is very important, since we do not
believe that mathematicians are very keen using very long expressions for
mathematically simple expressions, that can be expressed very briefly in
matlab, fortran 90 and even fortran 77.
My major concerns is about ranges (matrix and vector).
The code really becomes unreadable when expressions are getting complicated.
Suppose I want to compute (in Matlab notation)
A(1:3,5:6) = B(5:6,1:10)' * C(10:19,1:2)
In fortran 90 this would become
A(1:3,5:6) = matmul(conjg(transpose(B(5:6,1:10))), C(10:19,1:2) )
I can do the following in ublas:
typedef matrix<double, column_major> MType;
typedef matrix_range<MType> MRType;
MRType(A, range(0,3), range(4,6)).assign( prod( MRType(B, range(4,6),
range(0,10)), MRType(C, range(9,19), range(0,2))));
This could become simpler by avoiding the need to define the MRType, for
example as follows:
A(range(0,3), range(4,6)).assign( prod( B(range(4,6),range(0,10)),
This is still a simple expression, but I guess you see the advantages for
longer expressions. In addition, there is no need to explicitly add the range
types of A, B and C. The compiler does it for you.
Another suggestion to make life simpler, is to define range() or norange()
to indicate the full scope of the range, for example
A(range(0,2), norange()) is then equivalent to
A row can be selected as A(2, norange()) and a column as A(norange(), 3). A
vector_range of a row is then A(2, range(2,4)), etc.
May I ask you to take these suggestions seriously: they may make ublas more
This suggestion will indeed make it easier and is easy to implement. IIRC
this way of working was supported initially but deprecated because
dependencies between the different include files have been reduced.
(please reply to _all_ since Karl is not subscribed)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk