Add operation ^ to Matrix class.

This commit is contained in:
Krad
2023-04-19 11:30:05 +08:00
parent 8eb2d9e1ac
commit e491ce88c2
2 changed files with 10 additions and 0 deletions

View File

@@ -281,6 +281,12 @@ namespace Aurora {
Matrix operator/(Matrix &&aMatrix, const Matrix &aOther) {
return operatorMxM_RR(&vdDivI,&vzDivI,aOther,std::forward<Matrix&&>(aMatrix));
}
//operator ^ (pow)
Matrix Matrix::operator^(int times) const { return operatorMxA(&vdPowI, times, *this);}
Matrix operator^( Matrix &&matrix,int times) {
return operatorMxA(&vdPowI, times, std::forward<Matrix&&>(matrix));
}

View File

@@ -88,6 +88,10 @@ namespace Aurora {
Matrix operator/(Matrix &&matrix) const;
friend Matrix operator/(Matrix &&aMatrix,const Matrix &aOther);
// pow
Matrix operator^(int times) const;
friend Matrix operator^(Matrix &&matrix,int times);
/**
* print matrix , only support 2d matrix now
*/