Vector<T>.GetSlice Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

GetSlice(Int32) Returns a vector whose elements are a subset of the elements of this instance
GetSlice(Range) Returns a vector whose elements are a subset of the elements of this instance
GetSlice(Int32, Int32) Returns a vector whose elements are a subset of the elements of this instance
GetSlice(Range, Intent) Returns a vector whose elements are a subset of the elements of this instance
GetSlice(Slice, Intent) Returns a vector whose elements are a subset of the elements of this instance.
GetSlice(Int32, Int32, Intent) Returns a vector whose elements are a subset of the elements of this instance
GetSlice(Int32, Int32, Int32) Returns a vector whose elements are a subset of the elements of this instance
GetSlice(Int32, Int32, Int32, Intent) Returns a vector whose elements are a subset of the elements of this instance.

GetSlice(Int32)

Returns a vector whose elements are a subset of the elements of this instance
C#
public Vector<T> GetSlice(
	int startIndex
)

Parameters

startIndex  Int32
The index of the first element of this Vector<T> to be contained in the new vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Exceptions

ArgumentOutOfRangeException

startIndex is less than zero or greater than the length of the vector.

GetSlice(Range)

Returns a vector whose elements are a subset of the elements of this instance
C#
public Vector<T> GetSlice(
	Range range
)

Parameters

range  Range
A Range value specifying the range of elements in this instance that will make up the new vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Exceptions

ArgumentOutOfRangeException

The range specified by range is at least partly outside the bounds of this Vector<T>.

GetSlice(Int32, Int32)

Returns a vector whose elements are a subset of the elements of this instance
C#
public Vector<T> GetSlice(
	int startIndex,
	int endIndex
)

Parameters

startIndex  Int32
The index of the first element of this Vector<T> to be contained in the new vector.
endIndex  Int32
The index of the last element of this Vector<T> to be contained in the new vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Exceptions

ArgumentOutOfRangeException

startIndex is less than zero or greater than the length of the vector.

-or-

endIndex is less than zero or greater than the length of the vector.

GetSlice(Range, Intent)

Returns a vector whose elements are a subset of the elements of this instance
C#
public Vector<T> GetSlice(
	Range range,
	Intent intent
)

Parameters

range  Range
A Range value specifying the range of elements in this instance that will make up the new vector.
intent  Intent
An Intent value that specifies the intended use of the sub-vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Exceptions

ArgumentOutOfRangeException

The range specified by range is at least partly outside the bounds of this Vector<T>.

GetSlice(Slice, Intent)

Returns a vector whose elements are a subset of the elements of this instance.
C#
public Vector<T> GetSlice(
	Slice slice,
	Intent intent
)

Parameters

slice  Slice
A Slice structure that specifies the elements to return.
intent  Intent
An Intent value that specifies the intended use of the sub-vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Remarks

The intent parameter can be used to choose the optimal representation of the sub-vector for a specific purpose. Note that this method guararantees that the returned vector will be suitable for the specified purpose, but it will not enforce it. For example, if the purpose of the sub-vector is ReadOnly, there is no guarantee that the returned vector will be read-only.

Exceptions

ArgumentOutOfRangeException

The start index of slice is less than zero or greater than the length of the vector.

-or-

One or more indexes in the slice are outside the range of the vector indexes.

GetSlice(Int32, Int32, Intent)

Returns a vector whose elements are a subset of the elements of this instance
C#
public Vector<T> GetSlice(
	int startIndex,
	int endIndex,
	Intent intent
)

Parameters

startIndex  Int32
The index of the first element of this Vector<T> to be contained in the new vector.
endIndex  Int32
The index of the last element of this Vector<T> to be contained in the new vector.
intent  Intent
An Intent value that specifies the intended use of the sub-vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Exceptions

ArgumentOutOfRangeException

startIndex is less than zero or greater than the length of the vector.

-or-

endIndex is less than zero or greater than the length of the vector.

GetSlice(Int32, Int32, Int32)

Returns a vector whose elements are a subset of the elements of this instance
C#
public Vector<T> GetSlice(
	int startIndex,
	int endIndex,
	int stride
)

Parameters

startIndex  Int32
The index of the first element of this Vector<T> to be contained in the new vector.
endIndex  Int32
The index of the last element of this Vector<T> to be contained in the new vector.
stride  Int32
The increment for the index in this Vector<T> corresponding to an increment of one in the new vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Exceptions

ArgumentOutOfRangeException

startIndex is less than zero or greater than the length of the vector.

-or-

endIndex is less than zero or greater than the length of the vector.

GetSlice(Int32, Int32, Int32, Intent)

Returns a vector whose elements are a subset of the elements of this instance.
C#
public Vector<T> GetSlice(
	int startIndex,
	int endIndex,
	int stride,
	Intent intent
)

Parameters

startIndex  Int32
The index of the first element of this Vector<T> to be contained in the new vector.
endIndex  Int32
The index of the last element of this Vector<T> to be contained in the new vector.
stride  Int32
The increment for the index in this Vector<T> corresponding to an increment of one in the new vector.
intent  Intent
An Intent value that specifies the intended use of the sub-vector.

Return Value

Vector<T>
A reference to the new Vector<T>.

Remarks

The intent parameter can be used to choose the optimal representation of the sub-vector for a specific purpose. Note that this method guararantees that the returned vector will be suitable for the specified purpose, but it will not enforce it. For example, if the purpose of the sub-vector is ReadOnly, there is no guarantee that the returned vector will be read-only.

Exceptions

ArgumentOutOfRangeException

startIndex is less than zero or greater than the length of the vector.

-or-

endIndex is less than zero or greater than the length of the vector.

See Also