Constructs a new sparse vector with the specified elements.
Namespace:
Extreme.Mathematics
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
public static SparseVector<T> CreateSparse<T>(
int length,
int[] indexes,
T[] values,
ArrayMutability mutability = ArrayMutability.Immutable
)
Public Shared Function CreateSparse(Of T) (
length As Integer,
indexes As Integer(),
values As T(),
Optional mutability As ArrayMutability = ArrayMutability.Immutable
) As SparseVector(Of T)
public:
generic<typename T>
static SparseVector<T>^ CreateSparse(
int length,
array<int>^ indexes,
array<T>^ values,
ArrayMutability mutability = ArrayMutability::Immutable
)
static member CreateSparse :
length : int *
indexes : int[] *
values : 'T[] *
?mutability : ArrayMutability
(* Defaults:
let _mutability = defaultArg mutability ArrayMutability.Immutable
*)
-> SparseVector<'T>
Parameters
- length
- Type: SystemInt32
The length of the new vector. - indexes
- Type: SystemInt32
An integer array that contains the zero-based indexes of the nonzero elements. - values
- Type: T
A Double array that contains the corresponding values. - mutability (Optional)
- Type: Extreme.MathematicsArrayMutability
Specifies how the vector's values may be changed.
The default is mutable values.
Type Parameters
- T
Return Value
Type:
SparseVectorTA
SparseVectorT.
If an index occurs more than once in indexes,
the actual value is the sum of the corresponding values.
Reference