Commit 61ce1e68 authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Added checking for negative number of elements

parent b9fcf23f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -599,6 +599,11 @@ template< typename Real,
          typename Index >
void EllpackSymmetric< 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 );
}