view Matrix_Mult.h @ 3:a6b3cab179b1

Added no-measurments option for platforms without support. Added static X86, ARM and basic Kalray build support. This branch requires the longjmp versions of libprt and libvreo
author Philipe Louchtch - de Raadt
date Sat, 12 Jul 2014 20:21:47 +0200
parents c4b1849c05ef
children
line source
1 /*
2 * Copyright Oct 24, 2009 OpenSourceCodeStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 */
6 #ifndef MATRIX_MULT_H_
7 #define MATRIX_MULT_H_
9 #include <stdio.h>
10 #include <unistd.h>
11 #include <malloc.h>
13 #include <PR__include/PR__primitive_data_types.h>
14 #include "ParamHelper/Param.h"
16 //============================== Structures ==============================
18 typedef
19 struct
20 { int32 numRows;
21 int32 numCols;
22 float32 *array; //2D, but dynamically sized, so use addr arith
23 }
24 Matrix;
26 /* This is the "appSpecificPiece" that is carried inside a DKUPiece.
27 * In the DKUPiece data struc it is declared to be of type "void *". This
28 * allows the application to define any data structure it wants and put it
29 * into a DKUPiece.
30 * When the app specific info is used, it is in app code, so it is cast to
31 * the correct type to tell the compiler how to access fields.
32 * This keeps all app-specific things out of the DKU directory, as per the
33 * DKU standard. */
34 typedef
35 struct
36 {
37 // pointers to shared data.. the result matrix must be created when the
38 // left and right matrices are put into the root ancestor DKUPiece.
39 Matrix * leftMatrix;
40 Matrix * rightMatrix;
41 Matrix * resultMatrix;
43 // define the starting and ending boundaries for this piece of the
44 // result matrix. These are derivable from the left and right
45 // matrices, but included them for readability of code.
46 int resStartRow, resEndRow;
47 int resStartCol, resEndCol;
48 // Start and end of the portion of the left matrix that contributes to
49 // this piece of the product
50 int leftStartRow, leftEndRow;
51 int leftStartCol, leftEndCol;
52 // Start and end of the portion of the right matrix that contributes to
53 // this piece of the product
54 int rightStartRow, rightEndRow;
55 int rightStartCol, rightEndCol;
56 }
57 MatrixProdPiece;
59 //============================== Functions ================================
60 void readFile();
62 Matrix *makeMatrix( int32 numRows, int32 numCols );
63 Matrix *makeMatrix_Flat( int32 numRows, int32 numCols );
64 Matrix *makeMatrix_WithResMat( int32 numRows, int32 numCols );
65 void freeMatrix_Flat( Matrix * matrix );
66 void freeMatrix( Matrix * matrix );
67 void printMatrix( Matrix *matrix );
69 void read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName );
71 void
72 initialize_Input_Matrices_Via( Matrix **leftMatrix, Matrix **rightMatrix,
73 ParamBag *paramBag );
75 //===========================================================================
77 #endif /*MATRIX_MULT_H_*/