storage class for holding the non-zero matrix elements class _matrixelementdef __init__selfrowcolvalue )self row row self col col self value value constructor the constructor defines three attributes for storing the data related to the sparse matrix the elementlist field stores matrixelement objects representing the non-zero elements instances of the storage class contain not only the value for specific element but also the row and column indices indicating its location within the matrix the numrows and numcols fields are used to store the dimensions of the matrix this information cannot be obtained from the element list as was done with the array used in the implementation of the matrix adt in helper method since the element list only contains the non-zero entriesaccessing an individual element is no longer as simple as directly referencing an element of the rectangular grid insteadwe must search through the list to locate specific non-zero element the helper method findposition(performs this linear search by iterating through the element list looking for an entry with the given row and column indices if foundit returns the list index of the cell containing the elementotherwisenone is returned to indicate the absence of the element elementlist numrows numcols sparsematrix _matrixelement row col value figure list of matrixelement objects representing sparse matrix