TOC |
Previous |
Next |
Index
32.1 Exception Types
(.NET, C#, CSharp, Visual Basic, VB.NET)
The following exception classes inherit from NMathException.
Table 21 - Exception classes
| Exception |
Description |
| |
Thrown when an invalid argument is passed to an NMath function. |
| |
Thrown when a histogram operation results in invalid bin boundaries. |
| |
Thrown when a matrix operation requiring a square matrix is presented with a non-square one. |
| |
Exception thrown when an operation is performed with operands whose sizes are incompatible with the operation; for example, if you try to add two vectors with different lengths, or take the inner product of matrices A and B when the number of columns of A is not equal to the number of rows of B. |
| |
Thrown when a method encounters a faulty text representation; for example, if you try to create a vector from a string that has an invalid format. |
| |
Thrown when a matrix operation requiring a non-singular matrix is presented with a singular one. |
For example, this code attempts to multiply two matrices with different dimensions, and catches a MismatchedSizeException:
DoubleComplexMatrix A =
new DoubleComplexMatrix( 3, 3, new DoubleComplex(1,0) );
DoubleComplexMatrix B =
new DoubleComplexMatrix( 2, 2, new DoubleComplex(1,0) );
DoubleComplexMatrix C;
try
{
C = A * B;
}
catch( MismatchedSizeException e )
{
Console.WriteLine( "Oops - " + e.Message );
}
Matrices must have the same dimensions to be combined using the element-wise operators.
TOC |
Previous |
Next |
Index