Class Vector
Static class Vector. Defines a set of extension methods
that operates mainly on single-dimensional arrays.
Inheritance
System.Object
Vector
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Mars.Numerics.dll
Syntax
public static class Vector
Methods
|
Improve this Doc
View Source
Copy<T>(T[])
Creates a shallow copy of the array.
Declaration
public static T[] Copy<T>(this T[] vector)
Parameters
Type |
Name |
Description |
T[] |
vector |
|
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
Create<T>(T[])
Creates a vector with the given starting values.
Declaration
public static T[] Create<T>(params T[] values)
Parameters
Type |
Name |
Description |
T[] |
values |
The initial values for the vector. |
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
Create<T>(Int32, T)
Creates a vector with the given dimension and starting value.
Declaration
public static T[] Create<T>(int size, T value)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The number of elements in the vector. |
T |
value |
The initial values for the vector. |
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
Create<T>(Int32, T[])
Creates a vector with the given dimension and starting value.
Declaration
public static T[] Create<T>(int size, T[] values)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The number of elements in the vector. |
T[] |
values |
The initial values for the vector. |
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
CreateAs<T>(T[])
Creates a vector with the shape of the given vector.
Declaration
public static T[] CreateAs<T>(T[] vector)
Parameters
Type |
Name |
Description |
T[] |
vector |
The vector whose shape should be copied. |
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
Dot(Sparse<Double>, Sparse<Double>)
Gets the inner product (scalar product) between two vectors (a'*b).
Declaration
public static double Dot(this Sparse<double> a, Sparse<double> b)
Parameters
Type |
Name |
Description |
Sparse<System.Double> |
a |
A vector. |
Sparse<System.Double> |
b |
A vector. |
Returns
Type |
Description |
System.Double |
The inner product of the multiplication of the vectors. |
See Also
|
Improve this Doc
View Source
EnumerableRange(Double, Double, Double)
Enumerates through a range (like Python's xrange function).
Declaration
public static IEnumerable<double> EnumerableRange(double a, double b, double stepSize)
Parameters
Type |
Name |
Description |
System.Double |
a |
The inclusive lower bound of the range. |
System.Double |
b |
The exclusive upper bound of the range. |
System.Double |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Double> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Double, Double, Int32)
Enumerates through a range (like Python's xrange function).
Declaration
public static IEnumerable<double> EnumerableRange(double a, double b, int stepSize)
Parameters
Type |
Name |
Description |
System.Double |
a |
The inclusive lower bound of the range. |
System.Double |
b |
The exclusive upper bound of the range. |
System.Int32 |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Double> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Double, Double)
Enumerates through a range (like Python's xrange).
Declaration
public static IEnumerable<double> EnumerableRange(double a, double b)
Parameters
Type |
Name |
Description |
System.Double |
a |
The inclusive lower bound of the range. |
System.Double |
b |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Double> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Double)
Enumerates through a range (like Python's xrange function).
Declaration
public static IEnumerable<double> EnumerableRange(double n)
Parameters
Type |
Name |
Description |
System.Double |
n |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Double> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Int32, Int32, Double)
Enumerates through a range (like Python's xrange function).
Declaration
public static IEnumerable<double> EnumerableRange(int a, int b, double stepSize)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
The inclusive lower bound of the range. |
System.Int32 |
b |
The exclusive upper bound of the range. |
System.Double |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Double> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Int32, Int32, Int32)
Enumerates through a range (like Python's xrange function).
Declaration
public static IEnumerable<int> EnumerableRange(int a, int b, int stepSize)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
The inclusive lower bound of the range. |
System.Int32 |
b |
The exclusive upper bound of the range. |
System.Int32 |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Int32, Int32)
Enumerates through a range (like Python's xrange).
Declaration
public static IEnumerable<int> EnumerableRange(int a, int b)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
The inclusive lower bound of the range. |
System.Int32 |
b |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
See Also
|
Improve this Doc
View Source
EnumerableRange(Int32)
Enumerates through a range (like Python's xrange function).
Declaration
public static IEnumerable<int> EnumerableRange(int n)
Parameters
Type |
Name |
Description |
System.Int32 |
n |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
See Also
|
Improve this Doc
View Source
GetIndices<T>(T[])
Creates a vector containing every index that can be used to
address a given array
, in order.
Declaration
public static int[] GetIndices<T>(this T[] array)
Parameters
Type |
Name |
Description |
T[] |
array |
The array whose indices will be returned. |
Returns
Type |
Description |
System.Int32[] |
A vector of the same size as the given array
containing all vector indices from 0 up to the length of
array .
|
Type Parameters
Examples
double[] a = { 5.3, 2.3, 4.2 };
int[] idx = a.GetIndices(); // output will be { 0, 1, 2 }
See Also
|
Improve this Doc
View Source
Histogram(Int32[], Int32[])
Counts how many times an integer label appears in a vector (i.e. creates
an histogram of integer values assuming possible values start at zero and
go up to the maximum value of in the vector).
Declaration
public static int[] Histogram(this int[] labels, int[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
labels |
An array containing the integer labels to be counted. |
System.Int32[] |
result |
The histogram to were the counts will be added. This
vector should have been zeroed out before being passed to this method.
|
Returns
Type |
Description |
System.Int32[] |
The same vector result passed as an argument.
|
See Also
|
Improve this Doc
View Source
Interval(DoubleRange, Int32)
Creates an interval vector (like NumPy's linspace function).
Declaration
public static double[] Interval(this DoubleRange range, int steps)
Parameters
Type |
Name |
Description |
DoubleRange |
range |
|
System.Int32 |
steps |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Interval(IntRange, Int32)
Creates an interval vector (like NumPy's linspace function).
Declaration
public static int[] Interval(this IntRange range, int steps)
Parameters
Type |
Name |
Description |
IntRange |
range |
|
System.Int32 |
steps |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Interval(Double, Double, Int32, Boolean)
Creates an interval vector (like NumPy's linspace function).
Declaration
public static double[] Interval(double a, double b, int steps, bool includeLast = true)
Parameters
Type |
Name |
Description |
System.Double |
a |
|
System.Double |
b |
|
System.Int32 |
steps |
|
System.Boolean |
includeLast |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Interval(Double, Double)
Creates an interval vector (like NumPy's linspace function).
Declaration
public static double[] Interval(double a, double b)
Parameters
Type |
Name |
Description |
System.Double |
a |
|
System.Double |
b |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Interval(Int32, Int32, Int32, Boolean)
Creates an interval vector (like NumPy's linspace function).
Declaration
public static int[] Interval(int a, int b, int steps, bool includeLast = true)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
|
System.Int32 |
b |
|
System.Int32 |
steps |
|
System.Boolean |
includeLast |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Interval(Int32, Int32)
Creates an interval vector (like NumPy's linspace function).
Declaration
public static int[] Interval(int a, int b)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
|
System.Int32 |
b |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Ones(Int32)
Creates a one-valued vector.
Declaration
public static double[] Ones(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The number of elements in the vector. |
Returns
Type |
Description |
System.Double[] |
A vector of the specified size. |
See Also
|
Improve this Doc
View Source
Ones<T>(Int32)
Creates a zero-valued vector.
Declaration
public static T[] Ones<T>(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The number of elements in the vector. |
Returns
Type |
Description |
T[] |
A vector of the specified size. |
Type Parameters
Name |
Description |
T |
The type of the vector to be created. |
See Also
|
Improve this Doc
View Source
Random(Int32, Double, Double)
Creates a vector with uniformly distributed random data.
Declaration
public static double[] Random(int size, double min, double max)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
|
System.Double |
min |
|
System.Double |
max |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Random(Int32, Int32, Int32)
Creates a vector with uniformly distributed random data.
Declaration
public static int[] Random(int size, int min, int max)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
|
System.Int32 |
min |
|
System.Int32 |
max |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Random(Int32)
Creates a vector with uniformly distributed random data.
Declaration
public static double[] Random(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(DoubleRange, Double)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(this DoubleRange range, double stepSize)
Parameters
Type |
Name |
Description |
DoubleRange |
range |
The range from where values should be created. |
System.Double |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(DoubleRange, Int32)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(this DoubleRange range, int stepSize)
Parameters
Type |
Name |
Description |
DoubleRange |
range |
The range from where values should be created. |
System.Int32 |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(DoubleRange)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(this DoubleRange range)
Parameters
Type |
Name |
Description |
DoubleRange |
range |
The range from where values should be created. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(IntRange, Double)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(this IntRange range, double stepSize)
Parameters
Type |
Name |
Description |
IntRange |
range |
The range from where values should be created. |
System.Double |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(IntRange, Int32)
Creates a range vector (like NumPy's arange function).
Declaration
public static int[] Range(this IntRange range, int stepSize)
Parameters
Type |
Name |
Description |
IntRange |
range |
The range from where values should be created. |
System.Int32 |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Range(IntRange)
Creates a range vector (like NumPy's arange function).
Declaration
public static int[] Range(this IntRange range)
Parameters
Type |
Name |
Description |
IntRange |
range |
The range from where values should be created. |
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Range(Double, Double, Double)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(double a, double b, double stepSize)
Parameters
Type |
Name |
Description |
System.Double |
a |
The inclusive lower bound of the range. |
System.Double |
b |
The exclusive upper bound of the range. |
System.Double |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(Double, Double, Int32)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(double a, double b, int stepSize)
Parameters
Type |
Name |
Description |
System.Double |
a |
The inclusive lower bound of the range. |
System.Double |
b |
The exclusive upper bound of the range. |
System.Int32 |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(Double, Double)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(double a, double b)
Parameters
Type |
Name |
Description |
System.Double |
a |
The inclusive lower bound of the range. |
System.Double |
b |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(Double)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(double n)
Parameters
Type |
Name |
Description |
System.Double |
n |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(Int32, Int32, Double)
Creates a range vector (like NumPy's arange function).
Declaration
public static double[] Range(int a, int b, double stepSize)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
The inclusive lower bound of the range. |
System.Int32 |
b |
The exclusive upper bound of the range. |
System.Double |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Range(Int32, Int32, Int32)
Creates a range vector (like NumPy's arange function).
Declaration
public static int[] Range(int a, int b, int stepSize)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
The inclusive lower bound of the range. |
System.Int32 |
b |
The exclusive upper bound of the range. |
System.Int32 |
stepSize |
The step size to be taken between elements.
This parameter can be negative to create a decreasing range. |
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Range(Int32, Int32)
Creates a range vector (like NumPy's arange function).
Declaration
public static int[] Range(int a, int b)
Parameters
Type |
Name |
Description |
System.Int32 |
a |
The inclusive lower bound of the range. |
System.Int32 |
b |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Range(Int32)
Creates a range vector (like NumPy's arange function).
Declaration
public static int[] Range(int n)
Parameters
Type |
Name |
Description |
System.Int32 |
n |
The exclusive upper bound of the range. |
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Sample(Double, Double)
Returns a vector of the specified percentage
of the
populationSize
containing non-repeating indices in the
range [0, populationSize) in random order.
Declaration
public static double[] Sample(double percentage, double populationSize)
Parameters
Type |
Name |
Description |
System.Double |
percentage |
The percentage of the population to sample. |
System.Double |
populationSize |
The non-inclusive maximum number an index can have. |
Returns
Type |
Description |
System.Double[] |
|
Examples
var a = Vector.Sample(0.3, 10); // a possible output is { 1, 7, 4 };
var b = Vector.Sample(1.0, 10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };
foreach (var i in Vector.Sample(0.2, 6))
{
// ...
}
See Also
|
Improve this Doc
View Source
Sample(Double, Int32)
Returns a vector of the specified percentage
of the
populationSize
containing non-repeating indices in the
range [0, populationSize) in random order.
Declaration
public static int[] Sample(double percentage, int populationSize)
Parameters
Type |
Name |
Description |
System.Double |
percentage |
The percentage of the population to sample. |
System.Int32 |
populationSize |
The non-inclusive maximum number an index can have. |
Returns
Type |
Description |
System.Int32[] |
|
Examples
var a = Vector.Sample(0.3, 10); // a possible output is { 1, 7, 4 };
var b = Vector.Sample(1.0, 10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };
foreach (var i in Vector.Sample(0.2, 6))
{
// ...
}
See Also
|
Improve this Doc
View Source
Sample(Double)
Returns a vector containing indices (0, 1, 2, ..., n - 1) in random
order. The vector grows up to to size
, but does not
include size
among its values.
Declaration
public static double[] Sample(double size)
Parameters
Type |
Name |
Description |
System.Double |
size |
The size of the sample vector to be generated. |
Returns
Type |
Description |
System.Double[] |
|
Examples
var a = Vector.Sample(3); // a possible output is { 2, 1, 0 };
var b = Vector.Sample(10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };
foreach (var i in Vector.Sample(5))
{
// ...
}
See Also
|
Improve this Doc
View Source
Sample(Int32, Double)
Returns a vector of the specified sampleSize
containing
non-repeating indices in the range [0, populationSize) in random order.
Declaration
public static double[] Sample(int sampleSize, double populationSize)
Parameters
Type |
Name |
Description |
System.Int32 |
sampleSize |
The size of the sample vector to be generated. |
System.Double |
populationSize |
The non-inclusive maximum number an index can have. |
Returns
Type |
Description |
System.Double[] |
|
Examples
var a = Vector.Sample(3, 10); // a possible output is { 1, 7, 4 };
var b = Vector.Sample(10, 10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };
foreach (var i in Vector.Sample(5, 6))
{
// ...
}
See Also
|
Improve this Doc
View Source
Sample(Int32, Int32)
Returns a vector of the specified sampleSize
containing
non-repeating indices in the range [0, populationSize) in random order.
Declaration
public static int[] Sample(int sampleSize, int populationSize)
Parameters
Type |
Name |
Description |
System.Int32 |
sampleSize |
The size of the sample vector to be generated. |
System.Int32 |
populationSize |
The non-inclusive maximum number an index can have. |
Returns
Type |
Description |
System.Int32[] |
|
Examples
var a = Vector.Sample(3, 10); // a possible output is { 1, 7, 4 };
var b = Vector.Sample(10, 10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };
foreach (var i in Vector.Sample(5, 6))
{
// ...
}
See Also
|
Improve this Doc
View Source
Sample(Int32)
Returns a vector containing indices (0, 1, 2, ..., n - 1) in random
order. The vector grows up to to size
, but does not
include size
among its values.
Declaration
public static int[] Sample(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The size of the sample vector to be generated. |
Returns
Type |
Description |
System.Int32[] |
|
Examples
var a = Vector.Sample(3); // a possible output is { 2, 1, 0 };
var b = Vector.Sample(10); // a possible output is { 5, 4, 2, 0, 1, 3, 7, 9, 8, 6 };
foreach (var i in Vector.Sample(5))
{
// ...
}
See Also
|
Improve this Doc
View Source
Sample<T>(T[], Int32, Boolean)
Draws a random sample from a group of observations, with or without repetitions.
Declaration
public static T[] Sample<T>(this T[] values, int size, bool replacement = false)
Parameters
Type |
Name |
Description |
T[] |
values |
The observation vector. |
System.Int32 |
size |
The size of the sample to be drawn (how many samples to get). |
System.Boolean |
replacement |
Whether to sample with replacement (repeating values) or without replacement (non-repeating
values).
|
Returns
Type |
Description |
T[] |
A vector containing the samples drawn from values . |
Type Parameters
Name |
Description |
T |
The type of the observations. |
See Also
|
Improve this Doc
View Source
Scale(Double, IRange<Double>, IRange<Double>)
Converts values from one scale to another scale.
Declaration
public static double Scale(this double value, IRange<double> fromRange, IRange<double> toRange)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
IRange<System.Double> |
fromRange |
|
IRange<System.Double> |
toRange |
|
Returns
Type |
Description |
System.Double |
|
See Also
|
Improve this Doc
View Source
Scale(Double, IRange<Double>, IRange<Int32>)
Converts values from one scale to another scale.
Declaration
public static int Scale(this double value, IRange<double> fromRange, IRange<int> toRange)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
IRange<System.Double> |
fromRange |
|
IRange<System.Int32> |
toRange |
|
Returns
Type |
Description |
System.Int32 |
|
See Also
|
Improve this Doc
View Source
Scale(Double, Double, Double, Double, Double)
Converts a value from one scale to another scale.
Declaration
public static double Scale(this double value, double fromMin, double fromMax, double toMin, double toMax)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
System.Double |
fromMin |
|
System.Double |
fromMax |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
Returns
Type |
Description |
System.Double |
|
See Also
|
Improve this Doc
View Source
Scale(Double, Double, Double, Int32, Int32)
Converts a value from one scale to another scale.
Declaration
public static int Scale(this double value, double fromMin, double fromMax, int toMin, int toMax)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
System.Double |
fromMin |
|
System.Double |
fromMax |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
Returns
Type |
Description |
System.Int32 |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], IRange<Double>, IRange<Double>, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, IRange<double> fromRange, IRange<double> toRange, double[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
IRange<System.Double> |
fromRange |
|
IRange<System.Double> |
toRange |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], IRange<Double>, IRange<Double>)
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, IRange<double> fromRange, IRange<double> toRange)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
IRange<System.Double> |
fromRange |
|
IRange<System.Double> |
toRange |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], IRange<Double>, IRange<Int32>, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, IRange<double> fromRange, IRange<int> toRange, int[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
IRange<System.Double> |
fromRange |
|
IRange<System.Int32> |
toRange |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], IRange<Double>, IRange<Int32>)
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, IRange<double> fromRange, IRange<int> toRange)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
IRange<System.Double> |
fromRange |
|
IRange<System.Int32> |
toRange |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], IRange<Double>, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, IRange<double> toRange, double[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
IRange<System.Double> |
toRange |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], IRange<Int32>, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, IRange<int> toRange, int[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
IRange<System.Int32> |
toRange |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Double, Double, Double, Double, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, double fromMin, double fromMax, double toMin, double toMax, double[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Double |
fromMin |
|
System.Double |
fromMax |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Double, Double, Double, Double)
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, double fromMin, double fromMax, double toMin, double toMax)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Double |
fromMin |
|
System.Double |
fromMax |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Double, Double, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, double toMin, double toMax, double[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Double, Double, Int32, Int32, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, double fromMin, double fromMax, int toMin, int toMax, int[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Double |
fromMin |
|
System.Double |
fromMax |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Double, Double, Int32, Int32)
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, double fromMin, double fromMax, int toMin, int toMax)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Double |
fromMin |
|
System.Double |
fromMax |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Double, Double)
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this double[] values, double toMin, double toMax)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Int32, Int32, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, int toMin, int toMax, int[] result)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Double[], Int32, Int32)
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this double[] values, int toMin, int toMax)
Parameters
Type |
Name |
Description |
System.Double[] |
values |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32, IRange<Int32>, IRange<Double>)
Converts values from one scale to another scale.
Declaration
public static double Scale(this int value, IRange<int> fromRange, IRange<double> toRange)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
IRange<System.Int32> |
fromRange |
|
IRange<System.Double> |
toRange |
|
Returns
Type |
Description |
System.Double |
|
See Also
|
Improve this Doc
View Source
Scale(Int32, IRange<Int32>, IRange<Int32>)
Converts values from one scale to another scale.
Declaration
public static int Scale(this int value, IRange<int> fromRange, IRange<int> toRange)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
IRange<System.Int32> |
fromRange |
|
IRange<System.Int32> |
toRange |
|
Returns
Type |
Description |
System.Int32 |
|
See Also
|
Improve this Doc
View Source
Scale(Int32, Int32, Int32, Double, Double)
Converts a value from one scale to another scale.
Declaration
public static double Scale(this int value, int fromMin, int fromMax, double toMin, double toMax)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
System.Int32 |
fromMin |
|
System.Int32 |
fromMax |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
Returns
Type |
Description |
System.Double |
|
See Also
|
Improve this Doc
View Source
Scale(Int32, Int32, Int32, Int32, Int32)
Converts a value from one scale to another scale.
Declaration
public static int Scale(this int value, int fromMin, int fromMax, int toMin, int toMax)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
System.Int32 |
fromMin |
|
System.Int32 |
fromMax |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
Returns
Type |
Description |
System.Int32 |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], IRange<Double>, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, IRange<double> toRange, double[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
IRange<System.Double> |
toRange |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], IRange<Int32>, IRange<Double>, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, IRange<int> fromRange, IRange<double> toRange, double[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
IRange<System.Int32> |
fromRange |
|
IRange<System.Double> |
toRange |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], IRange<Int32>, IRange<Double>)
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, IRange<int> fromRange, IRange<double> toRange)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
IRange<System.Int32> |
fromRange |
|
IRange<System.Double> |
toRange |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], IRange<Int32>, IRange<Int32>, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, IRange<int> fromRange, IRange<int> toRange, int[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
IRange<System.Int32> |
fromRange |
|
IRange<System.Int32> |
toRange |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], IRange<Int32>, IRange<Int32>)
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, IRange<int> fromRange, IRange<int> toRange)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
IRange<System.Int32> |
fromRange |
|
IRange<System.Int32> |
toRange |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], IRange<Int32>, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, IRange<int> toRange, int[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
IRange<System.Int32> |
toRange |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Double, Double, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, double toMin, double toMax, double[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Double, Double)
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, double toMin, double toMax)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Int32, Int32, Double, Double, Double[])
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, int fromMin, int fromMax, double toMin, double toMax, double[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Int32 |
fromMin |
|
System.Int32 |
fromMax |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
System.Double[] |
result |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Int32, Int32, Double, Double)
Converts values from one scale to another scale.
Declaration
public static double[] Scale(this int[] values, int fromMin, int fromMax, double toMin, double toMax)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Int32 |
fromMin |
|
System.Int32 |
fromMax |
|
System.Double |
toMin |
|
System.Double |
toMax |
|
Returns
Type |
Description |
System.Double[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Int32, Int32, Int32, Int32, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, int fromMin, int fromMax, int toMin, int toMax, int[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Int32 |
fromMin |
|
System.Int32 |
fromMax |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Int32, Int32, Int32, Int32)
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, int fromMin, int fromMax, int toMin, int toMax)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Int32 |
fromMin |
|
System.Int32 |
fromMax |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Int32, Int32, Int32[])
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, int toMin, int toMax, int[] result)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
System.Int32[] |
result |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Scale(Int32[], Int32, Int32)
Converts values from one scale to another scale.
Declaration
public static int[] Scale(this int[] values, int toMin, int toMax)
Parameters
Type |
Name |
Description |
System.Int32[] |
values |
|
System.Int32 |
toMin |
|
System.Int32 |
toMax |
|
Returns
Type |
Description |
System.Int32[] |
|
See Also
|
Improve this Doc
View Source
Shuffle<T>(T[])
Shuffles an array.
Declaration
public static void Shuffle<T>(this T[] array)
Parameters
Type |
Name |
Description |
T[] |
array |
|
Type Parameters
See Also
|
Improve this Doc
View Source
Shuffled<T>(T[])
Shuffles an array.
Declaration
public static T[] Shuffled<T>(this T[] array)
Parameters
Type |
Name |
Description |
T[] |
array |
|
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
Sort<T>(T[], Boolean, Boolean)
Sorts the elements of an entire one-dimensional array using the given comparison.
Declaration
public static void Sort<T>(this T[] values, bool stable = false, bool asc = true)
where T : IComparable<T>
Parameters
Type |
Name |
Description |
T[] |
values |
|
System.Boolean |
stable |
|
System.Boolean |
asc |
|
Type Parameters
See Also
|
Improve this Doc
View Source
Sort<T>(T[], Comparison<T>, Boolean, Boolean)
Sorts the elements of an entire one-dimensional array using the given comparison.
Declaration
public static void Sort<T>(this T[] values, Comparison<T> comparison, bool stable = false, bool asc = true)
Parameters
Type |
Name |
Description |
T[] |
values |
|
System.Comparison<T> |
comparison |
|
System.Boolean |
stable |
|
System.Boolean |
asc |
|
Type Parameters
See Also
|
Improve this Doc
View Source
Sort<T>(T[], out Int32[], Boolean, ComparerDirection)
Sorts the elements of an entire one-dimensional array using the given comparison.
Declaration
public static void Sort<T>(this T[] values, out int[] order, bool stable = false, ComparerDirection direction = ComparerDirection.Ascending)
where T : IComparable<T>
Parameters
Type |
Name |
Description |
T[] |
values |
|
System.Int32[] |
order |
|
System.Boolean |
stable |
|
ComparerDirection |
direction |
|
Type Parameters
See Also
|
Improve this Doc
View Source
Sorted<T>(T[], Boolean, Boolean)
Sorts the elements of an entire one-dimensional array using the given comparison.
Declaration
public static T[] Sorted<T>(this T[] values, bool stable = false, bool asc = true)
where T : IComparable<T>
Parameters
Type |
Name |
Description |
T[] |
values |
|
System.Boolean |
stable |
|
System.Boolean |
asc |
|
Returns
Type Parameters
See Also
|
Improve this Doc
View Source
Zeros(Int32)
Creates a zero-valued vector.
Declaration
public static double[] Zeros(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The number of elements in the vector. |
Returns
Type |
Description |
System.Double[] |
A vector of the specified size. |
See Also
|
Improve this Doc
View Source
Zeros<T>(Int32)
Creates a zero-valued vector.
Declaration
public static T[] Zeros<T>(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The number of elements in the vector. |
Returns
Type |
Description |
T[] |
A vector of the specified size. |
Type Parameters
Name |
Description |
T |
The type of the vector to be created. |
See Also
See Also