Me@10: /* Me@10: * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org Me@10: * Licensed under GNU General Public License version 2 Me@10: */ Me@10: Me@10: #ifndef MATRIX_MULT_H_ Me@10: #define MATRIX_MULT_H_ Me@10: Me@10: #include Me@10: #include Me@10: #include Me@10: seanhalle@12: #include "VMS_impl/VMS_primitive_data_types.h" seanhalle@12: #include "ParamHelper/Param.h" Me@10: Me@10: //============================== Structures ============================== Me@10: seanhalle@15: typedef struct Me@10: { int32 numRows; Me@10: int32 numCols; Me@10: float32 *array; //2D, but dynamically sized, so use addr arith Me@10: } Me@10: Matrix; Me@10: Me@10: /* This is the "appSpecificPiece" that is carried inside a DKUPiece. Me@10: * In the DKUPiece data struc it is declared to be of type "void *". This Me@10: * allows the application to define any data structure it wants and put it Me@10: * into a DKUPiece. Me@10: * When the app specific info is used, it is in app code, so it is cast to Me@10: * the correct type to tell the compiler how to access fields. Me@10: * This keeps all app-specific things out of the DKU directory, as per the Me@10: * DKU standard. */ seanhalle@15: typedef struct Me@10: { Me@10: // pointers to shared data.. the result matrix must be created when the Me@10: // left and right matrices are put into the root ancestor DKUPiece. Me@10: Matrix * leftMatrix; Me@10: Matrix * rightMatrix; Me@10: Matrix * resultMatrix; Me@10: Me@10: // define the starting and ending boundaries for this piece of the Me@10: // result matrix. These are derivable from the left and right Me@10: // matrices, but included them for readability of code. Me@10: int prodStartRow, prodEndRow; Me@10: int prodStartCol, prodEndCol; Me@10: // Start and end of the portion of the left matrix that contributes to Me@10: // this piece of the product Me@10: int leftStartRow, leftEndRow; Me@10: int leftStartCol, leftEndCol; Me@10: // Start and end of the portion of the right matrix that contributes to Me@10: // this piece of the product Me@10: int rightStartRow, rightEndRow; Me@10: int rightStartCol, rightEndCol; Me@10: } Me@10: MatrixProdPiece; Me@10: Me@10: //============================== Functions ================================ Me@10: void readFile(); Me@10: Me@10: Matrix *makeMatrix( int32 numRows, int32 numCols ); Me@10: Matrix *makeMatrix_Flat( int32 numRows, int32 numCols ); Me@10: Matrix *makeMatrix_WithResMat( int32 numRows, int32 numCols ); Me@10: void freeMatrix_Flat( Matrix * matrix ); Me@10: void freeMatrix( Matrix * matrix ); Me@10: void printMatrix( Matrix *matrix ); Me@10: Me@10: void read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName ); Me@10: Me@10: void Me@10: initialize_Input_Matrices_Via( Matrix **leftMatrix, Matrix **rightMatrix, Me@10: ParamBag *paramBag ); Me@10: Me@10: //=========================================================================== Me@10: Me@10: #endif /*MATRIX_MULT_H_*/