Vector.Create Method
Definition
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
Overload List
| Create<T>(T[]) | Constructs a new vector with the specified elements. | 
| Create<T>(Int32) | Constructs a new vector with the specified length. | 
| Create<T>(IList<T>, ArrayMutability) | Constructs a new vector with the specified elements. | 
| Create<T>(T[], Boolean, ArrayMutability) | Constructs a new dense vector with the specified elements. | 
| Create<T>(Int32, ArraySlice<T>, ArrayMutability) | Constructs a new dense vector. | 
| Create<T>(Int32, Func<Int32, T>, ArrayMutability) | Constructs a new dense vector. | 
| Create<T>(Int32, T[], Boolean, ArrayMutability) | Constructs a new dense vector with the specified elements. | 
| Create<T>(Int32, T[], Int32, Int32, ArrayMutability) | Constructs a new dense vector. | 
| Create<T, K>(IDictionary<K, T>) | Creates an indexed vector from a dictionary. | 
| Create<T, K>(IDictionary<K, T>, IList<K>) | Creates an indexed vector from a dictionary. | 
| Create<T, K>(Int32, Index<K>) | Creates an indexed vector of the specified length with the specified index. | 
| Create<T, K>(IList<T>, IList<K>, ArrayMutability) | Creates an indexed vector with the specified values and corresponding keys. | 
Create<T>(T[])
public static DenseVector<T> Create<T>(
	params T[] values
)
Parameters
- values T[]
 - A variable length list of T parameters specifying the elements of the vector, or an array of values.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Remarks
The length of the new vector is equal to the length of values.
Exceptions
| Argument | values is null | 
Create<T, K>(IDictionary<K, T>)
public static Vector<T> Create<T, K>(
	IDictionary<K, T> dictionary
)
Parameters
- dictionary IDictionary<K, T>
 - A dictionary.
 
Type Parameters
- T
 - The element type of the vector.
 - K
 - The type of the keys in the dictionary.
 
Return Value
Vector<T>An indexed vector with key values of type K.
Create<T>(Int32)
public static DenseVector<T> Create<T>(
	int length
)
Parameters
- length Int32
 - The length of the new DenseVector<T>.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Remarks
The elements of the vector are set to zero.
Exceptions
| Argument | length is less than zero. | 
Create<T, K>(IDictionary<K, T>, IList<K>)
public static Vector<T> Create<T, K>(
	IDictionary<K, T> dictionary,
	IList<K> index
)
Parameters
- dictionary IDictionary<K, T>
 - A dictionary.
 - index IList<K>
 - An index.
 
Type Parameters
- T
 - The element type of the vector.
 - K
 - The type of the keys in the dictionary.
 
Return Value
Vector<T>An indexed vector with key values of type K.
Remarks
If any of the keys in index are not found in dictionary, a missing value is inserted.
Exceptions
| Argument | dictionary is null.  | 
Create<T>(IList<T>, ArrayMutability)
public static DenseVector<T> Create<T>(
	IList<T> values,
	ArrayMutability mutability
)
Parameters
- values IList<T>
 - An IList<T> specifying the elements of the vector.
 - mutability ArrayMutability
 - Specifies how the vector's values may be changed. The default is mutable values.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Remarks
The length of the new vector is equal to the length of values. The elements are copied to a new array.
Exceptions
| Argument | values is null | 
Create<T, K>(Int32, Index<K>)
public static Vector<T> Create<T, K>(
	int length,
	Index<K> index
)
Parameters
Type Parameters
- T
 - The element type of the vector.
 - K
 - The type of the keys of the index.
 
Return Value
Vector<T>A vector of the specified lenght.
Create<T>(T[], Boolean, ArrayMutability)
public static DenseVector<T> Create<T>(
	T[] values,
	bool reuseComponentArray,
	ArrayMutability mutability = ArrayMutability.Immutable
)
Parameters
- values T[]
 - An array that contains the elements of the new DenseVector<T>.
 - reuseComponentArray Boolean
 - If true, the array referenced by values is used directly. Any changes to the elements of this DenseVector<T> will also affect the original array.If false, the elements are copied from values to a new array.
 - mutability ArrayMutability (Optional)
 - Specifies how the vector's values may be changed. The default is mutable values.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Remarks
The length of the new vector is equal to the length of values.
Exceptions
| Argument | values is null | 
Create<T, K>(IList<T>, IList<K>, ArrayMutability)
public static Vector<T> Create<T, K>(
	IList<T> values,
	IList<K> keys,
	ArrayMutability mutability = ArrayMutability.Immutable
)
Parameters
- values IList<T>
 - A list of values.
 - keys IList<K>
 - A list of keys.
 - mutability ArrayMutability (Optional)
 - Specifies how the vector's values may be changed. The default is immutable.
 
Type Parameters
- T
 - The element type of the vector.
 - K
 - The type of the keys.
 
Return Value
Vector<T>A vector with elements specified by values and an index defined by keys.
Create<T>(Int32, ArraySlice<T>, ArrayMutability)
public static DenseVector<T> Create<T>(
	int length,
	ArraySlice<T> values,
	ArrayMutability mutability
)
Parameters
- length Int32
 - The length of the vector.
 - values ArraySlice<T>
 - A strided structure containing the elements.
 - mutability ArrayMutability
 - Specifies how the vector's values may be changed.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Create<T>(Int32, Func<Int32, T>, ArrayMutability)
public static DenseVector<T> Create<T>(
	int length,
	Func<int, T> initializer,
	ArrayMutability mutability = ArrayMutability.MutableValues
)
Parameters
- length Int32
 - The length of the vector.
 - initializer Func<Int32, T>
 - A delegate that returns the value of a element given its index.
 - mutability ArrayMutability (Optional)
 - Specifies how the vector's values may be changed. The default is mutable values.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T> whose elements are initialized using initializer.
Exceptions
| Argument | initializer is null | 
| Argument | length is less than zero.  | 
Create<T>(Int32, T[], Boolean, ArrayMutability)
public static DenseVector<T> Create<T>(
	int length,
	T[] values,
	bool reuseComponentArray,
	ArrayMutability mutability
)
Parameters
- length Int32
 - The number of elements in the new vector.
 - values T[]
 - An array that contains the elements of the new DenseVector<T>.
 - reuseComponentArray Boolean
 - If true, the array referenced by values is used directly. Any changes to the elements of this DenseVector<T> will also affect the original array. If false, the elements are copied from values to a new array.
 - mutability ArrayMutability
 - Specifies how the vector's values may be changed. The default is mutable values.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Exceptions
| Argument | values is null | 
| Argument | length is less than zero. -or- The length of values is less than length.  | 
Create<T>(Int32, T[], Int32, Int32, ArrayMutability)
public static DenseVector<T> Create<T>(
	int length,
	T[] values,
	int offset,
	int stride,
	ArrayMutability mutability
)
Parameters
- length Int32
 - The length of the vector.
 - values T[]
 - A Double array that contains the elements.
 - offset Int32
 - The offset of the first element of the vector in values.
 - stride Int32
 - The stride between successive elements of the vector.
 - mutability ArrayMutability
 - Specifies how the vector's values may be changed.
 
Type Parameters
- T
 
Return Value
DenseVector<T>A DenseVector<T>.
Exceptions
| Argument | values is null | 
| Argument | length is less than zero. -or- The length of values is less than length.  |