|
Code Packages
1
Add-on code processing modules
|
Numeric array class provides a generic array data type and a usefull set of numeric array calculations. More...
Public Member Functions | |
| NArray (T[] value) | |
| Initialize a new instance of NArray class using another array More... | |
| NArray (int size) | |
| Initialize a new instance of NArray class More... | |
| void | Add (T arg) |
| Used internally for initialization upon declaration. More... | |
| void | Clear () |
| Clears all items of the NArray More... | |
| NArray< T > | Copy () |
| override bool | Equals (object obj) |
| IEnumerator | GetEnumerator () |
| Returns an enumerator that iterates through a collection. More... | |
| override int | GetHashCode () |
| override string | ToString () |
| Converts the NArray to its string representation More... | |
Static Public Member Functions | |
| static double [] | Abs (double[] A) |
| Calculate the absolute value on each sample of a real array More... | |
| static double [] | Acos (double[] A) |
| Calculate the arccosine on each sample of a real array More... | |
| static Complex [] | Acos (Complex[] A) |
| Calculate the arcsine on each sample of a complex array More... | |
| static T [] | Add< T > (params T[][] args) |
| Perform addition on multiple arrays More... | |
| static T [] | Add< T > (T[] A, T value) |
| Add all samples of an array with a specified value More... | |
| static bool [] | AND (params bool[][] args) |
| AND Gate More... | |
| static double [] | Asin (double[] A) |
| Calculate the arcsine on each sample of a real array More... | |
| static Complex [] | Asin (Complex[] A) |
| Calculate the arccosine on each sample of a complex array More... | |
| static double [] | Atan (double[] A) |
| Calculate the arctangent on each sample of a real array More... | |
| static Complex [] | Atan (Complex[] A) |
| Calculate the arctangent on each sample of a complex array More... | |
| static double [] | Atan2 (double[] A, double[] B) |
| Calculate the arctangent using the quotient of two real arrays More... | |
| static Complex [] | Conjugate (Complex[] A) |
| Returns the complex conjugate of a complex array More... | |
| static double [] | Cos (double[] A) |
| Calculate the cosine on each sample of a real array More... | |
| static Complex [] | Cos (Complex[] A) |
| Calculate the cosine on each sample of a complex array More... | |
| static double [] | Cosh (double[] A) |
| Calculate the hyperbolic cosine on each sample of a real array More... | |
| static Complex [] | Cosh (Complex[] A) |
| Calculate the hyperbolic cosine on each sample of a complex array. More... | |
| static double [] | DegToRad (double[] A) |
| Convert a set of values representing degrees into radians More... | |
| static T [] | Div< T > (T[] A, T[] B) |
| Perform division using two arrays More... | |
| static T [] | Div< T > (T[] A, T value) |
| Divide all samples of an array with a the specified value More... | |
| static double [] | Img (Complex[] A) |
| Get the imaginary part of a complex array More... | |
| static bool | IsInfinity (double[] A) |
| Check if a real array contains a sample that has infinite value More... | |
| static bool | IsInfinity (Complex[] A) |
| Check if a complex array contains a sample that has infinite value More... | |
| static bool | IsNaN (double[] A) |
| Check if a real array contains a sample that is not a number More... | |
| static bool | IsNaN (Complex[] A) |
| Check if a complex array contains a sample that is not a number More... | |
| static bool | IsSizeEqual< T > (params T[][] args) |
| Check if the specified arrays have equal size More... | |
| static bool | IsSizeEven< T > (T[] A) |
| Check if an array has an even number of samples More... | |
| static T [] | LeftShift< T > (T[] A, int samples, T value) |
| Left shift an array by number of samples with value feed More... | |
| static double [] | Ln (double[] A) |
| Calculate the natural logarithm on each sample of a real array More... | |
| static Complex [] | Ln (Complex[] A) |
| Calculate the natural logarithm on each sample of a complex array More... | |
| static double [] | Log (double[] A, double _base) |
| Calculate the logarithm on each sample of a real array using the specified base More... | |
| static Complex [] | Log (Complex[] A, double _base) |
| Calculate the logarithm on each sample of a complex array using a real base More... | |
| static Complex [] | Log (Complex[] A, Complex _base) |
| Calculate the logarithm on each sample of a complex array using a complex base More... | |
| static double [] | Log10 (double[] A) |
| Calculate the logarithm of base10 on each sample of a real array More... | |
| static Complex [] | Log10 (Complex[] A) |
| Calculate the logarithm of base10 on each sample of a complex array More... | |
| static double [] | Magnitude (Complex[] A) |
| Returns the magnitude (abs) on each sample of a complex array More... | |
| static int | MaxSize< T > (params T[][] args) |
| Returns the maximum size found on multiple arrays More... | |
| static T [] | Merge< T > (params T[][] args) |
| Concatenate multiple arrays More... | |
| static int | MinSize< T > (params T[][] args) |
| Returns the minimum size found on multiple arrays More... | |
| static T [] | Mul< T > (params T[][] args) |
| Perform multiplication on multiple arrays More... | |
| static T [] | Mul< T > (T[] A, T value) |
| Multiply all samples of an array with the specified value More... | |
| static T [] | Negate< T > (T[] A) |
| Returns the additive reverse (opposite) of an array More... | |
| static bool [] | NOT (bool[] A) |
| NOT Gate More... | |
| static implicit | operator NArray< T > (T[] value) |
| Converts (implicitly) an array to NArray More... | |
| static implicit | operator T[] (NArray< T > value) |
| Converts (implicitly) a NArray to array More... | |
| static bool | operator!= (NArray< T > A, NArray< T > B) |
| Inequality check of two NArray More... | |
| static NArray< T > | operator* (NArray< T > A, NArray< T > B) |
| Performs NArray multiplication More... | |
| static NArray< T > | operator* (NArray< T > A, T value) |
| Performs multiplication using a scalar More... | |
| static NArray< T > | operator+ (NArray< T > A, NArray< T > B) |
| Performs NArray addition More... | |
| static NArray< T > | operator+ (NArray< T > A, T value) |
| Performs addition using a scalar More... | |
| static NArray< T > | operator- (NArray< T > A, NArray< T > B) |
| Performs NArray subtraction More... | |
| static NArray< T > | operator- (NArray< T > A, T value) |
| Performs subtraction using a scalar More... | |
| static NArray< T > | operator- (NArray< T > A) |
| Negates (opposite) all items in NArray More... | |
| static NArray< T > | operator/ (NArray< T > A, NArray< T > B) |
| Performs NArray division More... | |
| static NArray< T > | operator/ (NArray< T > A, T value) |
| Performs division using a scalar More... | |
| static bool | operator== (NArray< T > A, NArray< T > B) |
| Equality check of two NArray More... | |
| static bool [] | OR (params bool[][] args) |
| OR Gate More... | |
| static T [] | Padd< T > (T[] A, int samples, T value) |
| Padd an array by number of samples using value fill More... | |
| static T [] | PaddRadix2< T > (T[] A, T value) |
| Padd an array till size reach a power of two using value fill More... | |
| static double [] | Phase (Complex[] A) |
| Returns the phase in radians on each sample of a complex array More... | |
| static Complex [] | PolarToRec (double[] A_mag, double[] A_phase) |
| Polar-to-Rectangular array conversion More... | |
| static double [] | Pow (double[] A, double exponent) |
| Calculate power on each sample of a real array using the specified exponent More... | |
| static double [] | Pow (double[] A, int exponent) |
| Calculate power on each sample of a real array using the specified exponent More... | |
| static Complex [] | Pow (Complex[] A, double exponent) |
| Calculate power on each sample of a complex array using the specified exponent More... | |
| static double [] | Power (Complex[] A) |
| Returns the Power (absolute square) on each sample of a complex array More... | |
| static double [] | RadToDeg (double[] A) |
| Convert a set of values representing radians into degrees More... | |
| static T [] | Range2< T > (T[] A, int start, int size) |
| static T [] | Range< T > (T[] A, int start, int samples) |
| Extract a range of samples from an array More... | |
| static double [] | Real (Complex[] A) |
| Get the real part of a complex array More... | |
| static Complex [] | RealToComplex (double[] A) |
| Converts a real array into a complex array More... | |
| static double [] | Reciprocal (double[] A) |
| Returns the multiplicative inverse of a real array More... | |
| static Complex [] | Reciprocal (Complex[] A) |
| Returns the multiplicative inverse of a complex array More... | |
| static T [] | Replicate< T > (T[] A, int times) |
| Replicate an array by number of times More... | |
| static T [] | Reverse< T > (T[] A) |
| Reverse the order of the samples in an array More... | |
| static T [] | RightShift< T > (T[] A, int samples, T value) |
| Right shift an array by number of samples with value feed More... | |
| static T [] | Rotate< T > (T[] A, int samples) |
| Rotate an array by number of samples More... | |
| static double [] | Round (double[] A, int decimals) |
| Round the samples of a real array by the number of decimal digits More... | |
| static Complex [] | Round (Complex[] A, int decimals) |
| Round the samples of a complex array by the number of decimal digits More... | |
| static double [] | SetInfinity (double[] A, double value) |
| Replace any infinite values found on a real array with the specified real value More... | |
| static Complex [] | SetInfinity (Complex[] A, Complex c) |
| Replace any infinite values found on a complex array with the specified complex value More... | |
| static double [] | SetNaN (double[] A, double value) |
| Replace any NaN values found on a real array with the specified real value More... | |
| static Complex [] | SetNaN (Complex[] A, Complex c) |
| Replace any NaN values found on a complex array with the specified complex value More... | |
| static double [] | Sin (double[] A) |
| Calculate the sine on each sample of a real array More... | |
| static Complex [] | Sin (Complex[] A) |
| Calculate the sine on each sample of a complex array More... | |
| static double [] | Sinh (double[] A) |
| Calculate the hyperbolic sine on each sample of a real array More... | |
| static Complex [] | Sinh (Complex[] A) |
| Calculate the hyperbolic sine on each sample of a complex array More... | |
| static double [] | Sort (double[] A) |
| Sorts a set of real values in ascending order More... | |
| static double [] | Sqrt (double[] A) |
| Calculate the square root on each sample of a real array More... | |
| static Complex [] | Sqrt (Complex[] A) |
| Calculate the square root on each sample of a complex array More... | |
| static T [] | Sub< T > (T[] A, T[] B) |
| Subtracts an array from another array More... | |
| static T [] | Sub< T > (T[] A, T value) |
| Subtract all samples of an array with a value More... | |
| static double [] | Tan (double[] A) |
| Calculate the tangent on each sample of a real array More... | |
| static Complex [] | Tan (Complex[] A) |
| Calculate the tangent on each sample of a complex array More... | |
| static double [] | Tanh (double[] A) |
| Calculate the hyperbolic tangent on each sample of a real array More... | |
| static Complex [] | Tanh (Complex[] A) |
| Calculate the hyperbolic tangent on each sample of a complex array. More... | |
| static double [] | ToDouble (bool[] A) |
| Convert boolean array into double array More... | |
| static string | ToString< T > (T[] A, string seperator) |
| Converts an array into its string representation More... | |
| static string | ToString< T > (T[] A) |
| Converts an array into its string representation More... | |
| static bool [] | XOR (params bool[][] args) |
| XOR Gate Array More... | |
Properties | |
| int | Size [get] |
| Gets the size of the NArray More... | |
| T | this[int index] [get, set] |
| Provides indexing in NArray More... | |
Numeric array class provides a generic array data type and a usefull set of numeric array calculations.
Provides basic array calculations.
NArray supports many data types such as NArray<int>, NArray<double>, NArray<Complex>, etc.
Note: A class instance is a reference type, not a value type.
| T | specified element data type |
| dsp.NArray< T >.NArray | ( | T [] | value | ) |
Initialize a new instance of NArray class using another array
Narray is created with a reference in the provided array
| value | generic type array |
Example 1
Example 2
Assign of an array using the implicit operator.
| dsp.NArray< T >.NArray | ( | int | size | ) |
Initialize a new instance of NArray class
| size | size of the array |
Example 1
The following example creates an empty NArray with 3 items.
Each item is a double data type.
Example 2
The following example instantiates NArray with default values.
Element type is double
|
static |
Calculate the absolute value on each sample of a real array
|
static |
Calculate the arccosine on each sample of a real array
|
static |
Calculate the arcsine on each sample of a complex array
| void dsp.NArray< T >.Add | ( | T | arg | ) |
Used internally for initialization upon declaration.
Do not use this method!
|
static |
|
static |
|
static |
AND Gate
The AND gate is a boolean logic gate that returns True if all its inputs are True
|
static |
Calculate the arcsine on each sample of a real array
|
static |
Calculate the arccosine on each sample of a complex array
|
static |
Calculate the arctangent on each sample of a real array
|
static |
Calculate the arctangent on each sample of a complex array
|
static |
Calculate the arctangent using the quotient of two real arrays
| void dsp.NArray< T >.Clear | ( | ) |
Clears all items of the NArray
Example
|
static |
Returns the complex conjugate of a complex array
Uses Complex.Conjugate
| NArray<T> dsp.NArray< T >.Copy | ( | ) |
|
static |
Calculate the cosine on each sample of a real array
|
static |
Calculate the cosine on each sample of a complex array
|
static |
Calculate the hyperbolic cosine on each sample of a real array
|
static |
Calculate the hyperbolic cosine on each sample of a complex array.
|
static |
Convert a set of values representing degrees into radians
| A | array with real values representng degrees |
|
static |
|
static |
| override bool dsp.NArray< T >.Equals | ( | object | obj | ) |
| IEnumerator dsp.NArray< T >.GetEnumerator | ( | ) |
Returns an enumerator that iterates through a collection.
| override int dsp.NArray< T >.GetHashCode | ( | ) |
|
static |
Get the imaginary part of a complex array
Uses Complex.Img
|
static |
Check if a real array contains a sample that has infinite value
|
static |
Check if a complex array contains a sample that has infinite value
|
static |
Check if a real array contains a sample that is not a number
|
static |
Check if a complex array contains a sample that is not a number
|
static |
Check if the specified arrays have equal size
| args | arrays |
|
static |
Check if an array has an even number of samples
| A | array |
|
static |
Left shift an array by number of samples with value feed
Shift amount must be less or equal the size of the array.
| A | array |
| samples | shift amount |
| value | feed value |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Calculate the natural logarithm on each sample of a real array
|
static |
Calculate the natural logarithm on each sample of a complex array
|
static |
Calculate the logarithm on each sample of a real array using the specified base
|
static |
Calculate the logarithm on each sample of a complex array using a real base
|
static |
Calculate the logarithm on each sample of a complex array using a complex base
|
static |
Calculate the logarithm of base10 on each sample of a real array
|
static |
Calculate the logarithm of base10 on each sample of a complex array
|
static |
Returns the magnitude (abs) on each sample of a complex array
Uses Complex.Magnitude
|
static |
Returns the maximum size found on multiple arrays
| args | arrays |
|
static |
Concatenate multiple arrays
| args | arrays |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Returns the minimum size found on multiple arrays
| args | arrays |
|
static |
|
static |
|
static |
|
static |
NOT Gate
The NOT gate is a boolean logic gate that returns an inverted version of the input
|
static |
Converts (implicitly) an array to NArray
Narray assigns a reference in the provided array
| value | generic type array |
Example
|
static |
|
static |
|
static |
|
static |
Performs multiplication using a scalar
| A | input NArray |
| value | scalar value |

