C# Class YAMP.ScalarValue

A scalar value, which is a complex double type.
Inheritance: NumericValue
Exibir arquivo Open project: FlorianRappl/YAMP Class Usage Examples

Public Methods

Method Description
Abs ( ) : double

Computes the absolute value of the current scalar.

AbsSquare ( ) : double

Computes the absolute value squared of the current scalar.

Add ( Value left, Value right ) : ScalarValue

Scalar + Scalar

Arccos ( ) : ScalarValue

Computes the inverse cosine of the scalar (arccos).

Arccot ( ) : ScalarValue

Computes the inverse cotangent of the scalar (arccot).

Arccsc ( ) : ScalarValue

Computes the inverse cosecant of the scalar (arccsc).

Arcsec ( ) : ScalarValue

Computes the inverse secant of the scalar (arcsec).

Arcsin ( ) : ScalarValue

Computes the inverse sine of the scalar (arcsin).

Arctan ( ) : ScalarValue

Computes the inverse tangent of the scalar (arctan).

Arg ( ) : double

Computes Atan2(imaginary, real), i.e. the angle in the complex (gaussian) plane.

Clear ( ) : void

Resets the current value.

Clone ( ) : ScalarValue

Copies the current instance.

ComplexSquare ( ) : ScalarValue

Computes z^* x z = |z|^2, which is AbsSquare().

Conjugate ( ) : ScalarValue

Conjugates the current scalar value, i.e. switches the sign of the imaginary value.

Copy ( ) : Value

Copies the current instance.

Cos ( ) : ScalarValue

Takes the cosine of the scalar.

Cot ( ) : ScalarValue

Takes the co-tangent (cos / sin) of the scalar.

Deserialize ( byte content ) : Value

Transforms a binary representation into a new instance.

Divide ( Value left, Value right ) : ScalarValue

Scalar / Scalar

Equals ( object obj ) : bool

Is the given object equal to this.

Exp ( ) : ScalarValue

Takes the exponential of the scalar.

Factorial ( ) : ScalarValue

Computes the factorial of the scalar.

GetHashCode ( ) : int

Computes the hashcode of the value inside.

GetIntegerOrThrowException ( String argumentName, String functionName ) : int

Gets the integer value or throws an exception if either the imaginary part is not 0 or the real part is not integer.

GetLengthOfString ( ParseContext context ) : Int32

Gets the length of the output in the given parse context.

Ln ( ) : ScalarValue

Takes the natural logarithm of the scalar.

Log ( ) : ScalarValue

Takes the natural logarithm of the scalar.

Log ( double basis ) : ScalarValue

Takes the general logarithm of the scalar.

Log10 ( ) : ScalarValue

Takes the base-10 logarithm of the scalar.

Mod ( Value left, Value right ) : ScalarValue

Scalar % Scalar

Multiply ( Value left, Value right ) : ScalarValue

Scalar * Scalar

Pow ( ScalarValue exponent ) : ScalarValue

Raises the scalar to the specified power.

Pow ( Value basis, Value exponent ) : ScalarValue

Scalar ^ Scalar

ScalarValue ( ) : System

Creates a new empty scalar value.

ScalarValue ( ScalarValue value ) : System

Creates a new scalar value from the given one.

ScalarValue ( bool boolean ) : System

Creates a new scalar value from a boolean, i.e. 1.0 or 0.0.

ScalarValue ( double real ) : System

Creates a new scalar value which is real.

ScalarValue ( double real, double imag ) : System

Creates a new scalar value with the given complex parameters.

Serialize ( ) : byte[]

Transforms the instance into a binary representation.

Sign ( ) : ScalarValue

Gives the signum of the scalar.

Sin ( ) : ScalarValue

Takes the sine of the scalar.

Sqrt ( ) : ScalarValue

Takes the square root of the scalar.

Square ( ) : ScalarValue

Computes z x z = z^2.

Subtract ( Value left, Value right ) : ScalarValue

Scalar - Scalar

