53.1 Exception Types (.NET, C#, CSharp, VB, Visual Basic, F#)
The following exception classes inherit from NMathException.
Exception |
Description |
Thrown when MKL returns an error condition when computing an FFT. |
|
Thrown when an out of range index is passed to an NMath function. |
|
Thrown when an invalid argument is passed to an NMath function. |
|
Thrown when a histogram operation results in invalid bin boundaries. |
|
Thrown when NMath cannot load a kernel assembly. |
|
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:
Code Example – C#
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 );
}
Code Example – VB
Dim A As New DoubleComplexMatrix(3, 3, New DoubleComplex(1, 0))
Dim B As New DoubleComplexMatrix(2, 2, New DoubleComplex(1, 0))
Dim C As DoubleComplexMatrix
Try
C = A * B
Catch E As MismatchedSizeException
Console.WriteLine("Oops - " & E.Message)
End Try
Matrices must have the same dimensions to be combined using the element-wise operators.