Table of Contents

Class UFuncCastingError

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy's _UFuncCastingError: the base of the casting refusals, a cast between an operand and the loop's dtype that the casting= rule forbids. NumPy raises only its two subclasses, UFuncInputCastingError and UFuncOutputCastingError.

public class UFuncCastingError : UFuncTypeError, ISerializable, INumSharpException
Inheritance
UFuncCastingError
Implements
Derived
Inherited Members

Remarks

It carries casting, from_ and to. Created directly, its text is Python's str() of its arguments, (<ufunc 'add'>, 'safe', dtype('float64'), dtype('int64')), as NumPy gives the class no str.

Constructors

UFuncCastingError(string, Exception)

Creates the error from a message and the exception that caused it, .NET's standard constructor every NumSharp exception has: the message is kept verbatim and ufunc, casting, from_ and to are null.

public UFuncCastingError(string message, Exception innerException)

Parameters

message string

The verbatim message.

innerException Exception

The exception that led to this one, or null for none.

Remarks

Python has no such constructor (NumPy's _UFuncCastingError takes the ufunc, the rule and the two dtypes); for code that holds a text only.

UFuncCastingError(string, string, object, object)

NumPy's UFuncCastingError(ufunc, casting, from, to).

public UFuncCastingError(string ufunc, string casting, object from_, object to)

Parameters

ufunc string

The ufunc's name.

casting string

The rule (no, equiv, safe, same_kind, unsafe).

from_ object

The dtype the cast starts from.

to object

The dtype it would reach.

Exceptions

ArgumentNullException

ufunc is null.

UFuncCastingError(string, string, object, object, string)

The subclasses' form: the four values and the subclass's own text.

protected UFuncCastingError(string ufunc, string casting, object from_, object to, string message)

Parameters

ufunc string

The ufunc's name.

casting string

The rule.

from_ object

The dtype the cast starts from.

to object

The dtype it would reach.

message string

The text, already in NumPy's form.

Exceptions

ArgumentNullException

ufunc is null.

Properties

casting

The casting rule the cast broke (NumPy's casting: same_kind, safe, …).

public string casting { get; }

Property Value

string

from_

The dtype the cast starts from (NumPy's from_): a DType, or the placeholder for NumPy's object dtype (see UFuncTypeError).

public object from_ { get; }

Property Value

object

to

The dtype the cast would reach (NumPy's to): a DType, or the placeholder for NumPy's object dtype.

public object to { get; }

Property Value

object