Example
Item type is double
|
static |
|
static |
Performs addition using a scalar
| A | input NArray |
| value | scalar value |

Example
Item type is double
|
static |
|
static |
Performs subtraction using a scalar
| A | input NArray |
| value | scalar value |

Example
Item type is double
|
static |
|
static |
|
static |
Performs division using a scalar
| A | input NArray (divident) |
| value | scalar value (divisor) |

Example
Item type is double
|
static |
|
static |
OR Gate
The OR gate is a boolean logic gate that returns True if one or more of its inputs are True
|
static |
Padd an array by number of samples using value fill
| A | array |
| samples | padded size |
| value | padded value |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Padd an array till size reach a power of two using value fill
If input size N is a power of 2 a copy of the array is returned.
| A | array |
| value | padded value |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Returns the phase in radians on each sample of a complex array
Uses Complex.Phase
|
static |
Polar-to-Rectangular array conversion
Uses Complex.PolarToRec
|
static |
Calculate power on each sample of a real array using the specified exponent
|
static |
Calculate power on each sample of a real array using the specified exponent
|
static |
Calculate power on each sample of a complex array using the specified exponent
|
static |
Returns the Power (absolute square) on each sample of a complex array
Uses Complex.Power
|
static |
Convert a set of values representing radians into degrees
| A | array with real values representing radians |
|
static |
|
static |
Extract a range of samples from an array
| A | array |
| start | index to start the range (zero based) |
| samples | range size |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Get the real part of a complex array
Uses Complex.Real
|
static |
Converts a real array into a complex array
|
static |
Returns the multiplicative inverse of a real array
|
static |
Returns the multiplicative inverse of a complex array
|
static |
Replicate an array by number of times
| A | array |
| times | replication amount |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Reverse the order of the samples in an array
| A | array |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Right shift an array by number of samples with value feed
Shift amount must be less or equal the size of the array.
| A | array |
| samples | shift amount |
| value | feed value |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Rotate an array by number of samples
Rotational amount must be less or equal the size of the array.
By default a right rotation is returned, however left rotation can be accomplished by subtracting from the array's length the desired amount.
| A | array |
| samples | right rotation amount |
Example 1
Item type is double
Example 2
Item type is double
|
static |
Round the samples of a real array by the number of decimal digits
|
static |
Round the samples of a complex array by the number of decimal digits
|
static |
Replace any infinite values found on a real array with the specified real value
|
static |
Replace any infinite values found on a complex array with the specified complex value
|
static |
Replace any NaN values found on a real array with the specified real value
|
static |
Replace any NaN values found on a complex array with the specified complex value
|
static |
Calculate the sine on each sample of a real array
|
static |
Calculate the sine on each sample of a complex array
|
static |
Calculate the hyperbolic sine on each sample of a real array
|
static |
Calculate the hyperbolic sine on each sample of a complex array
|
static |
Sorts a set of real values in ascending order
|
static |
Calculate the square root on each sample of a real array
|
static |
Calculate the square root on each sample of a complex array
|
static |
|
static |
|
static |
Calculate the tangent on each sample of a real array
|
static |
Calculate the tangent on each sample of a complex array
|
static |
Calculate the hyperbolic tangent on each sample of a real array
|
static |
Calculate the hyperbolic tangent on each sample of a complex array.
|
static |
Convert boolean array into double array
| A | Boolean array |
| override string dsp.NArray< T >.ToString | ( | ) |
Converts the NArray to its string representation
Converted string is in clear and printable form.
The function NArray.Round can be used to aid clarity
Example
|
static |
Converts an array into its string representation
| A | array |
| seperator | value separator |
Example 1
using comma separated value
Example 2
using a line break to separate values
|
static |
Converts an array into its string representation
Each value in the converted string is separated by 3 spaces.
The function NArray.Round can be used to aid clarity if there many decimal digits.
| A | array |
Example
|
static |
XOR Gate Array
The XOR gate is a boolean logic gate that returns True if either, but not both, of its two inputs are True. For more than two inputs XOR is performed sequentially.
|
get |
Gets the size of the NArray
Example
|
getset |
Provides indexing in NArray
Can be used to get and set an item
| index | item index (zero based) |
Example Item type is double