Add comment to Matrix::New function.
This commit is contained in:
23
src/Matrix.h
23
src/Matrix.h
@@ -41,10 +41,33 @@ namespace Aurora {
|
||||
|
||||
explicit Matrix(const Matrix::MatrixSlice& slice);
|
||||
|
||||
/**
|
||||
* New a mkl calculate based Matrix
|
||||
* @attention Using New function, must use Aurora:malloc to get memory
|
||||
* @param data
|
||||
* @param rows
|
||||
* @param cols
|
||||
* @param slices
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
static Matrix New(double *data, int rows, int cols = 0, int slices = 0, ValueType type = Normal);
|
||||
|
||||
/**
|
||||
* New a mkl calculate based Matrix
|
||||
* @attention Using New function, must use Aurora:malloc to get memory
|
||||
* @param data
|
||||
* @param shapeMatrix
|
||||
* @return
|
||||
*/
|
||||
static Matrix New(double *data, const Matrix &shapeMatrix);
|
||||
|
||||
/**
|
||||
* New a mkl calculate based Matrix
|
||||
* @attention Memory are allocate by Aurora:malloc function
|
||||
* @param shapeMatrix
|
||||
* @return
|
||||
*/
|
||||
static Matrix New(const Matrix &shapeMatrix);
|
||||
|
||||
Matrix getDataFromDims2(int aColumn);
|
||||
|
||||
11
src/main.cxx
11
src/main.cxx
@@ -8,6 +8,7 @@
|
||||
|
||||
|
||||
#include "Matrix.h"
|
||||
#include "Function.h"
|
||||
#include "Function1D.h"
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
@@ -16,9 +17,9 @@
|
||||
|
||||
int main() {
|
||||
{
|
||||
double *dataA = new double[8];
|
||||
double *dataB = new double[8];
|
||||
double *dataC = new double[4];
|
||||
double *dataA = Aurora::malloc(8);
|
||||
double *dataB = Aurora::malloc(8);;
|
||||
double *dataC = Aurora::malloc(8);;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
dataA[i] = (double) (i - 3);
|
||||
dataB[i] = (double) (i + 2);
|
||||
@@ -63,8 +64,8 @@ int main() {
|
||||
printf("New A:\r\n");
|
||||
A.printf();
|
||||
}{
|
||||
double * dataA =new double[9];
|
||||
double * dataB =new double[9];
|
||||
double * dataA = Aurora::malloc(9);
|
||||
double * dataB = Aurora::malloc(9);
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
dataA[i]=(double)(i-3);
|
||||
dataB[i]=(double)(i+2);
|
||||
|
||||
@@ -22,8 +22,8 @@ double fourDecimalRound(double src){
|
||||
}
|
||||
|
||||
TEST_F(FunctionTester, matrixSlice) {
|
||||
double * dataA =new double[8];
|
||||
double * dataB =new double[8];
|
||||
double * dataA =Aurora::malloc(8);
|
||||
double * dataB =Aurora::malloc(8);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
dataA[i]=(double)(i-3);
|
||||
dataB[i]=(double)(i+2);
|
||||
@@ -42,8 +42,8 @@ TEST_F(FunctionTester, matrixSlice) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionTester, sign) {
|
||||
double * dataA =new double[9];
|
||||
double * dataB =new double[9];
|
||||
double * dataA =Aurora::malloc(9);
|
||||
double * dataB =Aurora::malloc(9);
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
dataA[i]=(double)(i-3);
|
||||
dataB[i]=(double)(i+2);
|
||||
@@ -59,8 +59,8 @@ TEST_F(FunctionTester, sign) {
|
||||
}
|
||||
|
||||
TEST_F(FunctionTester, matrix) {
|
||||
double * dataA =new double[9];
|
||||
double * dataB =new double[9];
|
||||
double * dataA =Aurora::malloc(9);
|
||||
double * dataB =Aurora::malloc(9);
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
dataA[i]=(double)(i+1);
|
||||
dataB[i]=(double)(i+2);
|
||||
|
||||
Reference in New Issue
Block a user