Ginkgo: gko::accessor::row_major< ValueType, Dimensionality > Class Template Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::accessor::row_major< ValueType, Dimensionality > Class Template Reference

A row_major accessor is a bridge between a range and the row-major memory layout. More...

`#include <ginkgo/core/base/range_accessors.hpp>`

Collaboration diagram for gko::accessor::row_major< ValueType, Dimensionality >:
[legend]

## Public Types
using | value_type = ValueType
| Type of values returned by the accessor.
using | data_type = value_type*
| Type of underlying data storage.

## Public Member Functions
constexpr value_type & | operator() (size_type row, size_type col) const
| Returns the data element at position (row, col).
constexpr range< row_major > | operator() (const span &rows, const span &cols) const
| Returns the sub-range spanning the range (rows, cols).
constexpr size_type | length (size_type dimension) const
| Returns the length in dimension dimension.
template<typename OtherAccessor>
void | copy_from (const OtherAccessor &other) const
| Copies data from another accessor.

## Public Attributes
const data_type | data
| Reference to the underlying data.
const std::array< const size_type, dimensionality > | lengths
| An array of dimension sizes.
const size_type | stride
| Distance between consecutive rows.

## Static Public Attributes
static constexpr size_type | dimensionality = 2
| Number of dimensions of the accessor.

## Friends
class | range< row_major >

## Detailed Description

template<typename ValueType, size_type Dimensionality>
class gko::accessor::row_major< ValueType, Dimensionality >

A row_major accessor is a bridge between a range and the row-major memory layout.

You should never try to explicitly create an instance of this accessor. Instead, supply it as a template parameter to a range, and pass the constructor parameters for this class to the range (it will forward it to this class).

Warning
  The current implementation is incomplete, and only allows for 2-dimensional ranges.

Template Parameters

  ValueType | type of values this accessor returns
  Dimensionality | number of dimensions of this accessor (has to be 2)

## Member Function Documentation

## ◆ copy_from()

template<typename ValueType, size_type Dimensionality>
template<typename OtherAccessor>

void gko::accessor::row_major< ValueType, Dimensionality >::copy_from | ( | const OtherAccessor & | other | ) | const
| inline

Copies data from another accessor.

Warning
  Do not use this function since it is not optimized for a specific executor. It will always be performed sequentially. Please write an optimized version (adjusted to the architecture) by iterating through the values yourself.

Template Parameters

  OtherAccessor | type of the other accessor

Parameters

  other | other accessor

References lengths.

## ◆ length()

template<typename ValueType, size_type Dimensionality>

size_type gko::accessor::row_major< ValueType, Dimensionality >::length | ( | size_type | dimension | ) | const
| inlineconstexpr

Returns the length in dimension dimension.

Parameters

  dimension | a dimension index

Returns
  length in dimension dimension

References lengths.

## ◆ operator()() [1/2]

template<typename ValueType, size_type Dimensionality>

range< row_major > gko::accessor::row_major< ValueType, Dimensionality >::operator() | ( | const span & | rows,
|  | const span & | cols ) const
| inlineconstexpr

Returns the sub-range spanning the range (rows, cols).

Parameters

  rows | row span
  cols | column span

Returns
  sub-range spanning the range (rows, cols)

References gko::span::begin, data, gko::span::end, gko::span::is_valid(), lengths, and stride.

## ◆ operator()() [2/2]

template<typename ValueType, size_type Dimensionality>

value_type & gko::accessor::row_major< ValueType, Dimensionality >::operator() | ( | size_type | row,
|  | size_type | col ) const
| inlineconstexpr

Returns the data element at position (row, col).

Parameters

  row | row index
  col | column index

Returns
  data element at (row, col)

References data, lengths, and stride.

The documentation for this class was generated from the following file:

- ginkgo/core/base/range_accessors.hpp