Tan ( ) : ScalarValue

Takes the tangent (sin / cos) of the scalar.

ToString ( ParseContext context ) : String

Uses the standard string representation.

ToString ( ParseContext context, Int32 exponent ) : String

Use this string representation if you have a global exponent like everything is already e5 or similar. In this case the values get multiplied with e-5 for the output.

operator ( ) : ScalarValue

a % b.

operator ( ) : bool

l != r.

Protected Methods

Method Description
RegisterOperators ( ) : void

Registers all operators that are associated with the scalar.

Private Methods

Method Description
IsPrimeNumber ( int n ) : bool
IsProbablyPrime ( int n, int m, int s, int d, int w ) : bool
PowMod ( int b, int e, int m ) : int

Method Details

Abs() public method

Computes the absolute value of the current scalar.
public Abs ( ) : double
return double

AbsSquare() public method

Computes the absolute value squared of the current scalar.
public AbsSquare ( ) : double
return double

Add() public static method

Scalar + Scalar
public static Add ( Value left, Value right ) : ScalarValue
left Value Must be a scalar.
right Value Must be a scalar.
return ScalarValue

Arccos() public method

Computes the inverse cosine of the scalar (arccos).
public Arccos ( ) : ScalarValue
return ScalarValue

Arccot() public method

Computes the inverse cotangent of the scalar (arccot).
public Arccot ( ) : ScalarValue
return ScalarValue

Arccsc() public method

Computes the inverse cosecant of the scalar (arccsc).
public Arccsc ( ) : ScalarValue
return ScalarValue

Arcsec() public method

Computes the inverse secant of the scalar (arcsec).
public Arcsec ( ) : ScalarValue
return ScalarValue

Arcsin() public method

Computes the inverse sine of the scalar (arcsin).
public Arcsin ( ) : ScalarValue
return ScalarValue

Arctan() public method

Computes the inverse tangent of the scalar (arctan).
public Arctan ( ) : ScalarValue
return ScalarValue

Arg() public method

Computes Atan2(imaginary, real), i.e. the angle in the complex (gaussian) plane.
public Arg ( ) : double
return double

Clear() public method

Resets the current value.
public Clear ( ) : void
return void

Clone() public method

Copies the current instance.
public Clone ( ) : ScalarValue
return ScalarValue

ComplexSquare() public method

Computes z^* x z = |z|^2, which is AbsSquare().
public ComplexSquare ( ) : ScalarValue
return ScalarValue

Conjugate() public method

Conjugates the current scalar value, i.e. switches the sign of the imaginary value.
public Conjugate ( ) : ScalarValue
return ScalarValue

Copy() public method

Copies the current instance.
public Copy ( ) : Value
return Value

Cos() public method

Takes the cosine of the scalar.
public Cos ( ) : ScalarValue
return ScalarValue

Cot() public method

Takes the co-tangent (cos / sin) of the scalar.
public Cot ( ) : ScalarValue
return ScalarValue

Deserialize() public method

Transforms a binary representation into a new instance.
public Deserialize ( byte content ) : Value
content byte The binary data.
return Value

Divide() public static method

Scalar / Scalar
public static Divide ( Value left, Value right ) : ScalarValue
left Value Must be a scalar.
right Value Must be a scalar.
return ScalarValue

Equals() public method

Is the given object equal to this.
public Equals ( object obj ) : bool
obj object The compare object.
return bool

Exp() public method

Takes the exponential of the scalar.
public Exp ( ) : ScalarValue
return ScalarValue

Factorial() public method

Computes the factorial of the scalar.
public Factorial ( ) : ScalarValue
return ScalarValue

GetHashCode() public method

Computes the hashcode of the value inside.
public GetHashCode ( ) : int
return int

GetIntegerOrThrowException() public method

Gets the integer value or throws an exception if either the imaginary part is not 0 or the real part is not integer.
public GetIntegerOrThrowException ( String argumentName, String functionName ) : int
argumentName String The name of the variable that is requested.
functionName String The name of the function where this is requested.
return int

