Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VReo > Reo__Matrix_Mult
diff Matrix_Mult.h @ 0:c4b1849c05ef
init add
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Sun, 02 Feb 2014 17:58:41 -0800 |
| parents | |
| children | 1b61e0c00512 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Matrix_Mult.h Sun Feb 02 17:58:41 2014 -0800 1.3 @@ -0,0 +1,76 @@ 1.4 +/* 1.5 + * Copyright Oct 24, 2009 OpenSourceCodeStewardshipFoundation.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + */ 1.8 + 1.9 +#ifndef MATRIX_MULT_H_ 1.10 +#define MATRIX_MULT_H_ 1.11 + 1.12 +#include <stdio.h> 1.13 +#include <unistd.h> 1.14 +#include <malloc.h> 1.15 + 1.16 +#include "ParamHelper/Param.h" 1.17 + 1.18 +//============================== Structures ============================== 1.19 + 1.20 +typedef 1.21 +struct 1.22 + { int32 numRows; 1.23 + int32 numCols; 1.24 + float32 *array; //2D, but dynamically sized, so use addr arith 1.25 + } 1.26 +Matrix; 1.27 + 1.28 +/* This is the "appSpecificPiece" that is carried inside a DKUPiece. 1.29 + * In the DKUPiece data struc it is declared to be of type "void *". This 1.30 + * allows the application to define any data structure it wants and put it 1.31 + * into a DKUPiece. 1.32 + * When the app specific info is used, it is in app code, so it is cast to 1.33 + * the correct type to tell the compiler how to access fields. 1.34 + * This keeps all app-specific things out of the DKU directory, as per the 1.35 + * DKU standard. */ 1.36 +typedef 1.37 +struct 1.38 + { 1.39 + // pointers to shared data.. the result matrix must be created when the 1.40 + // left and right matrices are put into the root ancestor DKUPiece. 1.41 + Matrix * leftMatrix; 1.42 + Matrix * rightMatrix; 1.43 + Matrix * resultMatrix; 1.44 + 1.45 + // define the starting and ending boundaries for this piece of the 1.46 + // result matrix. These are derivable from the left and right 1.47 + // matrices, but included them for readability of code. 1.48 + int prodStartRow, prodEndRow; 1.49 + int prodStartCol, prodEndCol; 1.50 + // Start and end of the portion of the left matrix that contributes to 1.51 + // this piece of the product 1.52 + int leftStartRow, leftEndRow; 1.53 + int leftStartCol, leftEndCol; 1.54 + // Start and end of the portion of the right matrix that contributes to 1.55 + // this piece of the product 1.56 + int rightStartRow, rightEndRow; 1.57 + int rightStartCol, rightEndCol; 1.58 + } 1.59 +MatrixProdPiece; 1.60 + 1.61 +//============================== Functions ================================ 1.62 +void readFile(); 1.63 + 1.64 +Matrix *makeMatrix( int32 numRows, int32 numCols ); 1.65 +Matrix *makeMatrix_Flat( int32 numRows, int32 numCols ); 1.66 +Matrix *makeMatrix_WithResMat( int32 numRows, int32 numCols ); 1.67 +void freeMatrix_Flat( Matrix * matrix ); 1.68 +void freeMatrix( Matrix * matrix ); 1.69 +void printMatrix( Matrix *matrix ); 1.70 + 1.71 +void read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName ); 1.72 + 1.73 +void 1.74 +initialize_Input_Matrices_Via( Matrix **leftMatrix, Matrix **rightMatrix, 1.75 + ParamBag *paramBag ); 1.76 + 1.77 +//=========================================================================== 1.78 + 1.79 +#endif /*MATRIX_MULT_H_*/
