Add fromRawData & copyFromRawData to Matrix class.

This commit is contained in:
Krad
2023-04-20 14:06:44 +08:00
parent 6ec61aa4cb
commit 9c0667a65a
3 changed files with 67 additions and 3 deletions

View File

@@ -41,6 +41,30 @@ namespace Aurora {
explicit Matrix(const Matrix::MatrixSlice& slice);
/**
* Create from a Raw data(double array).
* Use Raw data which create like new double[size]() as a data source
* and the share_ptr's deleter will be std::default_delete<double[]>
* @param data
* @param rows
* @param cols
* @param slices
* @param type
* @return
*/
static Matrix fromRawData(double *data, int rows, int cols = 0, int slices = 0, ValueType type = Normal);
/**
* Create from a Raw data(double array) with copy the data to a new mkl memory.
* @param data
* @param rows
* @param cols
* @param slices
* @param type
* @return
*/
static Matrix copyFromRawData(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