GetLengthOfString() public method

Gets the length of the output in the given parse context.
public GetLengthOfString ( ParseContext context ) : Int32
context ParseContext The query context to consider.
return System.Int32

Ln() public method

Takes the natural logarithm of the scalar.
public Ln ( ) : ScalarValue
return ScalarValue

Log() public method

Takes the natural logarithm of the scalar.
public Log ( ) : ScalarValue
return ScalarValue

Log() public method

Takes the general logarithm of the scalar.
public Log ( double basis ) : ScalarValue
basis double The basis to use for the logarithm.
return ScalarValue

Log10() public method

Takes the base-10 logarithm of the scalar.
public Log10 ( ) : ScalarValue
return ScalarValue

Mod() public static method

Scalar % Scalar
public static Mod ( Value left, Value right ) : ScalarValue
left Value Must be a scalar.
right Value Must be a scalar.
return ScalarValue

Multiply() public static method

Scalar * Scalar
public static Multiply ( Value left, Value right ) : ScalarValue
left Value Must be a scalar.
right Value Must be a scalar.
return ScalarValue

Pow() public method

Raises the scalar to the specified power.
public Pow ( ScalarValue exponent ) : ScalarValue
exponent ScalarValue The exponent for raising the scalar.
return ScalarValue

Pow() public static method

Scalar ^ Scalar
public static Pow ( Value basis, Value exponent ) : ScalarValue
basis Value Must be a scalar.
exponent Value Must be a scalar.
return ScalarValue

RegisterOperators() protected method

Registers all operators that are associated with the scalar.
protected RegisterOperators ( ) : void
return void

ScalarValue() public method

Creates a new empty scalar value.
public ScalarValue ( ) : System
return System

ScalarValue() public method

Creates a new scalar value from the given one.
public ScalarValue ( ScalarValue value ) : System
value ScalarValue Copies the contents of the given value.
return System

ScalarValue() public method

Creates a new scalar value from a boolean, i.e. 1.0 or 0.0.
public ScalarValue ( bool boolean ) : System
boolean bool True for 1.0, False for 0.0.
return System

ScalarValue() public method

Creates a new scalar value which is real.
public ScalarValue ( double real ) : System
real double The real value.
return System

ScalarValue() public method

Creates a new scalar value with the given complex parameters.
public ScalarValue ( double real, double imag ) : System
real double The real part of the complex scalar.
imag double The imaginary part of the complex scalar.
return System

Serialize() public method

Transforms the instance into a binary representation.
public Serialize ( ) : byte[]
return byte[]

Sign() public method

Gives the signum of the scalar.
public Sign ( ) : ScalarValue
return ScalarValue

Sin() public method

Takes the sine of the scalar.
public Sin ( ) : ScalarValue
return ScalarValue

Sqrt() public method

Takes the square root of the scalar.
public Sqrt ( ) : ScalarValue
return ScalarValue

Square() public method

Computes z x z = z^2.
public Square ( ) : ScalarValue
return ScalarValue

Subtract() public static method

Scalar - Scalar
public static Subtract ( Value left, Value right ) : ScalarValue
left Value Must be a scalar.
right Value Must be a scalar.
return ScalarValue

Tan() public method

Takes the tangent (sin / cos) of the scalar.
public Tan ( ) : ScalarValue
return ScalarValue

ToString() public method

Uses the standard string representation.
public ToString ( ParseContext context ) : String
context ParseContext The context to use.
return String

ToString() public method

Use this string representation if you have a global exponent like everything is already e5 or similar. In this case the values get multiplied with e-5 for the output.
public ToString ( ParseContext context, Int32 exponent ) : String
context ParseContext The parse context to use.
exponent System.Int32 The global exponent that is in use.
return String

operator() public static method

a % b.
public static operator ( ) : ScalarValue
return ScalarValue

operator() public static method

l != r.
public static operator ( ) : bool
return bool