On Tue, Aug 18, 2009 at 11:12 AM, Rutger ter Borg <rutger@terborg.net> wrote:
Karl Meerbergen wrote:

after all these discussions... what about if I would start stopping
reinventing the wheel, and use GLAS as a high-level "engine" for the
bindings? I see BLAS/LAPACK support is there but not as complete as it could
be. Could you bring me up to speed w.r.t. the expression engine of GLAS?

(The following is a plea to extend the existing ublas.  I am trying to focus on economics research and keep finding myself implementing basics... I imagine many people doing scientific computing are in the same boat).

GLAS would be great, and is a possible front-end to UBLAS in the future.  But it isn't deployed or in boost yet.

The discussion on boost developer and here make it pretty clear that an immediate, temporary fix would be extremely useful (and hopefully help focus the efforts of other people on extending instead of replacing).  I really think that a little bit of effort on Matlab'ing UBLAS could go a long way.  Then the longer term approach can be evaluated.

As much as I love the bindings, some of these might be of higher importance to pound through.  It seems that the ublas interface hasn't changed much since 2002ish, so it probably is time.

I have spent a lot of time using ublas in the last year and trying to get Matlab programmers to use it.  From my experience, the following is a list of the things that would really help people out in order of importance (I have tried to remove all features dependent on external libraries).

1. Operator *
2. Data Adaptors for C/Fortran
3. Some temporary solution to the assignment of fixed matrices.
using namespace boost::assign;
matrix<double> A(2,2);
A += 1, 2,
        2, 1;

4. Matrix/Vector Stacking
e.g.
matrix<double> A, B;
vector<double> a, b;

matrix<double> C = stack_vertical(A, B);
auto Cp = stack_vertical(A, B); //This is lazy.  The Cp expression has done no copying.
matrix<double> C = stack_horizontal(a, b);

//or with overloaded operators, something like:
matrix<double C = A & B; //Horizontal
matrix<double C = A & B |
                            B & A; //Stacks like [A B; B A] in matlab.

//or could have some kinds of tags to denote newlines:
matrix<double> C = stack(A, B);
auto Cp = stack(A, matrix::newline, B); //This is lazy.  The Cp expression has done no copying.
matrix<double> C= stack(A, matrix::newline, B); //This is lazy.  The Cp expression has done no copying.


Interoperability with boost::multi_array
boost::multi_array<double, 3> covariances(boost::extents[2[[2][10]); //10 covariance matrices over time.

//Fill in these covariances over time...
boost::matrix<double> A, B;
....
covariances[boost::indices[range(0,2)][range(0,2)][0] ] = A * B; //Matrix multiplication and assign to 0'th time period...

//And
boost::matrix<double> C;
cout << 2 * C * covariances[1]; //This gets the 1'th slice along the multi_array....


6. A couple of simple linear algebra operations
7. Move Semantics
matrix<double> A_inv = inv(A);

It appears that Kian Ming has already done much of this work.  Are there people who are competent enough to merge these sorts of changes into a future ublas version?