SparseMatrix::SparseMatrix(const SparseMatrix& input){ rows = My_vec<RowLinkedList>(); this->set_rows(input.nrows); this->set_cols(input.ncols); for(int i = 0; i < input.nrows; i++){ rows.insert_at_rank(i, RowLinkedList(input.rows[i])); } }
SparseMatrix& SparseMatrix::operator=(const SparseMatrix& input){ rows = My_vec<RowLinkedList>(); this->set_rows(input.nrows); this->set_cols(input.ncols); for(int i = 0; i < input.nrows; i++){ rows.insert_at_rank(i, RowLinkedList(input.row(i))); } return *this; }
SparseMatrix::SparseMatrix(int m, int n){ rows = My_vec<RowLinkedList>(); nrows = n; for(int i = 0; i < nrows; i++){ rows.insert_at_rank(i, RowLinkedList()); } ncols = m; }
SparseMatrix::SparseMatrix(int m, int n) { //Sets rows and columns to values of m and n nrows = m; ncols = n; //Runs thru number of rows //Pushes back a RowLinkedList for each row for (int i =0; i<m; i++) { rows.push_back(RowLinkedList()); } }