namespace lasd { /* ************************************************************************** */ template MatrixCSR::MatrixCSR(){ R[0] = &head; } template MatrixCSR::MatrixCSR(const ulong& r, const ulong& c){ rows = r; columns = c; R.Resize(rows+1); for(ulong i=0 ; i MatrixCSR::MatrixCSR(const MatrixCSR& toCopy) : MatrixCSR(toCopy.rows, toCopy.columns) { /* For each element in the "R" vector, insert it in the matrix (represented as a list) in this way: The row index is represented by "i" (the variable that iterates over the R array), meanwhile the column index is represented by the second element in the pair of the node. The actual element is stored in the first element in the pair of the node. The update of the newely created R array is left to operator()(). */ for(ulong i=0 ; i < (toCopy.R.Size()-1) ; ++i){ for(Node** ptr = toCopy.R[i] ; ptr!=toCopy.R[i+1] ; ptr = &( (*(*ptr)).next ) ){ (*this)(i , ((*ptr)->value).second) = (*ptr)->value).first; } } } template MatrixCSR::MatrixCSR(MatrixCSR&& toMove) : MatrixCSR() noexcept{ // controllare se chiamare MatrixCSR() std::swap(rows, toMove.rows); std::swap(columns, toMove.columns); std::swap(size, toMove.size); std::swap(head, toMove.head); std::swap(R, toMove.R); toMove.R[0] = &toMove.head; Node** oldHead = R[0]; for(ulong i=0 ; i MatrixCSR::~MatrixCSR(){ Clear(); } template MatrixCSR& MatrixCSR::operator=(const MatrixCSR& toCopy){ MatrixCSR tmp(toCopy); std::swap(*this, tmp); delete tmp; return *this; } template MatrixCSR& MatrixCSR::operator=(MatrixCSR&& toMove) noexcept{ MatrixCSR tmp(std::move(toMove)); std::swap(*this, tmp); delete tmp; return *this; } template bool MatrixCSR::operator==(const MatrixCSR& toCompare) const noexcept{ } template bool MatrixCSR::operator!=(const MatrixCSR& toCompare) const noexcept{ return !(*this == toCompare); } template void RowResize(const ulong& new_row_size){ R.Resize(new_row_size+1); for(ulong i=rows ; i