[ILNumerics numpy Module]
Namespace: ILNumerics
Assembly: ILNumerics.numpy (in ILNumerics.numpy.dll) Version: 5.5.0.0 (5.5.7503.3146)
public static void put<T1, LocalT, InT, OutT, RetT, StorageT, IndT>( this Mutable<T1, LocalT, InT, OutT, RetT, StorageT> A, BaseArray<IndT> indices, InArray<T1> values, PutModes mode = PutModes.Raise ) where T1 : struct, new() where LocalT : Mutable<T1, LocalT, InT, OutT, RetT, StorageT> where InT : Immutable<T1, LocalT, InT, OutT, RetT, StorageT> where OutT : Mutable<T1, LocalT, InT, OutT, RetT, StorageT> where RetT : ConcreteRetArray<T1, LocalT, InT, OutT, RetT, StorageT> where StorageT : new(), BaseStorage<T1, LocalT, InT, OutT, RetT, StorageT> where IndT : struct, new(), IConvertible
Parameters
- A
- Type: ILNumerics.Core.ArraysMutableT1, LocalT, InT, OutT, RetT, StorageT
The array storing the elements to be replaced. - indices
- Type: ILNumericsBaseArrayIndT
Index array. The shape is ignored. Values must be numeric and are read in row-major order. - values
- Type: ILNumericsInArrayT1
Values array. The shape is ignored. Values are read in row-major order. - mode (Optional)
- Type: ILNumericsPutModes
[Optionl] Specifies how to handle index values in indices which are out-of-range. Default: error.
Type Parameters
- T1
- Element type of A.
- LocalT
- (subtype of A)
- InT
- (subtype of A)
- OutT
- (subtype of A)
- RetT
- (subtype of A)
- StorageT
- (subtype of A)
- IndT
- Element type of indices. Must be numeric.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type MutableT1, LocalT, InT, OutT, RetT, StorageT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Exception | Condition |
---|---|
IndexOutOfRangeException | if mode is Raise and any element in indices is out of the allowed range of [-A.S.NumberOfElements...>= A.NumberOfElements]. |
ArgumentException | if either of indices or values is null, if values is empty but indices is not, if the specified mode cannot successfully be applied (for example, because A is empty). |
This function has a similar effect as doing A.flat[indices] = values in numpyInternal. However, in ILNumerics the iterator returned from A.flat is read-only. Use putT1, LocalT, InT, OutT, RetT, StorageT, IndT(MutableT1, LocalT, InT, OutT, RetT, StorageT, BaseArrayIndT, InArrayT1, PutModes) as a replacement.
Note that the values in indices are considered sequential indices, i.e. they correspond to the element position in a flattened array, where the flattening is performed in row-major order. For performance reasons and if A.StorageOrder is not RowMajor A is converted to row-major storage layout first and remains in row-major storage after the function returns. Note further, that the conversion happens proactively, and is not rolled back in case of errors during the iteration.
Elements of indices can be negative, which corresponds to indexing from the end of flattened A.
Repeated values in indices lead to only the last corresponding value in values to be stored at the respective position in A.
If values has more elements than are indices provided in indices superfluent values are ignored. No exception is thrown in this case. If values has fewer elements than indices are provided in indices existing values are repeated as necessary.
The mode parameter determines what happens with indices laying outside of the bounds of A. The default value of Raise throws an IndexOutOfRangeException in this case. Two other options exist which bring the index back into the valid range: Wrap computes the modulus, Clip limits the indices to the allowed range. Note that negative indices behave as usual (counting from the end of A) for modes Raise and Wrap only.
putT1, LocalT, InT, OutT, RetT, StorageT, IndT(MutableT1, LocalT, InT, OutT, RetT, StorageT, BaseArrayIndT, InArrayT1, PutModes) requires the element type of A to be value types (struct, commonly numeric).
[ILNumerics numpy Module]