辅导案例-COMP6771 /
2020/8/18 q2/README.md · master · COMP6771 / COMP6771 20T2 Exam SPECIFICATION · GitLab https://gitlab.cse.unsw.edu.au/COMP6771/20T2-cs6771-exam-spec/-/blob/master/q2/README.md 1/5 Exam Ready Hayden Smith authored 5 hours ago 0329f4e6 Matrices, usually two-dimensional tables of scalar values, are an important tool in mathematics,engineering and science. You will be constructing a C++ class that is able to encode a matrix, together with a series of matrix operations. The horizontal lines of a matrix are called rows and the vertical lines are called columns. A matrix with m rows and n columns is referred to as an m-by-n(m x n) matrix. The entry at row i and column j is the (i, j)-th entry. For example, a 4×3 matrix is: Note that matrix rows and columns are zero-indexed. Various operations can be performed on matrices. Addition and subtraction, defined for matrices of identical dimensions, is achieved by element-wise addition and subtraction respectively; multiplication, defined for an m×n matrix multiplied with an n×p matrix, is achieved via row-by-column multiplication; transposition, achieved by turning rows into columns and vice-versa, and more... Sparse matrices are matrices with relatively few non-zero elements (as opposed to 'regular', dense matrices that have few zero elements). Working with complex partial differential equations typically involves very large sparse matrices. It quickly becomes impractical to store such matrices in a dense format, e.g., a 10,000 × 10,000 matrix of integers would require ∼400MB of space. Instead, you will use a much more compact sparse representation, together with appropriately optimised operations. Such a sparse matrix class might appear in a C++ high-performance mathematics library. You are required to write a C++ class for sparse matrices that operates on any non-floating numeric type. The specification is provided below. Functions that have friend alternatives, or const-qualified alternatives, are omitted from the specification due to their semantic similarity. However, all are required to be provided. You are required to use the following representation for your sparse storage format for an m x n matrix with k non-zero entries.