Click or drag to resize

Slice Class

Class Slice represents a collection of indices that can be used to view a subset of data from another data structure. A slice is defined by a starting index, a total number of elements, and a step increment called the stride.
Inheritance Hierarchy

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.3
Syntax
[SerializableAttribute]
public class Slice : ICloneable

The Slice type exposes the following members.

Constructors
  NameDescription
Protected methodSlice
Default constructor.
Public methodSlice(Int32, Int32)
Constructs a Slice instance with the specified starting index, total number of elements, and default stride of 1.
Public methodSlice(Int32, Int32, Int32)
Constructs a Slice instance with the specified starting index, total number of elements, and stride.
Top
Properties
  NameDescription
Public propertyStatic memberAll
Gets a new Slice indexing all.
Public propertyEnd
Gets the end data element.
Public propertyNumElements
Gets the total number of data elements.
Public propertyStart
Gets the starting data element.
Public propertyStride
Gets the step increment between successive data elements.
Top
Methods
  NameDescription
Public methodBegin
Calculates the starting element of this slice.
Public methodClone
Creates a deep copy of this slice.
Public methodLength
Calculates the length of this slice.
Public methodSet(Int32, Position, Int32)
Sets the specified starting index, a Position value indicating the end of the data, and a specified stride.
Public methodSet(Int32, Int32, Int32)
Sets the the specified starting index, total number of elements, and stride for this slice.
Public methodSet(Position, Position, Int32)
Sets the specified start and end positions and a stride.
Public methodSet(Position, Int32, Int32)
Sets the specified position from which to start, the end index and a stride.
Top
Fields
  NameDescription
Protected fieldStatic memberDEFAULT_STRIDE
The default stride is 1.
Protected fieldend_
The end of the data.
Protected fieldnumElements_
The total number of data elements.
Protected fieldstart_
The start of the data.
Protected fieldstride_
The step increment between successive elements in the data.
Top
Examples
For example, a slice could be the third column of a matrix or the first ten elements of a vector.
See Also