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