|
Colt 1.2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cern.colt.matrix.linalg.SmpBlas
Parallel implementation of the Basic Linear Algebra System for symmetric multi processing boxes. Currently only a few algorithms are parallelised; the others are fully functional, but run in sequential mode. Parallelised are:
dgemm
(matrix-matrix multiplication)dgemv
(matrix-vector multiplication)assign(A,function)
(generalized matrix scaling/transform): Strong speedup only for expensive functions like logarithm, sin, etc.assign(A,B,function)
(generalized matrix scaling/transform): Strong speedup only for expensive functions like pow etc.allocateBlas(int, cern.colt.matrix.linalg.Blas)
at the very beginning of your program, supplying the main parameter for SmpBlas, the number of available CPUs.
The method sets the public global variable SmpBlas.smpBlas to a blas using a maximum of CPUs threads, each concurrently processing matrix blocks with the given sequential blas algorithms.
Normally there is no need to call allocateBlas more than once.
Then use SmpBlas.smpBlas.someRoutine(...) to run someRoutine in parallel.
E.g.
int cpu_s = 4; SmpBlas.allocateBlas(cpu_s, SeqBlas.seqBlas); ... SmpBlas.smpBlas.dgemm(...) SmpBlas.smpBlas.dgemv(...) |
EDU.oswego.cs.dl.util.concurrent
) built upon Java threads, and geared for parallel computation.
FJTaskRunnerGroup
,
FJTask
Field Summary | |
static Blas |
smpBlas
The public global parallel blas; initialized via allocateBlas(int, cern.colt.matrix.linalg.Blas) . |
Method Summary | |
static void |
allocateBlas(int maxThreads,
Blas seqBlas)
Sets the public global variable SmpBlas.smpBlas to a blas using a maximum of maxThreads threads, each executing the given sequential algorithm; maxThreads is normally the number of CPUs. |
void |
assign(DoubleMatrix2D A,
DoubleFunction function)
Assigns the result of a function to each cell; x[row,col] = function(x[row,col]). |
void |
assign(DoubleMatrix2D A,
DoubleMatrix2D B,
DoubleDoubleFunction function)
Assigns the result of a function to each cell; x[row,col] = function(x[row,col],y[row,col]). |
double |
dasum(DoubleMatrix1D x)
Returns the sum of absolute values; |x[0]| + |x[1]| + ... |
void |
daxpy(double alpha,
DoubleMatrix1D x,
DoubleMatrix1D y)
Combined vector scaling; y = y + alpha*x. |
void |
daxpy(double alpha,
DoubleMatrix2D A,
DoubleMatrix2D B)
Combined matrix scaling; B = B + alpha*A. |
void |
dcopy(DoubleMatrix1D x,
DoubleMatrix1D y)
Vector assignment (copying); y = x. |
void |
dcopy(DoubleMatrix2D A,
DoubleMatrix2D B)
Matrix assignment (copying); B = A. |
double |
ddot(DoubleMatrix1D x,
DoubleMatrix1D y)
Returns the dot product of two vectors x and y, which is Sum(x[i]*y[i]). |
void |
dgemm(boolean transposeA,
boolean transposeB,
double alpha,
DoubleMatrix2D A,
DoubleMatrix2D B,
double beta,
DoubleMatrix2D C)
Generalized linear algebraic matrix-matrix multiply; C = alpha*A*B + beta*C. |
void |
dgemv(boolean transposeA,
double alpha,
DoubleMatrix2D A,
DoubleMatrix1D x,
double beta,
DoubleMatrix1D y)
Generalized linear algebraic matrix-vector multiply; y = alpha*A*x + beta*y. |
void |
dger(double alpha,
DoubleMatrix1D x,
DoubleMatrix1D y,
DoubleMatrix2D A)
Performs a rank 1 update; A = A + alpha*x*y'. |
double |
dnrm2(DoubleMatrix1D x)
Return the 2-norm; sqrt(x[0]^2 + x[1]^2 + ...). |
void |
drot(DoubleMatrix1D x,
DoubleMatrix1D y,
double c,
double s)
Applies a givens plane rotation to (x,y); x = c*x + s*y; y = c*y - s*x. |
void |
drotg(double a,
double b,
double[] rotvec)
Constructs a Givens plane rotation for (a,b). |
void |
dscal(double alpha,
DoubleMatrix1D x)
Vector scaling; x = alpha*x. |
void |
dscal(double alpha,
DoubleMatrix2D A)
Matrix scaling; A = alpha*A. |
void |
dswap(DoubleMatrix1D x,
DoubleMatrix1D y)
Swaps the elements of two vectors; y <==> x. |
void |
dswap(DoubleMatrix2D A,
DoubleMatrix2D B)
Swaps the elements of two matrices; B <==> A. |
void |
dsymv(boolean isUpperTriangular,
double alpha,
DoubleMatrix2D A,
DoubleMatrix1D x,
double beta,
DoubleMatrix1D y)
Symmetric matrix-vector multiplication; y = alpha*A*x + beta*y. |
void |
dtrmv(boolean isUpperTriangular,
boolean transposeA,
boolean isUnitTriangular,
DoubleMatrix2D A,
DoubleMatrix1D x)
Triangular matrix-vector multiplication; x = A*x or x = A'*x. |
int |
idamax(DoubleMatrix1D x)
Returns the index of largest absolute value; i such that |x[i]| == max(|x[0]|,|x[1]|,...).. |
void |
stats()
Prints various snapshot statistics to System.out; Simply delegates to FJTaskRunnerGroup.stats() . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static Blas smpBlas
allocateBlas(int, cern.colt.matrix.linalg.Blas)
.
Do not modify this variable via other means (it is public).
Method Detail |
public static void allocateBlas(int maxThreads, Blas seqBlas)
maxThreads
- the maximum number of threads (= CPUs) to be usedseqBlas
- the sequential blas algorithms to be used on concurrently processed matrix blocks.public void assign(DoubleMatrix2D A, DoubleFunction function)
Blas
assign
in interface Blas
A
- the matrix to modify.function
- a function object taking as argument the current cell's value.Functions
public void assign(DoubleMatrix2D A, DoubleMatrix2D B, DoubleDoubleFunction function)
Blas
assign
in interface Blas
A
- the matrix to modify.B
- the secondary matrix to operate on.function
- a function object taking as first argument the current cell's value of this,
and as second argument the current cell's value of y,
Functions
public double dasum(DoubleMatrix1D x)
Blas
dasum
in interface Blas
x
- the first vector.public void daxpy(double alpha, DoubleMatrix1D x, DoubleMatrix1D y)
Blas
daxpy
in interface Blas
alpha
- a scale factor.x
- the first source vector.y
- the second source vector, this is also the vector where results are stored.public void daxpy(double alpha, DoubleMatrix2D A, DoubleMatrix2D B)
Blas
daxpy
in interface Blas
alpha
- a scale factor.A
- the first source matrix.B
- the second source matrix, this is also the matrix where results are stored.public void dcopy(DoubleMatrix1D x, DoubleMatrix1D y)
Blas
dcopy
in interface Blas
x
- the source vector.y
- the destination vector.public void dcopy(DoubleMatrix2D A, DoubleMatrix2D B)
Blas
dcopy
in interface Blas
A
- the source matrix.B
- the destination matrix.public double ddot(DoubleMatrix1D x, DoubleMatrix1D y)
Blas
ddot
in interface Blas
x
- the first vector.y
- the second vector.
public void dgemm(boolean transposeA, boolean transposeB, double alpha, DoubleMatrix2D A, DoubleMatrix2D B, double beta, DoubleMatrix2D C)
Blas
dgemm
in interface Blas
transposeA
- set this flag to indicate that the multiplication shall be performed on A'.transposeB
- set this flag to indicate that the multiplication shall be performed on B'.alpha
- a scale factor.A
- the first source matrix.B
- the second source matrix.beta
- a scale factor.C
- the third source matrix, this is also the matrix where results are stored.public void dgemv(boolean transposeA, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y)
Blas
dgemv
in interface Blas
transposeA
- set this flag to indicate that the multiplication shall be performed on A'.alpha
- a scale factor.A
- the source matrix.x
- the first source vector.beta
- a scale factor.y
- the second source vector, this is also the vector where results are stored.public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A)
Blas
A = { {6,5}, {7,6} }, x = {1,2}, y = {3,4}, alpha = 1 --> A = { {9,9}, {13,14} }
dger
in interface Blas
alpha
- a scalar.x
- an m element vector.y
- an n element vector.A
- an m by n matrix.public double dnrm2(DoubleMatrix1D x)
Blas
dnrm2
in interface Blas
x
- the vector.public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s)
Blas
drot
in interface Blas
x
- the first vector.y
- the second vector.c
- the cosine of the angle of rotation.s
- the sine of the angle of rotation.public void drotg(double a, double b, double[] rotvec)
Blas
drotg
in interface Blas
a
- rotational elimination parameter a.b
- rotational elimination parameter b.public void dscal(double alpha, DoubleMatrix1D x)
Blas
dscal
in interface Blas
alpha
- a scale factor.x
- the first vector.public void dscal(double alpha, DoubleMatrix2D A)
Blas
dscal
in interface Blas
alpha
- a scale factor.A
- the matrix.public void dswap(DoubleMatrix1D x, DoubleMatrix1D y)
Blas
dswap
in interface Blas
x
- the first vector.y
- the second vector.public void dswap(DoubleMatrix2D A, DoubleMatrix2D B)
Blas
dswap
in interface Blas
public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y)
Blas
dsymv
in interface Blas
isUpperTriangular
- is A upper triangular or lower triangular part to be used?alpha
- scaling factor.A
- the source matrix.x
- the first source vector.beta
- scaling factor.y
- the second vector holding source and destination.public void dtrmv(boolean isUpperTriangular, boolean transposeA, boolean isUnitTriangular, DoubleMatrix2D A, DoubleMatrix1D x)
Blas
dtrmv
in interface Blas
isUpperTriangular
- is A upper triangular or lower triangular?transposeA
- set this flag to indicate that the multiplication shall be performed on A'.isUnitTriangular
- true --> A is assumed to be unit triangular; false --> A is not assumed to be unit triangularA
- the source matrix.x
- the vector holding source and destination.public int idamax(DoubleMatrix1D x)
Blas
idamax
in interface Blas
x
- the vector to search through.
public void stats()
FJTaskRunnerGroup.stats()
.
|
Colt 1.2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |