IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2005, 12:28:08 PM (21 years ago)
Author:
desonia
Message:

Bug #403 -- implemented and tested non-square matrix multiply.

File:
1 edited

Legend:

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

    r4144 r4160  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2005-06-08 02:38:02 $
     23 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2005-06-08 22:28:07 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3333#include <gsl/gsl_matrix.h>
    3434#include <gsl/gsl_linalg.h>
     35#include <gsl/gsl_blas.h>
    3536#include <gsl/gsl_permutation.h>
    3637#include <gsl/gsl_eigen.h>
     
    138139    numRows = inImage->numRows;
    139140    numCols = inImage->numCols;
    140     for(i=0; i<numRows; i++) {
    141         for(j=0; j<numCols; j++) {
    142             if(inImage->type.type == PS_TYPE_F32) {
    143                 outGslMatrix->data[i*numCols+j] = (psF64)inImage->data.F32[i][j];
    144             } else {
     141    if(inImage->type.type == PS_TYPE_F32) {
     142        for(i=0; i<numRows; i++) {
     143            for(j=0; j<numCols; j++) {
     144                outGslMatrix->data[i*numCols+j] = inImage->data.F32[i][j];
     145            }
     146        }
     147    } else {
     148        for(i=0; i<numRows; i++) {
     149            for(j=0; j<numCols; j++) {
    145150                outGslMatrix->data[i*numCols+j] = inImage->data.F64[i][j];
    146151            }
     
    160165    numRows = outImage->numRows;
    161166    numCols = outImage->numCols;
    162     for(i=0; i<numRows; i++) {
    163         for(j=0; j<numCols; j++) {
    164             if(outImage->type.type == PS_TYPE_F32) {
    165                 outImage->data.F32[i][j] = (psF32)inGslMatrix->data[i*numCols+j];
    166             } else {
     167    if(outImage->type.type == PS_TYPE_F32) {
     168        for(i=0; i<numRows; i++) {
     169            for(j=0; j<numCols; j++) {
     170                outImage->data.F32[i][j] = inGslMatrix->data[i*numCols+j];
     171            }
     172        }
     173    } else {
     174        for(i=0; i<numRows; i++) {
     175            for(j=0; j<numCols; j++) {
    167176                outImage->data.F64[i][j] = inGslMatrix->data[i*numCols+j];
    168177            }
     
    401410    }
    402411
    403     outImage = psImageRecycle(outImage, inImage1->numCols, inImage2->numRows, inImage2->type.type);
     412    outImage = psImageRecycle(outImage, inImage2->numCols, inImage1->numRows, inImage2->type.type);
    404413
    405414    // Initialize GSL data
     
    411420
    412421    // Perform multiplication
     422    // gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, m1, m2, 0.0, m3);
    413423    gsl_linalg_matmult(m1, m2, m3);
    414     // N.B., gsl_blas_sgemm/dgemm could have been used instead, e.g.,
    415     // gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, m1, m2, m3)
    416424
    417425    // Copy GSL matrix data to psImage data
Note: See TracChangeset for help on using the changeset viewer.