提交 d7881362 编写于 作者: sahduashufa's avatar sahduashufa

0.3

上级 0da2f10b
......@@ -4,6 +4,45 @@
## 0.1 矩阵定义:
​ api:
​ Create a matrix : create(row,cols)
​ Change the element for matrix void move_ele(int &ele1, int &ele2)
​ Matrix1+Matrix2 : Matrix add(Matrix mid1,Matrix mid2,int flag=1)
​ Flag is how to compete the ele ,default 1 ,bitwise operation.
​ flag标志,默认为1,使用位运算,在亿万级数据下,位运算平均速度优于其他方法,故而做了实现,深入理解.
​ Matrix1-Matrix2 : Matrix subtract(Matrix mid1,Matrix mid2)
​ Matrix1*Matrix2 : Matrix mul(Matrix mid1,Matrix mid2)
​ Matrix1*n : Matrix times_mat(int times,Matrix mid1)
​ Matrix1's Transposition : Matrix get_T(Matrix mid1)
​ double* flatten(Matrix mid1)
| 1 | 2 | 3 |
| :--: | :--: | :--: |
| 2 | 4 | 6 |
| 7 | 8 | 9 |
To
| 1 | 2 | 3 | 2 | 4 | 6 | 7 | 8 | 9 |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| | | | | | | | | |
Flatten:
一些细节:
1. 创建矩阵,默认为1^n
2. 动态分配内存,防止矩阵过大
3. 可修改的地方(已完成)
......
无法预览此类型文件
......@@ -12,15 +12,18 @@ using namespace std;
int main()
{
welcome();
Matrix a = CreateMatrix(3,4);
Matrix a = CreateMatrix(5,6);
Matrix b = CreateMatrix(3,11);
cout<<"end"<<endl;
change_va(a,1,2,1);
change_va(a,2,3,7);
change_va(a,3,3,2);
change_va(a,4,3,4);
change_va(a,0,0,9);
change_va(a,0,2,2);
change_va(a,1,1,8);
start = clock();
Matrix rs = matrix_rs(a,2,6);
Matrix rs = matrix_rs(a,6,5);
cout<<matrix_mean(a)<<endl;
/* add(a,b,1);
mul(a,b);
......
......@@ -139,7 +139,6 @@ Matrix matrix_rs(Matrix mid1,int rs_row,int rs_col)
int index_x = i/mid1.col;
int index_y = i%mid1.col;
*(p+i) = mid1.matrix[index_x][index_y];
// cout<<index_x<<","<<index_y<<*(p+i)<<endl;
}
int added = mid1.row*mid1.col;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册