|
Data Structures and Algorithms
with Object-Oriented Design Patterns in Python |
Two-dimensional arrays of floating-point numbers arise in many different scientific computations. Such arrays are usually called matrices . Mathematicians have studied the properties of matrices for many years and have developed an extensive repertoire of operations on matrices. In this section we consider two-dimensional matrices and examine the implementation of simple, matrix multiplication.
The dimensions of a two-dimensional matrix are referred to as the
rows and the columns of the matrix.
Program
defines a Matrix class
which provides two properties, numberOfRows and numberOfColumns.
The Matrix class has two plain integer instance attributes, _numberOfRows and _numberOfColumns, which record the dimensions of the matrix.