[concurrency-interest] ParallelDoubleArray and BLAS level 1
Kasper Nielsen
kasper at kav.dk
Thu Feb 28 02:27:26 EST 2008
Wow, this list is quite at the moment.
I've been working on a ParallelDoubleMatrix and in relation to that I've
tried implementing all the BLAS level 1 routines with
ParallelDoubleArray. For those unaware of what BLAS is, it is the de
facto api for performing basic linear algebra operations.
The code and comments are available here http://rafb.net/p/Mx1z2f68.html
I've omitted drotg and drotmg since they are pure math calculations.
I try to represent a vector with a ParallelDoubleArrayWithBounds because
if I have a matrix using row-major order representation I can easily
extract rows using withBounds().
Those place where I couldn't get away with using
ParallelDoubleArrayWithBounds I've used a ParallelDoubleArray.
It was primarily because I had to swap transformed elements between two
arrays. Some better methods for this would be nice.
There was only 1 operation I had to implement sequential 'idamax' which
returns the minimum index having the maximum absolute value.
All the BLAS routines takes an increment as an argument. This increment
argument indicates the number of spaces in the array between elements.
This is not possible with ParallelDoubleArray. So I've omitted it.
One way to support it would be to create a .withIncrement(int index, int
increment) method.
Considering this row-level ordered matrix:
0 1 2
3 4 5
6 7 8
withIncrement(0,3), would select the first row,
withIncrement(1,3), would select the second row,
withIncrement(0,4), would select the diagonal.
withBounds(0,5).withIncrement(1,4) would select the diagonal 1+5
but of course if we add this, next time I would want some way to select
a bounded box in an array. So I'll probably end up with implementing
this myself in my Matrix library.
cheers
Kasper
More information about the Concurrency-interest
mailing list