[cig-commits] commit:
Mercurial
hg at geodynamics.org
Mon Nov 24 11:59:14 PST 2008
changeset: 109:369c8f0ef7d3
user: JohnMansour
date: Mon Jun 02 14:14:53 2008 +0000
files: Geometry/src/TensorMultMath.c
description:
moved call to register error stream to after an error has been detected for functions NonSquareMatrix_CumulativeMatrixVectorMultiplication and
NonSquareMatrix_CumulativeMultiplicationByNonSquareMatrix.
previous, this resulted in calls to these routines taking five times longer than they needed to (for ~ 8x3
matrices).
diff -r ea4916d0daad -r 369c8f0ef7d3 Geometry/src/TensorMultMath.c
--- a/Geometry/src/TensorMultMath.c Fri May 30 06:06:01 2008 +0000
+++ b/Geometry/src/TensorMultMath.c Mon Jun 02 14:14:53 2008 +0000
@@ -594,16 +594,16 @@ void NonSquareMatrix_CumulativeMultiplic
int row_I, col_I; /* location with resultMatrix */
int counter; /* counter which facilitates the multiplication of AMatrix and BMatrix */
- /** Error Checking Code */
- Stream* error = Journal_Register( ErrorStream_Type, "TensorMultMath" );
-
+ /** Error Checking Code */
if (colDimA != rowDimB) {
+ Stream* error = Journal_Register( ErrorStream_Type, "TensorMultMath" );
Journal_Firewall( False, error,
"In func '%s' row dimension B, %u != column dimension A, %u\n",
__func__, rowDimB, colDimA );
}
if ((AMatrix == NULL) || (BMatrix == NULL) || (resultMatrix == NULL) ) {
- Journal_Firewall( False, error,
+ Stream* error = Journal_Register( ErrorStream_Type, "TensorMultMath" );
+ Journal_Firewall( False, error,
"In func '%s', Input matrices: %s %s, or Output matrix: %s is NULL \n",
__func__, AMatrix, BMatrix, resultMatrix);
}
@@ -637,13 +637,19 @@ void NonSquareMatrix_CumulativeMatrixVec
void NonSquareMatrix_CumulativeMatrixVectorMultiplication( double** AMatrix, int rowsInA, int colsInA,
double* BVec, int rowsInB, double* resultVector ) {
int row_I, col_I; /* counters through matrix rows and columns respectively */
- Stream* error = Journal_Register( ErrorStream_Type, "TensorMultMath" );
- Journal_Firewall( ( colsInA == rowsInB ), error,
+ /** Error Checking Code */
+ if ( colsInA != rowsInB ) {
+ Stream* error = Journal_Register( ErrorStream_Type, "TensorMultMath" );
+ Journal_Firewall( False, error,
"In func '%s' column dimensions of A_Matrix = %d is not equal to the row dimensions of B_Vec = %d\n",
__func__, colsInA, rowsInB );
- Journal_Firewall( (resultVector != NULL) || (AMatrix != NULL) || (BVec != NULL) , error,
+ }
+ if( (resultVector == NULL) || (AMatrix == NULL) || (BVec == NULL) ) {
+ Stream* error = Journal_Register( ErrorStream_Type, "TensorMultMath" );
+ Journal_Firewall( False , error,
"In func '%s', Input matrices: %p %p, or Output matrix: %p is NULL \n",
__func__, AMatrix, BVec, resultVector);
+ }
/* calculate the result Vector */
for( row_I = 0 ; row_I < rowsInA ; row_I++ ) {
for( col_I = 0 ; col_I < colsInA ; col_I++ ) {
More information about the CIG-COMMITS
mailing list