Add operator [] to Matrix
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <mkl_cblas.h>
|
#include <mkl_cblas.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -468,6 +469,9 @@ namespace Aurora {
|
|||||||
Matrix operator^( Matrix &&matrix,int times) {
|
Matrix operator^( Matrix &&matrix,int times) {
|
||||||
return operatorMxA(&vdPowI, times, std::forward<Matrix&&>(matrix));
|
return operatorMxA(&vdPowI, times, std::forward<Matrix&&>(matrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Matrix::operator[](size_t index) const { return getData()[index];}
|
||||||
|
|
||||||
void Matrix::printf() {
|
void Matrix::printf() {
|
||||||
if(isNull())
|
if(isNull())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ namespace Aurora {
|
|||||||
friend Matrix operator==(double aScalar, const Matrix &matrix);
|
friend Matrix operator==(double aScalar, const Matrix &matrix);
|
||||||
Matrix operator==(const Matrix &matrix) const;
|
Matrix operator==(const Matrix &matrix) const;
|
||||||
|
|
||||||
|
// sub
|
||||||
|
double operator[](size_t index) const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 矩阵乘法
|
* 矩阵乘法
|
||||||
|
|||||||
Reference in New Issue
Block a user