Add deleteColumn function.
This commit is contained in:
@@ -790,6 +790,34 @@ Matrix Aurora::xcorr(const Matrix& aMatrix1, const Matrix& aMatrix2)
|
|||||||
return Matrix::New(resultData,resultSize);
|
return Matrix::New(resultData,resultSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Matrix Aurora::deleteColumn(const Matrix& aMatrix, int aColumnIndex)
|
||||||
|
{
|
||||||
|
int rows = aMatrix.getDimSize(0);
|
||||||
|
int columns = aMatrix.getDimSize(1);
|
||||||
|
if (aColumnIndex < 0 || aColumnIndex >= columns)
|
||||||
|
{
|
||||||
|
return aMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
double* resultData = Aurora::malloc(rows* (columns-1));
|
||||||
|
if(aColumnIndex == 0)
|
||||||
|
{
|
||||||
|
cblas_dcopy(rows* (columns-1), aMatrix.getData() + rows, 1, resultData, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(aColumnIndex == (columns - 1))
|
||||||
|
{
|
||||||
|
cblas_dcopy(rows* (columns-1), aMatrix.getData(), 1, resultData, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cblas_dcopy(rows * aColumnIndex, aMatrix.getData(), 1, resultData, 1);
|
||||||
|
cblas_dcopy(rows * (columns - aColumnIndex - 1), aMatrix.getData() + rows * (aColumnIndex + 1), 1, resultData + rows * aColumnIndex, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Matrix::New(resultData, rows, columns-1);
|
||||||
|
}
|
||||||
|
|
||||||
Matrix Aurora::reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices)
|
Matrix Aurora::reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices)
|
||||||
{
|
{
|
||||||
if(aMatrix.isNull() || (aMatrix.getDataSize() != aRows * aColumns * aSlices))
|
if(aMatrix.isNull() || (aMatrix.getDataSize() != aRows * aColumns * aSlices))
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ namespace Aurora {
|
|||||||
Matrix reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices);
|
Matrix reshape(const Matrix& aMatrix, int aRows, int aColumns, int aSlices);
|
||||||
|
|
||||||
Matrix xcorr(const Matrix& aMatrix1, const Matrix& aMatrix2);
|
Matrix xcorr(const Matrix& aMatrix1, const Matrix& aMatrix2);
|
||||||
|
|
||||||
|
Matrix deleteColumn(const Matrix& aMatrix, int aColumnIndex);
|
||||||
/**
|
/**
|
||||||
* 并集
|
* 并集
|
||||||
* @param aIa, [C,ia,~] = intersect(A,B)用法中ia的返回值
|
* @param aIa, [C,ia,~] = intersect(A,B)用法中ia的返回值
|
||||||
|
|||||||
Reference in New Issue
Block a user