A Symmetric Matrix is a square matrix that is the same as the transpose of itself. CPSC2190 Assignment 05 Due date: November 13, 2008 Naoya Makino: 100106040 Purpose: Design an ADT symmetric_matrix.
A Symmetric Matrix is a square matrix that is the same as the transpose of itself. CPSC2190 Assignment 05 Due date: November 13, 2008 Naoya Makino: 100106040 Purpose: Design an ADT symmetric_matrix.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
A Symmetric Matrix is a square matrix that is the same as the transpose of itself. CPSC2190 Assignment 05 Due date: November 13, 2008 Naoya Makino: 100106040 Purpose: Design an ADT symmetric_matrix.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
Naoya Makino: 100106040 Purpose: Design an ADT symmetric_matrix. Definitions: A symmetric matrix is a square matrix that is the same as the transpose of itself. Symmetric_matrix ADT Method Description Constructors Symmetric_Matrix(size_type size) Default constructor with zero item Symmetric_Matrix(size_type size, data Constructor with data values[]) Symmetirc_Matrix(const Symmetirc_Matrix Copy constructor &that) ~Symmetirc_Matrix() Destructor Accessor size_type size() const Return the size of the matrix Bool is_symmetric() Check if this matrix is symmetric data get_item(size_type i, size_type j) Access for cell M[i][j] Mutators Void clear() Erase the matrix Void erase(size_type row, size_type col) Erase the value of the given row and col Void change_item(size_type row, size_type Change the item in the matrix; it automatically col, int item) changes the transpose of the item as well. Private data values[] Elements in one dimensional array
Addressing formula for cell data[i][j]
index = i*(i-1)/2+j return item = values[index] How to find determine the size of values[]: n*(n+1)/2 //where n is the size of the row or column Reference: Boost C++ Libraries - Symmetric Matrix, http://www.boost.org/doc/libs/1_31_0/libs/numeric/ublas/doc/symmetric.htm, November 06, 2008. National Institute of Science and Technology
http://www.nist.gov/dads/HTML/lowerTriangularMatrix.html, November 12, 2008.