Add operator [] to Matrix

This commit is contained in:
kradchen
2023-05-16 10:57:11 +08:00
parent 4130643f06
commit 3518ba36e9
2 changed files with 7 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#include "Matrix.h"
#include <cstddef>
#include <mkl_cblas.h>
#include <string>
#include <cstring>
@@ -468,6 +469,9 @@ namespace Aurora {
Matrix operator^( Matrix &&matrix,int times) {
return operatorMxA(&vdPowI, times, std::forward<Matrix&&>(matrix));
}
double Matrix::operator[](size_t index) const { return getData()[index];}
void Matrix::printf() {
if(isNull())
{

View File

@@ -169,6 +169,9 @@ namespace Aurora {
friend Matrix operator==(double aScalar, const Matrix &matrix);
Matrix operator==(const Matrix &matrix) const;
// sub
double operator[](size_t index) const;
/**
* 矩阵乘法