Represents an exception that is thrown when the dimensions of Matrix or Vector objects are not compatible for the requested operation.

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (Extreme.Numerics)

Syntax

Visual Basic (Declaration)
Public Class DimensionMismatchException _
	Inherits ArgumentException
C#
public class DimensionMismatchException : ArgumentException
C++
public ref class DimensionMismatchException : public ArgumentException

Methods

IconTypeDescription
Equals(Object)
Determines whether the specified Object is equal to the current Object.
Finalize()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
GetBaseException()
When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
GetHashCode()
Serves as a hash function for a particular type.
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo with the data needed to serialize the target object.
GetType()
Gets the runtime type of the current instance.
MemberwiseClone()
Creates a shallow copy of the current Object.
ToString()
Creates and returns a string representation of the current exception.

Constructors

IconTypeDescription
DimensionMismatchExceptionNew()
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(DimensionType, String, DimensionType, String)
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(String, Exception, DimensionType, String, DimensionType, String)
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(DimensionType, String, DimensionType)
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(String)
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(DimensionType, String, String)
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(String, Exception)
Constructs a new DimensionMismatchException.
DimensionMismatchExceptionNew(SerializationInfo, StreamingContext)
Initializes a new instance of the MatrixNotPositiveDefiniteException class with serialized data.

Properties

IconTypeDescription
Data
Gets a collection of key/value pairs that provide additional, user-defined information about the exception.
FirstDimensionType
Gets which dimension of the first object was mismatched.
FirstParameterName
Gets the name of the first parameter whose dimensions were mismatched.
HelpLink
Gets or sets a link to the help file associated with this exception.
HResult
Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
InnerException
Gets the Exception instance that caused the current exception.
Message
Gets the error message and the parameter name, or only the error message if no parameter name is set.
ParamName
Gets the name of the parameter that causes this exception.
SecondDimensionType
Gets which dimension of the second object was mismatched.
SecondParameterName
Gets the name of the second parameter whose dimensions were mismatched.
Source
Gets or sets the name of the application or the object that causes the error.
StackTrace
Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite
Gets the method that throws the current exception.

Remarks

There are many reasons why a DimensionMismatchException may be thrown. In every case, the dimensions of some or all of the Vector or Matrix arguments involved in an operation are not compatible. Some examples of requirements that may be violated, resulting in a DimensionMismatchException, are:
  • A method requires a Matrix to be square. The matrix that was supplied is rectangular.
  • An operation on two Vector objects requires that the two vectors have the same length. Most operations on vectors have this requirement.
  • A multiplication of a Matrix and a Vector requires that either the number of rows or the number of columns in the matrix equals the length of the vector.
  • A multiplication of two matrices requires that the 'inner' dimensions are the same.

A number of properties give more information about the cause of the exception: FirstDimensionType, FirstParameterName, SecondDimensionType and SecondParameterName.

You can avoid this exception by verifying that the dimensions of the objects (_rowCount, _columnCount and/or Length) are compatible for the operation you want to perform.

Inheritance Hierarchy

System.Object
  System.Exception
    System.SystemException
      System.ArgumentException
        Extreme.Mathematics.DimensionMismatchException