Class SeqBlas
java.lang.Object
cern.colt.matrix.linalg.SeqBlas
- All Implemented Interfaces:
Blas
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSeqBlas()Makes this class non instantiable, but still let's others inherit from it. -
Method Summary
Modifier and TypeMethodDescriptionvoidassign(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]).doubleReturns 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.voidVector assignment (copying); y = x.voidMatrix 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'.doubleReturn 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.voidSwaps the elements of two vectors; y invalid input: '<'==> x.voidSwaps the elements of two matrices; B invalid input: '<'==> 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.intReturns the index of largest absolute value; i such that |x[i]| == max(|x[0]|,|x[1]|,...)..private doublesign(double a, double b) Implements the FORTRAN sign (not sin) function.
-
Field Details
-
seqBlas
Little trick to allow for "aliasing", that is, renaming this class. Time and again writing code likeSeqBlas.blas.dgemm(...);
is a bit awkward. Using the aliasing you can instead write
Blas B = SeqBlas.blas;
B.dgemm(...); -
F
-
-
Constructor Details
-
SeqBlas
protected SeqBlas()Makes this class non instantiable, but still let's others inherit from it.
-
-
Method Details
-
assign
Description copied from interface:BlasAssigns the result of a function to each cell; x[row,col] = function(x[row,col]). -
assign
Description copied from interface:BlasAssigns the result of a function to each cell; x[row,col] = function(x[row,col],y[row,col]). -
dasum
Description copied from interface:BlasReturns 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). -
daxpy
Description copied from interface:BlasCombined vector scaling; y = y + alpha*x. In fact equivalent to y.assign(x,cern.jet.math.Functions.plusMult(alpha)). -
daxpy
Description copied from interface:BlasCombined matrix scaling; B = B + alpha*A. In fact equivalent to B.assign(A,cern.jet.math.Functions.plusMult(alpha)). -
dcopy
Description copied from interface:BlasVector assignment (copying); y = x. In fact equivalent to y.assign(x). -
dcopy
Description copied from interface:BlasMatrix assignment (copying); B = A. In fact equivalent to B.assign(A). -
ddot
Description copied from interface:BlasReturns the dot product of two vectors x and y, which is Sum(x[i]*y[i]). In fact equivalent to x.zDotProduct(y). -
dgemm
public void dgemm(boolean transposeA, boolean transposeB, double alpha, DoubleMatrix2D A, DoubleMatrix2D B, double beta, DoubleMatrix2D C) Description copied from interface:BlasGeneralized 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 interfaceBlas- 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:BlasGeneralized 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 interfaceBlas- 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
Description copied from interface:BlasPerforms 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} } -
dnrm2
Description copied from interface:BlasReturn the 2-norm; sqrt(x[0]^2 + x[1]^2 + ...). In fact equivalent to Math.sqrt(Algebra.DEFAULT.norm2(x)). -
drot
Description copied from interface:BlasApplies a givens plane rotation to (x,y); x = c*x + s*y; y = c*y - s*x. -
drotg
public void drotg(double a, double b, double[] rotvec) Description copied from interface:BlasConstructs 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 -
dscal
Description copied from interface:BlasVector scaling; x = alpha*x. In fact equivalent to x.assign(cern.jet.math.Functions.mult(alpha)). -
dscal
Description copied from interface:BlasMatrix scaling; A = alpha*A. In fact equivalent to A.assign(cern.jet.math.Functions.mult(alpha)). -
dswap
Description copied from interface:BlasSwaps the elements of two vectors; y invalid input: '<'==> x. In fact equivalent to y.swap(x). -
dswap
Description copied from interface:BlasSwaps the elements of two matrices; B invalid input: '<'==> A. -
dsymv
public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y) Description copied from interface:BlasSymmetric 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. -
dtrmv
public void dtrmv(boolean isUpperTriangular, boolean transposeA, boolean isUnitTriangular, DoubleMatrix2D A, DoubleMatrix1D x) Description copied from interface:BlasTriangular 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 interfaceBlas- 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
Description copied from interface:BlasReturns the index of largest absolute value; i such that |x[i]| == max(|x[0]|,|x[1]|,...).. -
sign
private double sign(double a, double b) Implements the FORTRAN sign (not sin) function. See the code for details.- Parameters:
a- ab- b
-