Boost logo

Ublas :

Subject: Re: [ublas] Anybody still there?
From: Sean Reilly (campreilly_at_[hidden])
Date: 2012-02-01 11:03:26

Good to see. It's a nice product.

My interests are more along the lines of extending uBLAS for
vectorized scientific computations. A idea similar to the conceptual
framework that Matlab provides, but in a way that takes full advantage
of C++ expression templates. My take is that this mostly requires an
extension of the basic vector/matrix expression:

- scalar addition: vector +/- scalar, scalar +/- vector
- division of scalar by vector
- limiting functions: max(), min(), floor(), ceil()
- algebraic functions: abs(), abs2(), arg(), sqrt(), copysign()
- trigonometric functions: cos(), cosh(), sin(), sinh(), tan(), tanh()
- inverse trig functions: acos(), acosh(), asin(), asinh(), atan(),
atan2(), atanh()
- exponential functions: exp(), log(), log10(), pow()

So that I can do things like the great circle distance of a collection
of points from an origin (see

   boost::numeric::ublas::vector<double> d, lat, lng ;
   double lat0, lng0 ;
      ... fill in values ...
   d = 2.0 * asin( sqrt( abs2(
      sin( 0.5*(lat-lat0) ) + cos(lat) * cos(lat0) * abs2( sin(
0.5*(lon-lon0)) ) )
   ) ) ) ;

It seems to me that uBLAS should do a pretty good job of optimizing
this operation, even though it has very little to do with
matrix/vector mathematics.

Question: Why do you include support for multiplication of a
vector/matrix by a scalar, but not addition?

Question: Do you know of a way to overload operator*() to perform the
same function as element_prod()? Basically, and equivalent to the
Matlab operation ".*". Note how "messy" cosine terms in the equation
above becomes when you have to use element_prod() all of the time.
I've tried specializing the existing the implementation of (t * v) [i]
= t * v [i], but I keep screwing it up.

Sean Reilly

On Wed, Feb 1, 2012 at 10:29 AM, David Bellot <david.bellot_at_[hidden]> wrote:
> There has been a few changes and documentation written in fact. A few new
> algorithms has been added like the assignment operators.
> It is actively maintained even if in it's current state there is not a lot
> to do.
> In fact, I'm seriously thinking at ...
> <flame wars>
> - changing the core library to make it able to be faster, introduce new
> algorithms, and auto-vectorization
> - removing the vector class in favor of a unique matrix class (and vector
> would simply be a one-column matrix). That would allow us to simply
> represent column and row vector and unify the computation engine
> - be faster than eigen and armadillo: ok that one is gonna be pretty hard
> :-D
> </flame wars>
> Meanwhile, I'm slowly improving little things... Fortunately, I have been
> using ublas for my job for the last few years.
> But for sure, it needs more love.
> On Wed, Feb 1, 2012 at 15:15, Sean Reilly <campreilly_at_[hidden]> wrote:
>> I'm using uBLAS for a big project, and just wanted to see if it is
>> still being actively maintained.  It doesn't seem like there have been
>> many changes in the last few years.
>> Sean Reilly
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> Sent to: david.bellot_at_[hidden]
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> Sent to: campreilly_at_[hidden]