没有合适的资源?快使用搜索试试~ 我知道了~
project4-good-example-2021fall-by董正1
需积分: 0 0 下载量 86 浏览量
2022-08-03
19:14:46
上传
评论
收藏 467KB PDF 举报
温馨提示
试读
18页
1. The class should contain the data of a matrix and related information. 2. The
资源详情
资源评论
资源推荐
CS205 Project 4 Report
11812804
董
正
CS205 Project 4 Report
1 Introduction
1.1 Project Description
1.2 Development Environment
2 Design and Implementation
2.1 Fields Of Matrix Class
2.2 Constructor: Avoid Mem Copy
2.3 ROI For Submatrix
2.3.1 Multi-level Submatrix
2.3.2 Submatrix Deletion
2.3.3 ROI Adjustment
2.4 Matrix Operations
2.4.1 Index Operator
2.4.2 Other Functions
3 x86 and Arm
3.1 Metrics: CPU Cycles
3.2 Test Platform
3.3 Dataset & Test Cases
3.4 Comparison On Matrix Multiplication
3.5 References
4 Conclusion
1 Introduction
The documentation of class
matrix
is hosted on my GitHub.
Alternatively, view this report online here.
1.1 Project Description
This project is to design a class for matrices.
1. The class should contain the data of a matrix and related information.
2. The class support different data types.
3. Do not use memory hard copy if a matrix object is assigned to another.
4. Implement some frequently used operators.
5. Implement region of interest (ROI) to avoid memory hard copy.
6. Test the program on X86 and Arm platforms, and describe the differences.
1.2 Development Environment
x86_64
Windows 10 Home China x86_64
Kernel version
10.0.19042
Intel i5
-
9300H (8) @ 2.400GHz
g.exe (tdm64
-
1) 10.3.0
C++ standard:
c11
Arm64
macOS 12.0.1 21A559 arm64
Darwin Kernel Version
21.1.0
Apple M1 Pro (10-cores)
Apple clang version 13.0.0 (clang
-
1300.0.29.3)
C++ standard:
c11
2 Design and Implementation
Header files and macros used in this section:
2.1 Fields Of Matrix Class
To support different data types, I used template class.
matrix
class has three basic fields:
data
is a 1D dynamic array containing all the elements of the matrix.
To avoid memory copy, I added a field named
ref_count
:
See details in section 2.2 below.
To support ROI, I used another pointer:
2.2 Constructor: Avoid Mem Copy
As the project required, it is forbidden to use hard copy if a matrix object is assigned
to another.
If use soft copy directly, there will be an error when freeing
data
array:
#include <fstream>
#include <iostream>
#defne STRASSEN_LOWER_BOUND 128
1
2
3
4
template <typename T>
class matrix {
int nrows;
int ncols;
T* data;
}
1
2
3
4
5
6
7
8
int ref_count;1
const matrix<T>* parent_matrix;1
matrix<int> m2 = m1; will set m2.data = m1.data1
剩余17页未读,继续阅读
无声远望
- 粉丝: 53
- 资源: 298
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0