Main Content

matlab::data::ColumnMajor

C++ class to create iterators and ranges that iterate in column-major order

Description

Use the ColumnMajor class to create iterators and ranges that access array elements in column-major order. To determine the memory layout of an array, call getMemoryLayout.

Class Details

Namespace:

matlab::data

Include:

ColumnMajorIterator.hpp

Iterators

Begin Iterators

template <typename T>
static ColumnMajorIterator<T> begin(Array& arr)

template <typename T>
static ColumnMajorIterator<T> begin(TypedArray<T>& arr)

template <typename T>
static ColumnMajorIterator<T> begin(Reference<Array>& ref)

template <typename T>
static ColumnMajorIterator<T> begin(TypedArrayRef<T>& ref)

template <typename T>
static ColumnMajorIterator<T const> begin(const Array& arr)

template <typename T>
static ColumnMajorIterator<T const> begin(const TypedArray<T>& arr)

template <typename T>
static ColumnMajorIterator<T const> begin(const Reference<Array>& ref)

template <typename T>
static ColumnMajorIterator<T const> begin(const TypedArrayRef<T>& ref)

template <typename T>
static ColumnMajorIterator<T const> cbegin(const TypedArray<T>& arr)

template <typename T>
static ColumnMajorIterator<T const> cbegin(const Array& arr)

template <typename T>
static ColumnMajorIterator<T const> cbegin(const Reference<Array>& ref)

template <typename T>
static ColumnMajorIterator<T const> cbegin(const TypedArrayRef<T>& ref)
Description

Create a ColumnMajorIterator to the beginning of the input array. For best performance when reading data from an array, use functions that return ColumnMajorIterator<T const>.

Parameters

Array& arr

Array used to create the iterator.

TypedArray<T>& arr

Array used to create the iterator.

Reference<Array>& ref

Reference to the array used to create the iterator.

TypedArrayRef<T>& ref

Reference to the array used to create the iterator.

Returns

ColumnMajorIterator<T>

Non-const iterator to the beginning of the array.

ColumnMajorIterator<T const>

Const iterator to the beginning of the array.

Throws

matlab::data::TypeMismatchException

Element of Array does not match <T>.

End Iterators

template <typename T>
static ColumnMajorIterator<T> end(Array& arr)

template <typename T>
static ColumnMajorIterator<T> end(TypedArray<T>& arr)

template <typename T>
static ColumnMajorIterator<T> end(Reference<Array>& ref)

template <typename T>
static ColumnMajorIterator<T> end(TypedArrayRef<T>& ref)

template <typename T>
static ColumnMajorIterator<T const> end(const Array& arr)

template <typename T>
static ColumnMajorIterator<T const> end(const TypedArray<T>& arr)

template <typename T>
static ColumnMajorIterator<T const> end(const Reference<Array>& ref)

template <typename T>
static ColumnMajorIterator<T const> end(const TypedArrayRef<T>& ref)

template <typename T>
static ColumnMajorIterator<T const> cend(const TypedArray<T>& arr)

template <typename T>
static ColumnMajorIterator<T const> cend(const Array& arr)

template <typename T>
static ColumnMajorIterator<T const> cend(const Reference<Array>& ref)

template <typename T>
static ColumnMajorIterator<T const> cend(const TypedArrayRef<T>& ref)
Description

Create a ColumnMajorIterator to the end of the input array.

Parameters

Array& arr

Const or non-const array used to create the iterator.

TypedArray<T>& arr

Const or non-const array used to create the iterator.

Reference<Array>& ref

Const or non-const reference to the array used to create the iterator.

TypedArrayRef<T>& ref

Const or non-const reference to the array used to create the iterator.

Returns

ColumnMajorIterator<T>

Non-const iterator to the end of the array.

ColumnMajorIterator<T const>

Const iterator to the end of the array.

Throws

matlab::data::TypeMismatchException

Element of Array does not match <T>.

Member Functions

readOnlyElements

template <typename T>
static Range<ColumnMajorIterator<T const>> readOnlyElements(const Array& arr)

template <typename T>
static Range<ColumnMajorIterator<T const>> readOnlyElements(const TypedArray<T>& arr)

template <typename T>
static Range<ColumnMajorIterator<T const>> readOnlyElements(const Reference<Array>& ref)

template <typename T>
static Range<ColumnMajorIterator<T const>> readOnlyElements(const TypedArrayRef<T>& ref)
Description

Create a Range containing const iterators. Use for best performance when reading data from an array.

Parameters

const Array& arr

Input array used to create the iterators.

const TypedArray<T>& arr

Input array used to create the iterators.

const TypedArrayRef<T>& ref

Reference to the input array used to create the iterators.

const Reference<Array>& ref

Reference to the input array used to create the iterators.

Returns

Range<ColumnMajorIterator<T const>>

Range containing const ColumnMajorIterators that point to the beginning and the end of the input array.

Throws

matlab::data::TypeMismatchException

Element of Array does not match <T>.

writableElements

template <typename T>
static Range<ColumnMajorIterator<T>> writableElements(Array& arr)

template <typename T>
static Range<ColumnMajorIterator<T>> writableElements(TypedArray<T>& arr)

template <typename T>
static Range<ColumnMajorIterator<T>> writableElements(Reference<Array>& ref)

template <typename T>
static Range<ColumnMajorIterator<T>> writableElements(TypedArrayRef<T>& ref)
Description

Create a Range containing non-const iterators. For best performance when reading data from an array, use readOnlyElements, which returns ColumnMajorIterator<T const>.

Parameters

Array& arr

Array used to create the iterators.

TypedArray<T>& arr

Array used to create the iterators.

Reference<Array>& ref

Reference to array used to create the iterators.

TypedArrayRef<T>& ref

Reference to array used to create the iterators.

Returns

Range<ColumnMajorIterator<T>>

Range containing non-const ColumnMajorIterators that point to the beginning and the end of the input array.

Throws

matlab::data::TypeMismatchException

Element of Array does not match <T>.

Version History

Introduced in R2022a