基于vector<vector<double>>实现,因为是作神经网络的的,所以直接搞成double了。
1. 重载 * 作为矩阵叉乘的符号
2.重载 / 作为矩阵点乘的符号
3.还有矩阵 加法+ 减法-
4.矩阵转置transposition()
使用说明:
// 使用说明
//{
// int row = 10;
// int col = 10;
// //矩阵是浮点型滴
// // 1.创建一个10 * 10的矩阵
// Matrix matrix(row, col);
//
// // 2.赋值
// matrix[1][1] = 20;
//
// // 3.创建一个10 * 10的矩阵 并且默认0-1的随机值
// Matrix matrix2(row, col, true);
//}
//
vector版本
#pragma once
#include <vector>
#include <math.h>
class MATRIX_ :
public std::vector<std::vector<double>>
{
public:
MATRIX_()
{
}
MATRIX_(int row_, int col_, bool rand_=false)
{
if (row_ < 1 || col_ < 1)
throw "ERR row < 1 || col < 1";
this->row = row_;
this->col = col_;
this->resize(row);
std::vector<std::vector<double>>::iterato