cern.colt.matrix.tdouble.algo
Class SmpDoubleBlas
- java.lang.Object
-
- cern.colt.matrix.tdouble.algo.SmpDoubleBlas
-
- All Implemented Interfaces:
- DoubleBlas
public class SmpDoubleBlas extends java.lang.Object implements DoubleBlas
Parallel implementation of the Basic Linear Algebra System for symmetric multi processing boxes. In all cases, no or only marginal speedup is seen for small problem sizes; they are detected and the sequential algorithm is used.
-
-
Constructor Summary
Constructors Constructor and Description SmpDoubleBlas()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidassign(DoubleMatrix2D A, DoubleFunction function)Assigns the result of a function to each cell; x[row,col] = function(x[row,col]).voidassign(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]).doubledasum(DoubleMatrix1D x)Returns the sum of absolute values; |x[0]| + |x[1]| + ...voiddaxpy(double alpha, DoubleMatrix1D x, DoubleMatrix1D y)Combined vector scaling; y = y + alpha*x.voiddaxpy(double alpha, DoubleMatrix2D A, DoubleMatrix2D B)Combined matrix scaling; B = B + alpha*A.voiddcopy(DoubleMatrix1D x, DoubleMatrix1D y)Vector assignment (copying); y = x.voiddcopy(DoubleMatrix2D A, DoubleMatrix2D B)Matrix assignment (copying); B = A.doubleddot(DoubleMatrix1D x, DoubleMatrix1D y)Returns the dot product of two vectors x and y, which is Sum(x[i]*y[i]).voiddgemm(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.voiddgemv(boolean transposeA, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y)Generalized linear algebraic matrix-vector multiply; y = alpha*A*x + beta*y.voiddger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A)Performs a rank 1 update; A = A + alpha*x*y'.doublednrm2(DoubleMatrix1D x)Return the 2-norm; sqrt(x[0]^2 + x[1]^2 + ...).voiddrot(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.voiddrotg(double a, double b, double[] rotvec)Constructs a Givens plane rotation for (a,b).voiddscal(double alpha, DoubleMatrix1D x)Vector scaling; x = alpha*x.voiddscal(double alpha, DoubleMatrix2D A)Matrix scaling; A = alpha*A.voiddswap(DoubleMatrix1D x, DoubleMatrix1D y)Swaps the elements of two vectors; y <==> x.voiddswap(DoubleMatrix2D A, DoubleMatrix2D B)Swaps the elements of two matrices; B <==> A.voiddsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y)Symmetric matrix-vector multiplication; y = alpha*A*x + beta*y.voiddtrmv(boolean isUpperTriangular, boolean transposeA, boolean isUnitTriangular, DoubleMatrix2D A, DoubleMatrix1D x)Triangular matrix-vector multiplication; x = A*x or x = A'*x.intidamax(DoubleMatrix1D x)Returns the index of largest absolute value; i such that |x[i]| == max(|x[0]|,|x[1]|,...)..
-
-
-
Method Detail
-
assign
public void assign(DoubleMatrix2D A, DoubleFunction function)
Description copied from interface:DoubleBlasAssigns the result of a function to each cell; x[row,col] = function(x[row,col]).- Specified by:
assignin interfaceDoubleBlas- Parameters:
A- the matrix to modify.function- a function object taking as argument the current cell's value.- See Also:
DoubleFunctions
-
assign
public void assign(DoubleMatrix2D A, DoubleMatrix2D B, DoubleDoubleFunction function)
Description copied from interface:DoubleBlasAssigns the result of a function to each cell; x[row,col] = function(x[row,col],y[row,col]).- Specified by:
assignin interfaceDoubleBlas- Parameters:
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,- See Also:
DoubleFunctions
-
dasum
public double dasum(DoubleMatrix1D x)
Description copied from interface:DoubleBlasReturns the sum of absolute values; |x[0]| + |x[1]| + ... . In fact equivalent to x.aggregate(cern.jet.math.Functions.plus, cern.jet.math.Functions.abs) .- Specified by:
dasumin interfaceDoubleBlas- Parameters:
x- the first vector.
-
daxpy
public void daxpy(double alpha, DoubleMatrix1D x, DoubleMatrix1D y)Description copied from interface:DoubleBlasCombined vector scaling; y = y + alpha*x. In fact equivalent to y.assign(x,cern.jet.math.Functions.plusMult(alpha)).- Specified by:
daxpyin interfaceDoubleBlas- Parameters:
alpha- a scale factor.x- the first source vector.y- the second source vector, this is also the vector where results are stored.
-
daxpy
public void daxpy(double alpha, DoubleMatrix2D A, DoubleMatrix2D B)Description copied from interface:DoubleBlasCombined matrix scaling; B = B + alpha*A. In fact equivalent to B.assign(A,cern.jet.math.Functions.plusMult(alpha)).- Specified by:
daxpyin interfaceDoubleBlas- Parameters:
alpha- a scale factor.A- the first source matrix.B- the second source matrix, this is also the matrix where results are stored.
-
dcopy
public void dcopy(DoubleMatrix1D x, DoubleMatrix1D y)
Description copied from interface:DoubleBlasVector assignment (copying); y = x. In fact equivalent to y.assign(x).- Specified by:
dcopyin interfaceDoubleBlas- Parameters:
x- the source vector.y- the destination vector.
-
dcopy
public void dcopy(DoubleMatrix2D A, DoubleMatrix2D B)
Description copied from interface:DoubleBlasMatrix assignment (copying); B = A. In fact equivalent to B.assign(A).- Specified by:
dcopyin interfaceDoubleBlas- Parameters:
A- the source matrix.B- the destination matrix.
-
ddot
public double ddot(DoubleMatrix1D x, DoubleMatrix1D y)
Description copied from interface:DoubleBlasReturns the dot product of two vectors x and y, which is Sum(x[i]*y[i]). In fact equivalent to x.zDotProduct(y).- Specified by:
ddotin interfaceDoubleBlas- Parameters:
x- the first vector.y- the second vector.- Returns:
- the sum of products.
-
dgemm
public void dgemm(boolean transposeA, boolean transposeB, double alpha, DoubleMatrix2D A, DoubleMatrix2D B, double beta, DoubleMatrix2D C)Description copied from interface:DoubleBlasGeneralized linear algebraic matrix-matrix multiply; C = alpha*A*B + beta*C. In fact equivalent to A.zMult(B,C,alpha,beta,transposeA,transposeB). Note: Matrix shape conformance is checked after potential transpositions.- Specified by:
dgemmin interfaceDoubleBlas- Parameters:
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.
-
dgemv
public void dgemv(boolean transposeA, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y)Description copied from interface:DoubleBlasGeneralized linear algebraic matrix-vector multiply; y = alpha*A*x + beta*y. In fact equivalent to A.zMult(x,y,alpha,beta,transposeA). Note: Matrix shape conformance is checked after potential transpositions.- Specified by:
dgemvin interfaceDoubleBlas- Parameters:
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.
-
dger
public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A)Description copied from interface:DoubleBlasPerforms a rank 1 update; A = A + alpha*x*y'. Example:A = { {6,5}, {7,6} }, x = {1,2}, y = {3,4}, alpha = 1 --> A = { {9,9}, {13,14} }- Specified by:
dgerin interfaceDoubleBlas- Parameters:
alpha- a scalar.x- an m element vector.y- an n element vector.A- an m by n matrix.
-
dnrm2
public double dnrm2(DoubleMatrix1D x)
Description copied from interface:DoubleBlasReturn the 2-norm; sqrt(x[0]^2 + x[1]^2 + ...). In fact equivalent to Math.sqrt(Algebra.DEFAULT.norm2(x)).- Specified by:
dnrm2in interfaceDoubleBlas- Parameters:
x- the vector.
-
drot
public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s)
Description copied from interface:DoubleBlasApplies a givens plane rotation to (x,y); x = c*x + s*y; y = c*y - s*x.- Specified by:
drotin interfaceDoubleBlas- Parameters:
x- the first vector.y- the second vector.c- the cosine of the angle of rotation.s- the sine of the angle of rotation.
-
drotg
public void drotg(double a, double b, double[] rotvec)Description copied from interface:DoubleBlasConstructs a Givens plane rotation for (a,b). Taken from the LINPACK translation from FORTRAN to Java, interface slightly modified. In the LINPACK listing DROTG is attributed to Jack Dongarra- Specified by:
drotgin interfaceDoubleBlas- Parameters:
a- rotational elimination parameter a.b- rotational elimination parameter b.rotvec- Must be at least of length 4. On output contains the values {a,b,c,s}.
-
dscal
public void dscal(double alpha, DoubleMatrix1D x)Description copied from interface:DoubleBlasVector scaling; x = alpha*x. In fact equivalent to x.assign(cern.jet.math.Functions.mult(alpha)).- Specified by:
dscalin interfaceDoubleBlas- Parameters:
alpha- a scale factor.x- the first vector.
-
dscal
public void dscal(double alpha, DoubleMatrix2D A)Description copied from interface:DoubleBlasMatrix scaling; A = alpha*A. In fact equivalent to A.assign(cern.jet.math.Functions.mult(alpha)).- Specified by:
dscalin interfaceDoubleBlas- Parameters:
alpha- a scale factor.A- the matrix.
-
dswap
public void dswap(DoubleMatrix1D x, DoubleMatrix1D y)
Description copied from interface:DoubleBlasSwaps the elements of two vectors; y <==> x. In fact equivalent to y.swap(x).- Specified by:
dswapin interfaceDoubleBlas- Parameters:
x- the first vector.y- the second vector.
-
dswap
public void dswap(DoubleMatrix2D A, DoubleMatrix2D B)
Description copied from interface:DoubleBlasSwaps the elements of two matrices; B <==> A.- Specified by:
dswapin interfaceDoubleBlas- Parameters:
A- the first matrix.B- the second matrix.
-
dsymv
public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y)Description copied from interface:DoubleBlasSymmetric matrix-vector multiplication; y = alpha*A*x + beta*y. Where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix. A can be in upper or lower triangular format.- Specified by:
dsymvin interfaceDoubleBlas- Parameters:
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.
-
dtrmv
public void dtrmv(boolean isUpperTriangular, boolean transposeA, boolean isUnitTriangular, DoubleMatrix2D A, DoubleMatrix1D x)Description copied from interface:DoubleBlasTriangular matrix-vector multiplication; x = A*x or x = A'*x. Where x is an n element vector and A is an n by n unit, or non-unit, upper or lower triangular matrix.- Specified by:
dtrmvin interfaceDoubleBlas- Parameters:
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.
-
idamax
public int idamax(DoubleMatrix1D x)
Description copied from interface:DoubleBlasReturns the index of largest absolute value; i such that |x[i]| == max(|x[0]|,|x[1]|,...)..- Specified by:
idamaxin interfaceDoubleBlas- Parameters:
x- the vector to search through.- Returns:
- the index of largest absolute value (-1 if x is empty).
-
-
DMelt 3.0 © DataMelt by jWork.ORG