diff --git a/src/Function1D.cpp b/src/Function1D.cpp index 7c364a1..d4b7195 100644 --- a/src/Function1D.cpp +++ b/src/Function1D.cpp @@ -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 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)) diff --git a/src/Function1D.h b/src/Function1D.h index f0ef6bf..a92d413 100644 --- a/src/Function1D.h +++ b/src/Function1D.h @@ -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的返回值