IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 10, 2005, 4:29:39 PM (21 years ago)
Author:
desonia
Message:

tweaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psMatrix.c

    r3476 r3880  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2005-03-22 21:52:49 $
     23 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2005-05-11 02:29:39 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    376376psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2)
    377377{
    378     psS32 numRows = 0;
    379     psS32 numCols = 0;
    380378    gsl_matrix *m1 = NULL;
    381379    gsl_matrix *m2 = NULL;
     
    394392    PS_CHECK_POINTERS(inImage1, inImage2, MULTIPLY_CLEANUP);
    395393
    396     outImage = psImageRecycle(outImage, inImage2->numCols, inImage2->numRows, inImage2->type.type);
    397 
    398     PS_CHECK_SQUARE(inImage1, MULTIPLY_CLEANUP);
    399     PS_CHECK_SQUARE(inImage2, MULTIPLY_CLEANUP);
    400     PS_CHECK_SQUARE(outImage, MULTIPLY_CLEANUP);
    401 
    402     // Initialize data
    403     numRows = inImage1->numRows;
    404     numCols = inImage1->numCols;
     394    if (inImage1->numRows != inImage2->numCols) {
     395        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid operation: number of rows of inImage1 != number of cols of inImage2.");
     396        MULTIPLY_CLEANUP;
     397    }
     398    if (inImage1->type.type != inImage2->type.type) {
     399        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid operation: data types of inImage1 and inImage2 must match.");
     400        MULTIPLY_CLEANUP;
     401    }
     402
     403    outImage = psImageRecycle(outImage, inImage1->numCols, inImage2->numRows, inImage2->type.type);
    405404
    406405    // Initialize GSL data
    407     m1 = gsl_matrix_alloc(numRows, numCols);
     406    m1 = gsl_matrix_alloc(inImage1->numRows, inImage1->numCols);
    408407    psImageToGslMatrix(m1, inImage1);
    409     m2 = gsl_matrix_alloc(numRows, numCols);
     408    m2 = gsl_matrix_alloc(inImage2->numRows, inImage2->numCols);
    410409    psImageToGslMatrix(m2, inImage2);
    411     m3 = gsl_matrix_alloc(numRows, numCols);
    412     psImageToGslMatrix(m3, outImage);
     410    m3 = gsl_matrix_alloc(outImage->numRows, outImage->numCols);
    413411
    414412    // Perform multiplication
Note: See TracChangeset for help on using the changeset viewer.