Commit 3247ca34 authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Added checking for negative number of elements

parent 61ce1e68
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -813,6 +813,11 @@ template< typename Real,
          typename Index >
void EllpackSymmetricGraph< Real, Device, Index >::allocateElements()
{
   IndexType numberOfMatrixElements = this->alignedRows * this->rowLengths;
   
   TNL_ASSERT_TRUE( this->alignedRows != 0 && numberOfMatrixElements / this->alignedRows == this->rowLengths, 
           "Ellpack cannot store this matrix. The number of matrix elements has overflown the value that IndexType is capable of storing" );
   
   Sparse< Real, Device, Index >::allocateMatrixElements( this->alignedRows * this->rowLengths );
}