Add createVectorMatrix function.

This commit is contained in:
sunwen
2023-06-12 13:17:15 +08:00
parent f27937a60d
commit 31d1cb9f31
2 changed files with 20 additions and 0 deletions

View File

@@ -880,6 +880,24 @@ Matrix Aurora::deleteColumn(const Matrix& aMatrix, int aColumnIndex)
return Matrix::New(resultData, rows, columns-1);
}
Matrix Aurora::createVectorMatrix(double aStartValue, double aStepValue, double aEndValue)
{
std::vector<double> matrixData;
double tempValue = aStartValue;
matrixData.push_back(tempValue);
long long compare1 = std::round(aEndValue * 10e13);
long long compare2 = std::round(tempValue * 10e13);
while(std::round(tempValue* 10e13) <= compare1)
{
tempValue += aStepValue;
matrixData.push_back(tempValue);
compare2 = std::round(tempValue * 10e14);
}
matrixData.pop_back();
return Matrix::copyFromRawData(matrixData.data(), 1, matrixData.size());
}
Matrix Aurora::reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices)
{
if(aMatrix.isNull() || (aMatrix.getDataSize() != aRows * aColumns * aSlices))

View File

@@ -92,6 +92,8 @@ namespace Aurora {
Matrix xcorr(const Matrix& aMatrix1, const Matrix& aMatrix2);
Matrix deleteColumn(const Matrix& aMatrix, int aColumnIndex);
Matrix createVectorMatrix(double aStartValue, double aStepValue, double aEndValue);
/**
* 并集
* @param aIa, [C,ia,~] = intersect(A,B)用法中ia的返回值