| rev |
line source |
|
Me@10
|
1 /*
|
|
Me@10
|
2 * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org
|
|
Me@10
|
3 * Licensed under GNU General Public License version 2
|
|
Me@10
|
4 */
|
|
Me@10
|
5
|
|
Me@10
|
6 #ifndef MATRIX_MULT_H_
|
|
Me@10
|
7 #define MATRIX_MULT_H_
|
|
Me@10
|
8
|
|
Me@10
|
9 #include <stdio.h>
|
|
Me@10
|
10 #include <unistd.h>
|
|
Me@10
|
11 #include <malloc.h>
|
|
Me@10
|
12
|
|
seanhalle@12
|
13 #include "VMS_impl/VMS_primitive_data_types.h"
|
|
seanhalle@12
|
14 #include "ParamHelper/Param.h"
|
|
Me@10
|
15
|
|
Me@10
|
16 //============================== Structures ==============================
|
|
Me@10
|
17
|
|
seanhalle@15
|
18 typedef struct
|
|
Me@10
|
19 { int32 numRows;
|
|
Me@10
|
20 int32 numCols;
|
|
Me@10
|
21 float32 *array; //2D, but dynamically sized, so use addr arith
|
|
Me@10
|
22 }
|
|
Me@10
|
23 Matrix;
|
|
Me@10
|
24
|
|
Me@10
|
25 /* This is the "appSpecificPiece" that is carried inside a DKUPiece.
|
|
Me@10
|
26 * In the DKUPiece data struc it is declared to be of type "void *". This
|
|
Me@10
|
27 * allows the application to define any data structure it wants and put it
|
|
Me@10
|
28 * into a DKUPiece.
|
|
Me@10
|
29 * When the app specific info is used, it is in app code, so it is cast to
|
|
Me@10
|
30 * the correct type to tell the compiler how to access fields.
|
|
Me@10
|
31 * This keeps all app-specific things out of the DKU directory, as per the
|
|
Me@10
|
32 * DKU standard. */
|
|
seanhalle@15
|
33 typedef struct
|
|
Me@10
|
34 {
|
|
Me@10
|
35 // pointers to shared data.. the result matrix must be created when the
|
|
Me@10
|
36 // left and right matrices are put into the root ancestor DKUPiece.
|
|
Me@10
|
37 Matrix * leftMatrix;
|
|
Me@10
|
38 Matrix * rightMatrix;
|
|
Me@10
|
39 Matrix * resultMatrix;
|
|
Me@10
|
40
|
|
Me@10
|
41 // define the starting and ending boundaries for this piece of the
|
|
Me@10
|
42 // result matrix. These are derivable from the left and right
|
|
Me@10
|
43 // matrices, but included them for readability of code.
|
|
Me@10
|
44 int prodStartRow, prodEndRow;
|
|
Me@10
|
45 int prodStartCol, prodEndCol;
|
|
Me@10
|
46 // Start and end of the portion of the left matrix that contributes to
|
|
Me@10
|
47 // this piece of the product
|
|
Me@10
|
48 int leftStartRow, leftEndRow;
|
|
Me@10
|
49 int leftStartCol, leftEndCol;
|
|
Me@10
|
50 // Start and end of the portion of the right matrix that contributes to
|
|
Me@10
|
51 // this piece of the product
|
|
Me@10
|
52 int rightStartRow, rightEndRow;
|
|
Me@10
|
53 int rightStartCol, rightEndCol;
|
|
Me@10
|
54 }
|
|
Me@10
|
55 MatrixProdPiece;
|
|
Me@10
|
56
|
|
Me@10
|
57 //============================== Functions ================================
|
|
Me@10
|
58 void readFile();
|
|
Me@10
|
59
|
|
Me@10
|
60 Matrix *makeMatrix( int32 numRows, int32 numCols );
|
|
Me@10
|
61 Matrix *makeMatrix_Flat( int32 numRows, int32 numCols );
|
|
Me@10
|
62 Matrix *makeMatrix_WithResMat( int32 numRows, int32 numCols );
|
|
Me@10
|
63 void freeMatrix_Flat( Matrix * matrix );
|
|
Me@10
|
64 void freeMatrix( Matrix * matrix );
|
|
Me@10
|
65 void printMatrix( Matrix *matrix );
|
|
Me@10
|
66
|
|
Me@10
|
67 void read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName );
|
|
Me@10
|
68
|
|
Me@10
|
69 void
|
|
Me@10
|
70 initialize_Input_Matrices_Via( Matrix **leftMatrix, Matrix **rightMatrix,
|
|
Me@10
|
71 ParamBag *paramBag );
|
|
Me@10
|
72
|
|
Me@10
|
73 //===========================================================================
|
|
Me@10
|
74
|
|
Me@10
|
75 #endif /*MATRIX_MULT_H_*/
|