Table of Contents

Class LinAlgError

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy-compatible numpy.linalg.LinAlgError. Raised by np.linalg when a matrix is unsuitable for the requested factorisation — the wrong rank, not square, singular, or not positive definite.

public class LinAlgError : ValueError, ISerializable, INumSharpException
Inheritance
LinAlgError
Implements
Inherited Members

Remarks

Mirrors numpy.linalg.LinAlgError, which derives from Python's ValueError — so this derives from ValueError and a catch (ValueError) sees it, exactly as except ValueError does upstream.

The messages NumPy 2.4.2 raises verbatim (probed):

  • {n}-dimensional array given. Array must be at least two-dimensional
  • {n}-dimensional array given. Array must be two-dimensional
  • Last 2 dimensions of the array must be square
  • Singular matrix
  • Matrix is not positive definite
  • Array must not contain infs or NaNs

Constructors

LinAlgError()

public LinAlgError()

LinAlgError(string)

public LinAlgError(string message)

Parameters

message string

LinAlgError(string, Exception)

public LinAlgError(string message, Exception innerException)

Parameters

message string
innerException Exception