矩阵基本变换
来源:互联网 发布:python web 框架 编辑:程序博客网 时间:2024/06/06 16:57
#include<stdio.h>#include<stdlib.h>#include<algorithm>#include<string.h>#include<iostream>using namespace std;class Matrix{public: int arr[100][100]; int m; int n; Matrix() { m=0; n=0; memset(arr,0,sizeof(arr)); } Matrix operator+(const Matrix &b)const { Matrix temp; temp.n=n; temp.m=m; for(int i=0; i<n; i++) { for(int j=0; j<m; j++) { temp.arr[i][j]=arr[i][j]+b.arr[i][j]; } } return temp; } Matrix operator-(const Matrix &b)const { Matrix temp; temp.n=n; temp.m=m; for(int i=0; i<n; i++) { for(int j=0; j<m; j++) { temp.arr[i][j]=arr[i][j]-b.arr[i][j]; } } return temp; } Matrix operator*(const Matrix &b)const { Matrix temp; temp.n=n; temp.m=m; for(int i=0; i<n; i++) { for(int j=0; j<m; j++) { temp.arr[i][j]=arr[i][j]*b.arr[i][j]; } } return temp; }};int main(){ Matrix a; Matrix b; a.n=4; a.m=4; b.n=4; b.m=4; for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { a.arr[i][j]=4; } } for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { b.arr[i][j]=3; } } Matrix c; c=a-b; for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { cout<<c.arr[i][j]<<' '; } cout<<endl; } c=a+b; for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { cout<<c.arr[i][j]<<' '; } cout<<endl; } c=a*b; for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { cout<<c.arr[i][j]<<' '; } cout<<endl; } return 0;}
0 0
- 矩阵基本变换
- 图形变换之基本矩阵变换
- 矩阵的基本变换 | Matrix
- MATLAB直观演示基本几何变换矩阵
- Matlab中矩阵的基本变换
- 基本的2D图形变换&变换矩阵推导(转)
- RenderTransform特效【五种基本变换】及【矩阵变换MatrixTransform】
- 基本的2D图形变换&变换矩阵推导
- RenderTransform特效【五种基本变换】及【矩阵变换MatrixTransform】
- 矩阵变换
- 变换矩阵
- 矩阵变换
- 矩阵变换
- Silverlight学习笔记(九)-----RenderTransform特效【五种基本变换】及【矩阵变换MatrixTransform】
- Silverlight学习之RenderTransform特效(五种基本变换)及(矩阵变换MatrixTransform)
- 坐标变换 及矩阵变换
- 几何变换及变换矩阵
- 旋转矩阵和变换矩阵
- html的table跨行跨列合并
- Leetcode-19. Remove Nth Node From End of List
- jsp--javabeans
- [BZOJ3118]Orz the MST(单纯形)
- 欢迎使用CSDN-markdown编辑器
- 矩阵基本变换
- C++ STL 学习笔记 map multimap
- mysql相关问题
- C++学习记录5--如何使用math.h中定义的PI
- 漫谈计算机基础之信息的处理与表示(1)
- HDU 4607 Park Visit【思维】【图论】【搜索】
- 考研复试-操作系统知识点总结(一)
- 002.PHP遍历路径
- 推荐系统实战