Skip to content
Snippets Groups Projects
Commit 323b9881 authored by Jakhes's avatar Jakhes
Browse files

Updating the helper functions

parent e7ae668e
No related branches found
No related tags found
No related merge requests found
#include <sicstus/sicstus.h>
#include "helper.hpp"
// adding some testing to the functions
......@@ -20,6 +20,7 @@ float *convertToArray(colvec vec)
}
return arr;
}
float *convertToArray(rowvec vec)
{
colvec newVec = conv_to<colvec>::from(vec);
......@@ -94,3 +95,41 @@ mat convertArrayToMat(float *arr, int vecSize, int rowCount)
}
return matrix;
}
void returnMatrixInformation(mat matrix, float **mat, SP_integer *matColNum, SP_integer *matRowNum)
{
// return the Matrix dimensions
*matColNum = matrix.n_cols;
*matRowNum = matrix.n_rows;
// return the Matrix as one long Array
*mat = convertToArray(matrix);
}
void returnMatrixInformation(Mat< size_t > matrix, float **mat, SP_integer *matColNum, SP_integer *matRowNum)
{
// return the Matrix dimensions
*matColNum = matrix.n_cols;
*matRowNum = matrix.n_rows;
// return the Matrix as one long Array
*mat = convertToArray(matrix);
}
void returnVectorInformation(vec vector, float **vecArr, SP_integer *vecArrSize)
{
// return the Matrix dimensions
*vecArrSize = vector.size();
// return the Matrix as one long Array
*vecArr = convertToArray(vector);
}
void returnVectorInformation(Row< size_t > vector, float **vecArr, SP_integer *vecArrSize)
{
// return the Matrix dimensions
*vecArrSize = vector.size();
// return the Matrix as one long Array
*vecArr = convertToArray(vector);
}
\ No newline at end of file
......@@ -28,4 +28,12 @@ Row<size_t> convertArrayToVec(float *arr, int vecSize);
mat convertArrayToMat(float *arr, int vecSize, int rowCount);
void returnMatrixInformation(mat matrix, float **mat, SP_integer *matColNum, SP_integer *matRowNum);
void returnMatrixInformation(Mat< size_t > matrix, float **mat, SP_integer *matColNum, SP_integer *matRowNum);
void returnVectorInformation(vec vector, float **vecArr, SP_integer *vecArrSize);
void returnVectorInformation(Row< size_t > vector, float **vecArr, SP_integer *vecArrSize);
#endif
......@@ -116,10 +116,6 @@ void weights(float **weightsMatArr, SP_integer *weightsMatColNum, SP_integer *we
// create the ReturnMat
mat weightsReturnMat = perceptronGlobal.Weights();
// return the Matrix dimensions
*weightsMatColNum = weightsReturnMat.n_cols;
*weightsMatRowNum = weightsReturnMat.n_rows;
// return the Matrix as one long Array
*weightsMatArr = convertToArray(weightsReturnMat);
// return the Mat
returnMatrixInformation(weightsReturnMat, weightsMatArr, weightsMatColNum, weightsMatRowNum);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment