| AI Engine API User Guide (AIE-API) 2026.1

Loading...
Searching...
No Matches
Basic Types

## Overview

The two main types offered by the AIE API are vectors (aie::vector) and accumulators (aie::accum).

### Vector

A vector represents a collection of elements of the same type which is transparently mapped to the corresponding vector registers supported on each architecture. Vectors are parametrized by the element type and the number of elements, and any combination that defines a 128b/256b/512b/1024b vector is supported natively. Larger vectors are also supported by transparently maintaining the required number of native vectors.

Supported vector types and native sizes
Arch. | int4 | uint4 | int8 | uint8 | int16 | uint16 | int32 | uint32 | bfloat16 | float16 | float | cint16 | cint32 | cbfloat16 | cfloat
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
AIE |  |  | 16/32/64/128 | 16/32/64/128 | 8/16/32/64 |  | 4/8/16/32 |  |  |  | 4/8/16/32 | 4/8/16/32 | 2/4/8/16 |  | 2/4/8/16
AIE-ML XDNA1 | 32/64/128/256 | 32/64/128/256 | 16/32/64/128 | 16/32/64/128 | 8/16/32/64 | 8/16/32/64 | 4/8/16/32 | 4/8/16/32 | 8/16/32/64 |  | 4/8/16/32 | 4/8/16/32 | 2/4/8/16 | 4/8/16/32 | 2/4/8/16
XDNA2 | 32/64/128/256 | 32/64/128/256 | 16/32/64/128 | 16/32/64/128 | 8/16/32/64 | 8/16/32/64 | 4/8/16/32 | 4/8/16/32 | 8/16/32/64 |  | 4/8/16/32 | 4/8/16/32 | 2/4/8/16 |  |
AIE-MLv2 | 32/64/128/256 | 32/64/128/256 | 16/32/64/128 | 16/32/64/128 | 8/16/32/64 | 8/16/32/64 | 4/8/16/32 | 4/8/16/32 | 8/16/32/64 | 8/16/32/64 | 4/8/16/32 | 4/8/16/32 | 2/4/8/16 | 4/8/16/32 | 2/4/8/16

To declare a vector, specify the desired template parameters following the vector template parameters table. The following example declares a vector variable with 32 elements of type int16:

aie::vector<int16, 32> my_vector;
aie::vector
Type for vector registers.
Definition vector.hpp:75

Refer to Basic Type Initialization for examples of how to initialize vector objects.

### Accumulator

An accumulator represents a collection of elements of the same class, typically obtained as a result of a multiplication operation. They are transparently mapped to the corresponding accumulator registers supported on each architecture. Accumulators commonly provide a large amount of bits, allowing users to perform long chains of operations whose intermediate results would otherwise exceed the range of regular vector types. They are parametrized by the element type (see Accumulator Element Types) and the number of elements. Element types specify the class of an element (e.g. integral, floating point, complex) and its minimum amount of bits required. AIE API then maps it to the nearest accumulator type that is supported natively. Similarly to vectors, accumulators larger than the native sizes are supported by transparently maintaining the required number of native accumulators.

Supported accumulator types and native sizes
Arch. |  | acc32 | acc40 | acc48 | acc56 | acc64 | acc72 | acc80 | accfloat | cacc32 | cacc40 | cacc48 | cacc56 | cacc64 | cacc72 | cacc80 | caccfloat
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
AIE | Lanes | 8/16/32/64/128 | 8/16/32/64/128 | 8/16/32/64/128 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16
Native accumulation | 48b | 48b | 48b | 80b | 80b | 80b | 80b | 32b | 48b | 48b | 48b | 80b | 80b | 80b | 80b | 32b
AIE-ML XDNA1 | Lanes | 8/16/32/64/128 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 |  |  | 4/8/16/32/64/128 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 |  |  | 2/4/8/16/32/64
Native accumulation | 32b | 64b | 64b | 64b | 64b |  |  | 32b | 64b | 64b | 64b | 64b | 64b |  |  | 32b
XDNA2 | Lanes | 8/16/32/64/128 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 |  |  | 4/8/16/32/64/128 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 |  |  |
Native accumulation | 32b | 64b | 64b | 64b | 64b |  |  | 32b | 64b | 64b | 64b | 64b | 64b |  |  |
AIE-MLv2 | Lanes | 8/16/32/64/128 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 | 4/8/16/32/64 |  |  | 4/8/16/32/64/128 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 | 2/4/8/16/32 |  |  | 2/4/8/16/32/64
Native accumulation | 32b | 64b | 64b | 64b | 64b |  |  | 32b | 64b | 64b | 64b | 64b | 64b |  |  | 32b

Like vectors, declaring an accumulator consists of specifying all its template parameters, following the accumulator template parameters table for the accepted combinations when declaring accumulators. For example:

aie::accum<accfloat, 16> my_accumulator;
aie::accum
Type for vector accumulators.
Definition accum.hpp:49

Refer to Basic Type Initialization for examples of how to initialize accumulator objects.

Note
  As mentioned in Interoperability with Adaptive Data Flow (ADF) Graph Abstractions, ADF graph code does not support non-native accumulator types.

### Block Vector

A block vector represents a collection of blocked data types where several elements share some common data.

A block is laid out in memory as shown below along with the valid values each type shown in the block vector parameters table.

Parameters describing the valid block_vector types
Type | Block size | Mantissa bits | Sub-tile shifts | Sub-tile shift bits | Exponent bits | Total block bytes
--- | --- | --- | --- | --- | --- | ---
bfp16ebs8 | 8 | 8 | 0 | n/a | 8 | 9
bfp16ebs16 | 16 | 8 | 0 | n/a | 8 | 17
mx4 | 16 | 3 | 8 | 1 | 8 | 8
mx6 | 16 | 5 | 8 | 1 | 8 | 12
mx9 | 16 | 8 | 8 | 1 | 8 | 18

For cases where the number of sub-tile shifts, M, is non-zero (i.e. there are sub-tile shifts) and is less than the block size, N, then each sub-tile shift will apply to N/M consecutive mantissas.

Block vectors are parametrized by the element type and the number of elements, with the supported combinations on each architecture shown below. Note that the number of elements refers to the total number of mantissas in all blocks. For example, an aie::vector<mx9, 64> will comprise of 4 blocks, each containing 16 mantissas as described above.

Supported block vector types and native sizes
Arch. | bfp16ebs8 | bfp16ebs16 | mx4 | mx6 | mx9
--- | --- | --- | --- | --- | ---
XDNA2 | 32/64/128/256 | 32/64/128/256 |  |  |
AIE-MLv2 |  |  | 641/128/256 | 641/128/256 | 64/128/256

Note
  1
    64 element vectors cannot be loaded from memory; they can only be extracted from larger vectors.

To declare a block vector, specify the desired template parameters following the block vector template parameters table. The following example declares a vector variable with 64 elements of type mx9:

aie::block_vector<mx9, 64> my_vector;

Refer to Block Vector Buffer Streams for examples of how to load data into block vector objects.

Note that block vector types are intended to be used only matrix multiplications and therefore offer limited support for other operations. For example, there is no support for elementwise arithmetic.

### Mask

Some comparison operations return masks. A mask is a collection of values that can be 0 or 1.

aie::mask<64> my_mask;
aie::mask
Type for vector element masks.
Definition mask.hpp:29

Refer to Basic Type Initialization for examples of how to initialize mask objects.

## Topics
| Basic Type Initialization
| Vector and Accumulator Conversions
| Vectors and accumulators of any given element type and size can be reinterpreted as a different element type.
| Concepts for Basic Types
| Accumulator Element Types
| Accumulators in AIE API rely on the aie::accum class template.
| Lazy Operations
| AIE architectures offer multiplication instructions that can perform additional operations on on the input arguments.

## Classes
class | aie::accum< MinAccumTag, Elems >
| Type for vector accumulators. More...
class | aie::mask< Elems >
| Type for vector element masks. More...
class | aie::sparse_vector< T, Elems >
| Type for sparse vector registers. More...
class | aie::vector< T, Elems >
| Type for vector registers. More...
class | aie::vector_elem_const_ref< T, N >
| Reference to immutable vector element. More...
class | aie::vector_elem_ref< T, N >
| Reference to vector element. More...

## Class Documentation

## ◆ aie::accum

class aie::accum

template<AccumElemBaseType MinAccumTag, unsigned Elems>
class aie::accum< MinAccumTag, Elems >

Type for vector accumulators.

Template Parameters

  MinAccumTag | Type tag that specifies the accumulator class and the required number of accumulation bits. Internally, this is rounded up to the smallest native accumulator size that meets the accuracy requirements. It must meet aie::AccumElemBaseType.
  Elems | Number of elements in the accumulator.

### Public Types
using | storage_t = typename base_type::storage_t
| Type that holds the actual accumulator's data.
using | value_type = typename base_type::value_type
| Type of the elements in the accumulator.
### Public Member Functions
| accum ()=default
| Default constructor.
| accum (const accum &)=default
| Copy constructor.
template<AccumElemBaseType Tag2> requires (has_same_representation<Tag2>())
| accum (const accum< Tag2, Elems > &acc)
| Copies another accumulator with the same underlying representation.
template<typename T>
| accum (const vector< T, Elems > &v, int shift=0)
| Construct from a vector.
| accum (storage_t data)
| Construct from internal storage type.
template<typename DstTag>
auto | cast_to () const
| Reinterprets the current accumulator as an accumulator of the given type.
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > | extract (unsigned idx) const
| Returns a subaccumulator with the contents of a region of the accumulator.
template<typename T>
void | from_vector (const vector< T, Elems > &v, int shift=0)
| Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.
template<typename T>
void | from_vector_sign (const vector< T, Elems > &v, bool v_sign, int shift=0)
| Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > | grow () const
| Returns a copy of the current accumulator in a larger accumulator.
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > | grow_extract (unsigned idx) const
| Returns a copy of the accumulator with a new size.
template<unsigned ElemsOut>
constexpr accum< MinAccumTag, ElemsOut > | grow_replicate () const
| Returns a copy of the current accumulator in a larger accumulator.
template<unsigned ElemsIn, AccumElemBaseType Tag2>
accum & | insert (unsigned idx, const accum< Tag2, ElemsIn > &acc)
| Updates the contents of a region of the accumulator with a native subaccumulator.
template<NativeAccumType T2>
accum & | insert (unsigned idx, T2 acc)
| Updates the contents of a region of the accumulator using the values in the given native subaccumulator.
template<unsigned ElemsIn>
accum & | insert (unsigned idx, typename accum< MinAccumTag, ElemsIn >::storage_t acc)
| Updates the contents of a region of the accumulator using the values in the given native subaccumulator.
| operator storage_t () const
| Operator for conversion to the internal underlying type.
template<typename T> requires (detail::accum_class_for_type_v<T> == value_class() && is_floating_point() && size() <= 32)
| operator vector< T, Elems > () const
| Performs the conversion of a FP32/CFP32 accumulator to a vector of the same type.
template<typename T>
accum & | operator= (const vector< T, Elems > &v)
| Updates the contents of the accumulator using the values in the given vector.
template<unsigned ElemsOut>
auto | split () const
| Returns the contents of the current accum stored in a std::tuple of subaccums.
auto | to_native () const
| Returns the native type of the accumulator.
auto | to_vector () const
| Returns the values of the FP32 accumulator in a vector of the requested type.
template<typename T>
vector< T, Elems > | to_vector (int shift=0) const
| Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the requested type, keeping the original values unchanged.
template<typename T>
vector< T, Elems > | to_vector_sign (bool v_sign, int shift=0) const
| Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the type and signedness requested.
template<typename T> requires (arch::is(arch::AIE))
vector< T, Elems > | to_vector_zip (int shift=0) const
| Permutes and applies shift-round-saturate to the elements of the accumulator.
template<AccumElemBaseType Tag2, unsigned E2, unsigned... Es> requires (Elems == (E2 + (Es + ...)) && ((Elems / E2 == Elems / Es) && ...))
void | upd_all (const accum< Tag2, E2 > &subacc, const accum< Tag2, Es > &...subaccums)
| Updates the contents of the accumulator using the values in the given subaccumulators.
### Static Public Member Functions
static constexpr unsigned | bits ()
| Returns the total size of the accumulator in bits.
static constexpr bool | is_complex ()
| Returns true if the element class is a complex number.
static constexpr bool | is_floating_point ()
| Returns true if the element class is a floating point number.
static constexpr bool | is_real ()
| Returns true if the element class is a real number.
static constexpr unsigned | size ()
| Returns the number of elements in the accumulator.
static constexpr detail::AccumClass | value_class ()
| Returns the class of the accumulator elements.

#### Member Typedef Documentation

## ◆ storage_t

template<AccumElemBaseType MinAccumTag, unsigned Elems>

using aie::accum< MinAccumTag, Elems >::storage_t = typename base_type::storage_t

Type that holds the actual accumulator's data.

May be different to its native type.

## ◆ value_type

template<AccumElemBaseType MinAccumTag, unsigned Elems>

using aie::accum< MinAccumTag, Elems >::value_type = typename base_type::value_type

Type of the elements in the accumulator.

#### Constructor & Destructor Documentation

## ◆ accum() [1/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>

aie::accum< MinAccumTag, Elems >::accum | ( |  | ) |
| default

Default constructor.

The value of the elements is undefined.

## ◆ accum() [2/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>

aie::accum< MinAccumTag, Elems >::accum | ( | const accum< MinAccumTag, Elems > & |  | ) |
| default

Copy constructor.

## ◆ accum() [3/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<AccumElemBaseType Tag2>
requires (has_same_representation<Tag2>())

aie::accum< MinAccumTag, Elems >::accum | ( | const accum< Tag2, Elems > & | acc | ) |
| inline

Copies another accumulator with the same underlying representation.

## ◆ accum() [4/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>

aie::accum< MinAccumTag, Elems >::accum | ( | storage_t | data | ) |
| inline

Construct from internal storage type.

Parameters

  data | Data used to construct the accumulator from.

## ◆ accum() [5/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>

aie::accum< MinAccumTag, Elems >::accum | ( | const vector< T, Elems > & | v,
|  | int | shift = 0 )
| inline explicit

Construct from a vector.

The accumulator class and the vector type must be compatible. The accumulator size and the vector size must be the same.

Parameters

  v | Data used to construct the accumulator from.
  shift | Upshift value.

#### Member Function Documentation

## ◆ bits()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

constexpr unsigned aie::accum< MinAccumTag, Elems >::bits | ( |  | ) |
| inline static constexpr

Returns the total size of the accumulator in bits.

## ◆ cast_to()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename DstTag>

auto aie::accum< MinAccumTag, Elems >::cast_to | ( |  | ) | const
| inline

Reinterprets the current accumulator as an accumulator of the given type.

The number of elements is automatically computed by the function

Template Parameters

  DstTag | Type the accumulator will be cast to

## ◆ extract()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>

accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, Elems >::extract | ( | unsigned | idx | ) | const
| inline

Returns a subaccumulator with the contents of a region of the accumulator.

Template Parameters

  ElemsOut | Size of the returned subaccumulator.

Parameters

  idx | Index of the subaccumulator to be returned.

## ◆ from_vector()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>

void aie::accum< MinAccumTag, Elems >::from_vector | ( | const vector< T, Elems > & | v,
|  | int | shift = 0 )
| inline

Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.

Parameters

  v | Input vector.
  shift | Number of bits to be upshifted.

## ◆ from_vector_sign()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>

void aie::accum< MinAccumTag, Elems >::from_vector_sign | ( | const vector< T, Elems > & | v,
|  | bool | v_sign,
|  | int | shift = 0 )
| inline

Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.

Allows for dynamic control of whether the values are considered signed or not.

Note
  Currently functional on AIE-ML/XDNA1 or later architectures only.

Parameters

  v | Input vector.
  v_sign | Values are considered signed or not, regardless of the underlying type.
  shift | Number of bits to be upshifted.

## ◆ grow()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>

accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, Elems >::grow | ( |  | ) | const
| inline

Returns a copy of the current accumulator in a larger accumulator.

The value of the new elements is undefined.

Template Parameters

  ElemsOut | Size of the output accumulator.

## ◆ grow_extract()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>

accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, Elems >::grow_extract | ( | unsigned | idx | ) | const
| inline

Returns a copy of the accumulator with a new size.

- Performs an extract(idx) operation when the new size is smaller.
- Performs a grow() operation when the new size is bigger.

See also
  grow<ElemsOut>(unsigned) const
  extract<ElemsOut>(unsigned) const

## ◆ grow_replicate()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>

accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, Elems >::grow_replicate | ( |  | ) | const
| inline constexpr

Returns a copy of the current accumulator in a larger accumulator.

The contents of the accumulator are replicated as many times as required to fill the output accumulator

Template Parameters

  ElemsOut | Size of the output accumulator.

## ◆ insert() [1/3]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsIn, AccumElemBaseType Tag2>

accum & aie::accum< MinAccumTag, Elems >::insert | ( | unsigned | idx,
|  | const accum< Tag2, ElemsIn > & | acc )
| inline

Updates the contents of a region of the accumulator with a native subaccumulator.

Parameters

  idx | Index of the subaccumulator to be replaced.
  acc | Native subaccumulator to be written into the region.

Returns
  Reference to the updated accumulator.

## ◆ insert() [2/3]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<NativeAccumType T2>

accum & aie::accum< MinAccumTag, Elems >::insert | ( | unsigned | idx,
|  | T2 | acc )
| inline

Updates the contents of a region of the accumulator using the values in the given native subaccumulator.

Parameters

  idx | Index of the subaccumulator to be replaced.
  acc | Native subaccumulator to be written into the region.

Returns
  Reference to the updated accumulator.

## ◆ insert() [3/3]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsIn>

accum & aie::accum< MinAccumTag, Elems >::insert | ( | unsigned | idx,
|  | typename accum< MinAccumTag, ElemsIn >::storage_t | acc )
| inline

Updates the contents of a region of the accumulator using the values in the given native subaccumulator.

Parameters

  idx | Index of the subaccumulator to be replaced.
  acc | Native subaccumulator to be written into the region.

Returns
  Reference to the updated accumulator.

## ◆ is_complex()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

constexpr bool aie::accum< MinAccumTag, Elems >::is_complex | ( |  | ) |
| inline static constexpr

Returns true if the element class is a complex number.

## ◆ is_floating_point()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

constexpr bool aie::accum< MinAccumTag, Elems >::is_floating_point | ( |  | ) |
| inline static constexpr

Returns true if the element class is a floating point number.

## ◆ is_real()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

constexpr bool aie::accum< MinAccumTag, Elems >::is_real | ( |  | ) |
| inline static constexpr

Returns true if the element class is a real number.

## ◆ operator storage_t()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

aie::accum< MinAccumTag, Elems >::operator storage_t | ( |  | ) | const
| inline

Operator for conversion to the internal underlying type.

If the number of internal subaccumulators is 1, this type matches the native type.

## ◆ operator vector< T, Elems >()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>
requires (detail::accum_class_for_type_v<T> == value_class() && is_floating_point() && size() <= 32)

aie::accum< MinAccumTag, Elems >::operator vector< T, Elems > | ( |  | ) | const
| inline

Performs the conversion of a FP32/CFP32 accumulator to a vector of the same type.

## ◆ operator=()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>

accum & aie::accum< MinAccumTag, Elems >::operator= | ( | const vector< T, Elems > & | v | ) |
| inline

Updates the contents of the accumulator using the values in the given vector.

No upshift is applied.

Parameters

  v | Input vector.

## ◆ size()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

constexpr unsigned aie::accum< MinAccumTag, Elems >::size | ( |  | ) |
| inline static constexpr

Returns the number of elements in the accumulator.

## ◆ split()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>

auto aie::accum< MinAccumTag, Elems >::split | ( |  | ) | const
| inline

Returns the contents of the current accum stored in a std::tuple of subaccums.

Template Parameters

  ElemsOut | Size of each subaccum.

## ◆ to_native()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

auto aie::accum< MinAccumTag, Elems >::to_native | ( |  | ) | const
| inline

Returns the native type of the accumulator.

Only valid when the number of subaccumulators is 1.

## ◆ to_vector() [1/2]

template<AccumElemBaseType MinAccumTag, unsigned Elems>

auto aie::accum< MinAccumTag, Elems >::to_vector | ( |  | ) | const
| inline

Returns the values of the FP32 accumulator in a vector of the requested type.

## ◆ to_vector() [2/2]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>

vector< T, Elems > aie::accum< MinAccumTag, Elems >::to_vector | ( | int | shift = 0 | ) | const
| inline

Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the requested type, keeping the original values unchanged.

Note
  On AIE-ML/XDNA1 shift values of -4, -3, and -2 are unsafe, as they will only produce correct result if truncation is selected or saturation against 0 is required.

Parameters

  shift | Number of bits that need to be downshifted.

## ◆ to_vector_sign()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>

vector< T, Elems > aie::accum< MinAccumTag, Elems >::to_vector_sign | ( | bool | v_sign,
|  | int | shift = 0 ) const
| inline

Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the type and signedness requested.

The original values are left unchanged.

Note
  Currently functional on AIE-ML/XDNA1 or later architectures only.
  On AIE-ML/XDNA1 shift values of -4, -3, and -2 are unsafe, as they will only produce correct result if truncation is selected or saturation against 0 is required.

Parameters

  v_sign | Returned vector is signed or not, regardless of the underlying type.
  shift | Number of bits that need to be downshifted.

## ◆ to_vector_zip()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T>
requires (arch::is(arch::AIE))

vector< T, Elems > aie::accum< MinAccumTag, Elems >::to_vector_zip | ( | int | shift = 0 | ) | const
| inline

Permutes and applies shift-round-saturate to the elements of the accumulator.

Then, it stores the result into a vector of the requested type.

The original values are left unchanged.

The values are interleaved as if the accumulator were split in two parts and zipped.

Parameters

  shift | Number of bits that need to be downshifted.

## ◆ upd_all()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<AccumElemBaseType Tag2, unsigned E2, unsigned... Es>
requires (Elems == (E2 + (Es + ...)) && ((Elems / E2 == Elems / Es) && ...))

void aie::accum< MinAccumTag, Elems >::upd_all | ( | const accum< Tag2, E2 > & | subacc,
|  | const accum< Tag2, Es > &... | subaccums )
| inline

Updates the contents of the accumulator using the values in the given subaccumulators.

Subaccumulators must be of the same class and size.

Parameters

  subacc | First sub-accumulator.
  subaccums | Remaining sub-accumulators.

## ◆ value_class()

template<AccumElemBaseType MinAccumTag, unsigned Elems>

constexpr detail::AccumClass aie::accum< MinAccumTag, Elems >::value_class | ( |  | ) |
| inline static constexpr

Returns the class of the accumulator elements.

#### Friends And Related Symbol Documentation

## ◆ accum

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<AccumElemBaseType Tag2, unsigned E2>

friend class accum
| friend

## ◆ accum_base

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<detail::AccumClass Class, unsigned MinBits, unsigned E2>

friend class accum_base
| friend

## ◆ aie::mask

class aie::mask

template<unsigned Elems>
class aie::mask< Elems >

Type for vector element masks.

This type is returned by logical operations and used as input in selection operations.

Template Parameters

  Elems | Number of elements represented in the mask.

### Public Member Functions
constexpr | mask (bool initial_set=false)
| Creates a mask.
constexpr | mask (const mask &)=default
| Copy constructor.
template<typename... T>
constexpr | mask (const T &... words)
| Construct from unsigned (32b) words.
constexpr void | clear (unsigned i)
| Sets the value of the element in the given index to 0.
constexpr unsigned | clz () const
| Returns the count of consecutive elements, starting at the high part of the mask, whose value is 0.
constexpr unsigned | count () const
| Returns the count of elements whose value is 1.
constexpr const auto & | data () const
constexpr bool | empty () const
| Returns a bool that says whether the value of all the elements in the mask is 0.
template<unsigned ElemsOut>
constexpr mask< ElemsOut > | extract (unsigned idx) const
| Returns the contents of a section of the mask into a smaller mask.
constexpr bool | full () const
| Returns a bool that says whether the value of all the elements in the mask is 1.
template<unsigned ElemsOut>
constexpr mask< ElemsOut > | get_submask (unsigned idx) const
| Returns the contents of a section of the mask into a smaller mask.
template<unsigned ElemsOut> requires (ElemsOut >= Elems)
constexpr mask< ElemsOut > | grow () const
| Returns a larger mask with matching least significant Elems bits and remaining bits set to zero.
template<unsigned ElemsIn>
constexpr mask & | insert (unsigned idx, const mask< ElemsIn > &m)
| Updates the contents of a region of the mask.
constexpr mask | operator& (const mask &a) const
| Returns the result of merging the current and the given masks using the AND operation.
constexpr mask & | operator&= (const mask &a)
| Updates the mask with the result of merging the current with the given masks using the AND operation.
constexpr mask | operator<< (unsigned shift) const
| Returns the result of a binary left shift of the mask.
constexpr mask & | operator<<= (unsigned shift)
| Returns the result of a binary left shift of the mask.
constexpr mask & | operator= (const mask &)=default
| Copy-assignment operator.
constexpr bool | operator== (const mask &a) const
| Compares whether two masks are equal.
constexpr mask | operator>> (unsigned shift) const
| Returns the result of a binary right shift of the mask.
constexpr mask & | operator>>= (unsigned shift)
| Returns the result of a binary right shift of the mask.
constexpr mask | operator| (const mask &a) const
| Returns the result of merging the current and the given masks using the OR operation.
constexpr mask & | operator|= (const mask &a)
| Updates the mask with the result of merging the current and the given masks using the OR operation.
constexpr mask | operator~ () const
| Returns a mask that contains the negation of the values of all the elements in the mask (0->1, 1->0).
constexpr void | set (unsigned i)
| Sets the value of the element in the given index to 1.
constexpr bool | test (unsigned i) const
| Returns the value of the element in the given index.
template<unsigned Elems2 = Elems> requires (Elems2 <= 32)
constexpr unsigned | to_uint32 () const
| Returns the contents of the mask in a 32b unsigned integer.
constexpr unsigned | to_uint32 (unsigned i) const
| Returns the contents of a section of the mask in a 32b unsigned integer.
constexpr uint64_t | to_uint64 () const
| Returns the contents of the mask in a 64b unsigned integer.
constexpr uint64_t | to_uint64 (unsigned i) const
| Returns the contents of a section of the mask in a 64b unsigned integer.
template<unsigned Elems2>
constexpr vector< uint32_t, Elems2 > | to_vector () const
| Returns the contents of the mask in a vector.
### Static Public Member Functions
template<unsigned E, unsigned... Es> requires (Elems == (Es + ... + E) && ((E == Es) && ...))
static constexpr mask< Elems > | from_masks (const mask< E > &m, const mask< Es > &... masks)
| Construct from concatenating multiple smaller masks.
template<unsigned E, unsigned N> requires (Elems == (E * N))
static constexpr mask< Elems > | from_masks (const mask< E >(&masks)[N])
| Construct from concatenating multiple smaller masks.
template<typename T> requires (std::is_same_v<unsigned, T>)
static constexpr mask< Elems > | from_uint32 (assume_zero_padding_t tag, const T &word)
| Construct from an unsigned (32b) word.
template<ConvertibleTo< uint32_t >... T> requires (!(std::is_same_v<T, unsigned> && ...))
static constexpr mask< Elems > | from_uint32 (const T &... words)
template<SameAs< unsigned >... T> requires (sizeof...(T) == std::max(1u, Elems / 32))
static constexpr mask< Elems > | from_uint32 (const T &... words)
| Construct from unsigned (32b) words.
template<AnyOf< unsigned long long, uint64_t > T>
static constexpr mask< Elems > | from_uint64 (assume_zero_padding_t tag, const T &word)
| Construct from an unsigned (64b) word.
template<ConvertibleTo< mask64 >... T> requires (!(detail::utils::is_one_of_v<T, mask64, unsigned long long, uint64_t> && ...))
static constexpr mask< Elems > | from_uint64 (const T &... words)
template<SameAs< mask64 >... T> requires (sizeof...(T) == std::max(1u, Elems / 64))
static constexpr mask< Elems > | from_uint64 (const T &... words)
| Conversion from mask64 intrinsic type.
template<AnyOf< unsigned long long, uint64_t > ... T> requires (sizeof...(T) == std::max(1u, Elems / 64))
static constexpr mask< Elems > | from_uint64 (const T &... words)
| Construct from unsigned (64b) words.
template<typename T, unsigned N, typename... Ts> requires ((std::is_same_v<vector<T, N>, Ts> && ...))
static constexpr mask< Elems > | from_vector (const vector< T, N > &v, const Ts &... vs)
| Construct from aie::vectors.
static constexpr unsigned | size ()
| Returns the number of elements in the vector.

#### Constructor & Destructor Documentation

## ◆ mask() [1/3]

template<unsigned Elems>

aie::mask< Elems >::mask | ( | bool | initial_set = false | ) |
| inline explicit constexpr

Creates a mask.

Parameters

  initial_set | If true, the mask is initialized with 1s, otherise it is initialized with 0s.

## ◆ mask() [2/3]

template<unsigned Elems>

aie::mask< Elems >::mask | ( | const mask< Elems > & |  | ) |
| constexpr default

Copy constructor.

## ◆ mask() [3/3]

template<unsigned Elems>
template<typename... T>

aie::mask< Elems >::mask | ( | const T &... | words | ) |
| inline explicit constexpr

Construct from unsigned (32b) words.

Each bit in the input words is used to initialize one of the elements in the mask.

Parameters

  w | First word used to initialize the mask.
  words | Rest of words used to initialize the mask.

#### Member Function Documentation

## ◆ clear()

template<unsigned Elems>

void aie::mask< Elems >::clear | ( | unsigned | i | ) |
| inline constexpr

Sets the value of the element in the given index to 0.

Parameters

  i | Element index.

## ◆ clz()

template<unsigned Elems>

unsigned aie::mask< Elems >::clz | ( |  | ) | const
| inline constexpr

Returns the count of consecutive elements, starting at the high part of the mask, whose value is 0.

## ◆ count()

template<unsigned Elems>

unsigned aie::mask< Elems >::count | ( |  | ) | const
| inline constexpr

Returns the count of elements whose value is 1.

## ◆ data()

template<unsigned Elems>

const auto & aie::mask< Elems >::data | ( |  | ) | const
| inline constexpr

Deprecated
  Use alternative functions to access the elements of a mask.

See also
  to_uint32, to_uint64, extract

## ◆ empty()

template<unsigned Elems>

bool aie::mask< Elems >::empty | ( |  | ) | const
| inline constexpr

Returns a bool that says whether the value of all the elements in the mask is 0.

## ◆ extract()

template<unsigned Elems>
template<unsigned ElemsOut>

mask< ElemsOut > aie::mask< Elems >::extract | ( | unsigned | idx | ) | const
| inline constexpr

Returns the contents of a section of the mask into a smaller mask.

Template Parameters

  ElemsOut | Size of the returned mask

Parameters

  idx | Index of the section within the mask (in chunks of ElemsOut elements)

## ◆ from_masks() [1/2]

template<unsigned Elems>
template<unsigned E, unsigned... Es>
requires (Elems == (Es + ... + E) && ((E == Es) && ...))

constexpr mask< Elems > aie::mask< Elems >::from_masks | ( | const mask< E > & | m,
|  | const mask< Es > &... | masks )
| inline static constexpr

Construct from concatenating multiple smaller masks.

Parameters

  m | First mask used to initialize least significant elements in the new mask.
  masks | Other masks used to initialize the rest of the elements.

## ◆ from_masks() [2/2]

template<unsigned Elems>
template<unsigned E, unsigned N>
requires (Elems == (E * N))

constexpr mask< Elems > aie::mask< Elems >::from_masks | ( | const mask< E >(&) | masks[N] | ) |
| inline static constexpr

Construct from concatenating multiple smaller masks.

Parameters

  masks | Masks used to initialize the rest of the elements.

## ◆ from_uint32() [1/3]

template<unsigned Elems>
template<typename T>
requires (std::is_same_v<unsigned, T>)

constexpr mask< Elems > aie::mask< Elems >::from_uint32 | ( | assume_zero_padding_t | tag,
|  | const T & | word )
| inline static constexpr

Construct from an unsigned (32b) word.

Insignificant or undefined elements are assumed to be zero.

Masks larger than 32 elements have the most significant elements set to zero. Masks smaller than 32 elements assume insignificant bits in word are already set to zero.

## ◆ from_uint32() [2/3]

template<unsigned Elems>
template<ConvertibleTo< uint32_t >... T>
requires (!(std::is_same_v<T, unsigned> && ...))

constexpr mask< Elems > aie::mask< Elems >::from_uint32 | ( | const T &... | words | ) |
| inline static constexpr

## ◆ from_uint32() [3/3]

template<unsigned Elems>
template<SameAs< unsigned >... T>
requires (sizeof...(T) == std::max(1u, Elems / 32))

constexpr mask< Elems > aie::mask< Elems >::from_uint32 | ( | const T &... | words | ) |
| inline static constexpr

Construct from unsigned (32b) words.

Each bit in the input words is used to initialize one of the elements in the mask.

Parameters

  w | First word used to initialize the mask.
  words | Rest of words used to initialize the mask.

## ◆ from_uint64() [1/4]

template<unsigned Elems>
template<AnyOf< unsigned long long, uint64_t > T>

constexpr mask< Elems > aie::mask< Elems >::from_uint64 | ( | assume_zero_padding_t | tag,
|  | const T & | word )
| inline static constexpr

Construct from an unsigned (64b) word.

Insignificant or undefined elements are assumed to be zero.

Masks larger than 64 elements have the most significant elements set to zero. Masks smaller than 64 elements assume insignificant bits in word are already set to zero.

## ◆ from_uint64() [2/4]

template<unsigned Elems>
template<ConvertibleTo< mask64 >... T>
requires (!(detail::utils::is_one_of_v<T, mask64, unsigned long long, uint64_t> && ...))

constexpr mask< Elems > aie::mask< Elems >::from_uint64 | ( | const T &... | words | ) |
| inline static constexpr

## ◆ from_uint64() [3/4]

template<unsigned Elems>
template<SameAs< mask64 >... T>
requires (sizeof...(T) == std::max(1u, Elems / 64))

constexpr mask< Elems > aie::mask< Elems >::from_uint64 | ( | const T &... | words | ) |
| inline static constexpr

Conversion from mask64 intrinsic type.

Only supported by mask<64>.

## ◆ from_uint64() [4/4]

template<unsigned Elems>
template<AnyOf< unsigned long long, uint64_t > ... T>
requires (sizeof...(T) == std::max(1u, Elems / 64))

constexpr mask< Elems > aie::mask< Elems >::from_uint64 | ( | const T &... | words | ) |
| inline static constexpr

Construct from unsigned (64b) words.

Each bit in the input words is used to initialize one of the elements in the mask.

Parameters

  words | Words used to initialize the mask.

## ◆ from_vector()

template<unsigned Elems>
template<typename T, unsigned N, typename... Ts>
requires ((std::is_same_v<vector<T, N>, Ts> && ...))

constexpr mask< Elems > aie::mask< Elems >::from_vector | ( | const vector< T, N > & | v,
|  | const Ts &... | vs )
| inline static constexpr

Construct from aie::vectors.

Each bit in the input vectors is used to initialize one of the elements in the mask.

Parameters

  v | First vector used to initialize the mask.
  vs | Rest of vectors used to initialize the mask.

## ◆ full()

template<unsigned Elems>

bool aie::mask< Elems >::full | ( |  | ) | const
| inline constexpr

Returns a bool that says whether the value of all the elements in the mask is 1.

## ◆ get_submask()

template<unsigned Elems>
template<unsigned ElemsOut>

mask< ElemsOut > aie::mask< Elems >::get_submask | ( | unsigned | idx | ) | const
| inline constexpr

Returns the contents of a section of the mask into a smaller mask.

Template Parameters

  ElemsOut | Size of the returned mask

Parameters

  idx | Index of the section within the mask (in chunks of ElemsOut elements)

## ◆ grow()

template<unsigned Elems>
template<unsigned ElemsOut>
requires (ElemsOut >= Elems)

mask< ElemsOut > aie::mask< Elems >::grow | ( |  | ) | const
| inline constexpr

Returns a larger mask with matching least significant Elems bits and remaining bits set to zero.

## ◆ insert()

template<unsigned Elems>
template<unsigned ElemsIn>

mask & aie::mask< Elems >::insert | ( | unsigned | idx,
|  | const mask< ElemsIn > & | m )
| inline constexpr

Updates the contents of a region of the mask.

The updated region will contain the values in the given submask.

Parameters

  idx | Index of the submask to be replaced.
  m | Submask to be written into the region.

Returns
  a reference to the updated mask.

## ◆ operator&()

template<unsigned Elems>

mask aie::mask< Elems >::operator& | ( | const mask< Elems > & | a | ) | const
| inline constexpr

Returns the result of merging the current and the given masks using the AND operation.

Parameters

  a | Mask to merge with.

## ◆ operator&=()

template<unsigned Elems>

mask & aie::mask< Elems >::operator&= | ( | const mask< Elems > & | a | ) |
| inline constexpr

Updates the mask with the result of merging the current with the given masks using the AND operation.

Returns a reference to the updated mask.

Parameters

  a | Mask to merge with.

## ◆ operator<<()

template<unsigned Elems>

mask aie::mask< Elems >::operator<< | ( | unsigned | shift | ) | const
| inline constexpr

Returns the result of a binary left shift of the mask.

Parameters

  shift | Number of positions to shift the mask.

## ◆ operator<<=()

template<unsigned Elems>

mask & aie::mask< Elems >::operator<<= | ( | unsigned | shift | ) |
| inline constexpr

Returns the result of a binary left shift of the mask.

Returns a reference to the updated mask.

Parameters

  shift | Number of positions to shift the mask.

## ◆ operator=()

template<unsigned Elems>

mask & aie::mask< Elems >::operator= | ( | const mask< Elems > & |  | ) |
| constexpr default

Copy-assignment operator.

## ◆ operator==()

template<unsigned Elems>

bool aie::mask< Elems >::operator== | ( | const mask< Elems > & | a | ) | const
| inline constexpr

Compares whether two masks are equal.

Parameters

  a | Mask to compare against.

## ◆ operator>>()

template<unsigned Elems>

mask aie::mask< Elems >::operator>> | ( | unsigned | shift | ) | const
| inline constexpr

Returns the result of a binary right shift of the mask.

Parameters

  shift | Number of positions to shift the mask.

## ◆ operator>>=()

template<unsigned Elems>

mask & aie::mask< Elems >::operator>>= | ( | unsigned | shift | ) |
| inline constexpr

Returns the result of a binary right shift of the mask.

Returns a reference to the updated mask.

Parameters

  shift | Number of positions to shift the mask.

## ◆ operator|()

template<unsigned Elems>

mask aie::mask< Elems >::operator| | ( | const mask< Elems > & | a | ) | const
| inline constexpr

Returns the result of merging the current and the given masks using the OR operation.

Parameters

  a | Mask to merge with.

## ◆ operator|=()

template<unsigned Elems>

mask & aie::mask< Elems >::operator|= | ( | const mask< Elems > & | a | ) |
| inline constexpr

Updates the mask with the result of merging the current and the given masks using the OR operation.

Returns a reference to the updated mask.

Parameters

  a | Mask to merge with.

## ◆ operator~()

template<unsigned Elems>

mask aie::mask< Elems >::operator~ | ( |  | ) | const
| inline constexpr

Returns a mask that contains the negation of the values of all the elements in the mask (0->1, 1->0).

## ◆ set()

template<unsigned Elems>

void aie::mask< Elems >::set | ( | unsigned | i | ) |
| inline constexpr

Sets the value of the element in the given index to 1.

Parameters

  i | Element index.

## ◆ size()

template<unsigned Elems>

constexpr unsigned aie::mask< Elems >::size | ( |  | ) |
| inline static constexpr

Returns the number of elements in the vector.

## ◆ test()

template<unsigned Elems>

bool aie::mask< Elems >::test | ( | unsigned | i | ) | const
| inline constexpr

Returns the value of the element in the given index.

Parameters

  i | Element index.

## ◆ to_uint32() [1/2]

template<unsigned Elems>
template<unsigned Elems2 = Elems>
requires (Elems2 <= 32)

unsigned aie::mask< Elems >::to_uint32 | ( |  | ) | const
| inline constexpr

Returns the contents of the mask in a 32b unsigned integer.

## ◆ to_uint32() [2/2]

template<unsigned Elems>

unsigned aie::mask< Elems >::to_uint32 | ( | unsigned | i | ) | const
| inline constexpr

Returns the contents of a section of the mask in a 32b unsigned integer.

Parameters

  i | Index of the section within the mask (in chunks of 32 elements)

## ◆ to_uint64() [1/2]

template<unsigned Elems>

uint64_t aie::mask< Elems >::to_uint64 | ( |  | ) | const
| inline constexpr

Returns the contents of the mask in a 64b unsigned integer.

## ◆ to_uint64() [2/2]

template<unsigned Elems>

uint64_t aie::mask< Elems >::to_uint64 | ( | unsigned | i | ) | const
| inline constexpr

Returns the contents of a section of the mask in a 64b unsigned integer.

Parameters

  i | Index of the section within th mask (in chunks of 64 elements)

## ◆ to_vector()

template<unsigned Elems>
template<unsigned Elems2>

vector< uint32_t, Elems2 > aie::mask< Elems >::to_vector | ( |  | ) | const
| inline constexpr

Returns the contents of the mask in a vector.

Template Parameters

  Elems2 | number of elements in the result vector

#### Friends And Related Symbol Documentation

## ◆ mask

template<unsigned Elems>
template<unsigned Elems2>

friend class mask
| friend

## ◆ detail::mask_base

template<unsigned Elems>
template<unsigned Elems2, typename Storage2>

friend class detail::mask_base
| friend

## ◆ aie::sparse_vector

class aie::sparse_vector

template<ElemBaseType T, unsigned Elems>
requires (arch::is(arch::Gen2))
class aie::sparse_vector< T, Elems >

Type for sparse vector registers.

Template Parameters

  T | Type of the elements contained in the sparse vector. It must meet aie::ElemBaseType.
  Elems | Number of elements in the sparse vector.

### Public Types
using | native_pointer_type = typename vector_storage_type::pointer_type
| Intrinsic type of pointers referring to data stored in sparse format.
using | native_type = detail::native_sparse_vector_type_t<T, Elems>
| Equivalent intrinsic type for the same element type and size.
using | storage_t = typename vector_storage_type::type
| Type that holds the actual sparse_vector's data.
using | value_type = T
| Type of the elements in the sparse_vector.
using | vector_storage_type = detail::sparse_vector_storage<T, Elems>
### Public Member Functions
| sparse_vector ()=default
| Default constructor.
| sparse_vector (const storage_t &data)
| Construct a sparse_vector from internal native types.
template<unsigned Elems2> requires (Elems2 == Elems / 2)
sparse_vector< T, Elems2 > | extract (unsigned idx) const
| Returns a subvector with the contents of a region of the sparse_vector.
vector< T, Elems/2 > | extract_data () const =delete
| Returns an aie::vector containing partially decompressed sparse values.
value_type | get (unsigned idx) const
| Returns the value of the element on the given index.
template<unsigned ElemsIn> requires (ElemsIn == Elems / 2 || ElemsIn == Elems)
sparse_vector & | insert (unsigned idx, const sparse_vector< T, ElemsIn > &v)
| Updates the contents of a region of the sparse_vector.
| operator native_type () const
| Returns the value of the vector using its native type.
### Static Public Member Functions
static constexpr unsigned | bits ()
static constexpr unsigned | bytes ()
static constexpr bool | is_complex ()
| Returns true if the element type is a complex number.
static constexpr bool | is_floating_point ()
| Returns true if the element type is floating-point.
static constexpr bool | is_integral ()
| Returns true if the element type is an integer.
static constexpr bool | is_signed ()
| Returns true if the element type is signed.
static constexpr unsigned | memory_bytes ()
static constexpr unsigned | size ()
| Returns the number of elements in the vector.
static constexpr unsigned | sparsity_ratio ()

#### Member Typedef Documentation

## ◆ native_pointer_type

template<ElemBaseType T, unsigned Elems>

using aie::sparse_vector< T, Elems >::native_pointer_type = typename vector_storage_type::pointer_type

Intrinsic type of pointers referring to data stored in sparse format.

## ◆ native_type

template<ElemBaseType T, unsigned Elems>

using aie::sparse_vector< T, Elems >::native_type = detail::native_sparse_vector_type_t<T, Elems>

Equivalent intrinsic type for the same element type and size.

## ◆ storage_t

template<ElemBaseType T, unsigned Elems>

using aie::sparse_vector< T, Elems >::storage_t = typename vector_storage_type::type

Type that holds the actual sparse_vector's data.

May be different to its native type.

## ◆ value_type

template<ElemBaseType T, unsigned Elems>

using aie::sparse_vector< T, Elems >::value_type = T

Type of the elements in the sparse_vector.

## ◆ vector_storage_type

template<ElemBaseType T, unsigned Elems>

using aie::sparse_vector< T, Elems >::vector_storage_type = detail::sparse_vector_storage<T, Elems>

#### Constructor & Destructor Documentation

## ◆ sparse_vector() [1/2]

template<ElemBaseType T, unsigned Elems>

aie::sparse_vector< T, Elems >::sparse_vector | ( |  | ) |
| default

Default constructor.

The value of the elements is undefined.

## ◆ sparse_vector() [2/2]

template<ElemBaseType T, unsigned Elems>

aie::sparse_vector< T, Elems >::sparse_vector | ( | const storage_t & | data | ) |
| inline

Construct a sparse_vector from internal native types.

Parameters

  data | Data used to construct the vector from.

#### Member Function Documentation

## ◆ bits()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::sparse_vector< T, Elems >::bits | ( |  | ) |
| inline static constexpr

## ◆ bytes()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::sparse_vector< T, Elems >::bytes | ( |  | ) |
| inline static constexpr

## ◆ extract()

template<ElemBaseType T, unsigned Elems>
template<unsigned Elems2>
requires (Elems2 == Elems / 2)

sparse_vector< T, Elems2 > aie::sparse_vector< T, Elems >::extract | ( | unsigned | idx | ) | const
| inline

Returns a subvector with the contents of a region of the sparse_vector.

Template Parameters

  ElemsOut | Size of the returned subvector.

Parameters

  idx | Index of the subvector to be returned.

## ◆ extract_data()

template<ElemBaseType T, unsigned Elems>

vector< T, Elems/2 > aie::sparse_vector< T, Elems >::extract_data | ( |  | ) | const
| delete

Returns an aie::vector containing partially decompressed sparse values.

## ◆ get()

template<ElemBaseType T, unsigned Elems>

value_type aie::sparse_vector< T, Elems >::get | ( | unsigned | idx | ) | const
| inline

Returns the value of the element on the given index.

Warning
  Currently not implemented.

Parameters

  idx | Index of the element.

## ◆ insert()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsIn>
requires (ElemsIn == Elems / 2 || ElemsIn == Elems)

sparse_vector & aie::sparse_vector< T, Elems >::insert | ( | unsigned | idx,
|  | const sparse_vector< T, ElemsIn > & | v )
| inline

Updates the contents of a region of the sparse_vector.

The updated region will contain the values in the given subvector.

Parameters

  idx | Index of the subvector to be replaced.
  v | Subvector to be written into the region.

Returns
  a reference to the updated vector.

## ◆ is_complex()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::sparse_vector< T, Elems >::is_complex | ( |  | ) |
| inline static constexpr

Returns true if the element type is a complex number.

## ◆ is_floating_point()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::sparse_vector< T, Elems >::is_floating_point | ( |  | ) |
| inline static constexpr

Returns true if the element type is floating-point.

## ◆ is_integral()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::sparse_vector< T, Elems >::is_integral | ( |  | ) |
| inline static constexpr

Returns true if the element type is an integer.

## ◆ is_signed()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::sparse_vector< T, Elems >::is_signed | ( |  | ) |
| inline static constexpr

Returns true if the element type is signed.

## ◆ memory_bytes()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::sparse_vector< T, Elems >::memory_bytes | ( |  | ) |
| inline static constexpr

## ◆ operator native_type()

template<ElemBaseType T, unsigned Elems>

aie::sparse_vector< T, Elems >::operator native_type | ( |  | ) | const
| inline

Returns the value of the vector using its native type.

## ◆ size()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::sparse_vector< T, Elems >::size | ( |  | ) |
| inline static constexpr

Returns the number of elements in the vector.

## ◆ sparsity_ratio()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::sparse_vector< T, Elems >::sparsity_ratio | ( |  | ) |
| inline static constexpr

#### Friends And Related Symbol Documentation

## ◆ sparse_vector

template<ElemBaseType T, unsigned Elems>
template<ElemBaseType T2, unsigned Elems2>

friend class sparse_vector
| friend

## ◆ aie::vector

class aie::vector

template<ElemBaseType T, unsigned Elems>
class aie::vector< T, Elems >

Type for vector registers.

Template Parameters

  T | Type of the elements contained in the vector. It must meet aie::ElemBaseType.
  Elems | Number of elements in the vector.

### Public Types
using | native_type = typename base_type::native_type
| Equivalent intrinsic type for the same element type and size.
using | storage_t = typename base_type::storage_t
| Type that holds the actual vector's data.
using | value_type = typename base_type::value_type
| Type of the elements in the vector.
### Public Member Functions
| vector ()
| Default constructor.
| vector (const native_type &v)
| Construct from internal types.
| vector (storage_t v)
| Construct a vector from internal native types.
template<typename... Values>
| vector (value_type v, Values &&... values)
| Construct from a list of values.
template<typename DstT>
auto | cast_to () const
| Reinterprets the current vector as a vector of the given type.
constexpr vector_elem_const_ref< value_type, Elems > | elem_const_ref (unsigned idx) const
| Returns a constant reference object to the element on the given index.
constexpr vector_elem_ref< value_type, Elems > | elem_ref (unsigned idx)
| Returns a reference object to the element on the given index.
constexpr vector_elem_const_ref< value_type, Elems > | elem_ref (unsigned idx) const
| Returns a constant reference object to the element on the given index.
template<unsigned ElemsOut>
vector< value_type, ElemsOut > | extract (unsigned idx) const
| Returns a subvector with the contents of a region of the vector.
value_type | get (unsigned idx) const
| Returns the value of the element on the given index.
template<unsigned ElemsOut>
constexpr vector< T, ElemsOut > | grow (unsigned idx=0) const
| Returns a copy of the current vector in a larger vector.
template<unsigned ElemsOut>
vector< value_type, ElemsOut > | grow_extract (unsigned idx) const
| Returns a copy of the current vector in a new size.
template<unsigned ElemsOut>
constexpr vector< T, ElemsOut > | grow_replicate () const
| Returns a copy of the current vector in a larger vector.
template<unsigned ElemsIn>
vector & | insert (unsigned idx, const vector< T, ElemsIn > &v)
| Updates the contents of a region of the vector.
template<NativeVectorType T2>
vector & | insert (unsigned idx, T2 v)
| Updates the contents of a region of the vector using.
template<unsigned ElemsIn>
vector & | insert (unsigned idx, typename vector< T, ElemsIn >::native_type v)
| Updates the contents of a region of the vector using.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2> requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void | load (const T2 *ptr)
| Replaces the contents of the vector with the values pointed by the given memory address.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2> requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void | load_unaligned (const T2 *ptr, unsigned aligned_elems)
| Replaces the contents of the vector with the values pointed by the given memory address.
| operator native_type () const
| Operator for conversion to the native type.
constexpr vector_elem_ref< value_type, Elems > | operator[] (unsigned idx)
| Returns a reference object to the element on the given index.
constexpr vector_elem_const_ref< value_type, Elems > | operator[] (unsigned idx) const
| Returns a constant reference object to the element on the given index.
template<PackableFrom< T > T2 = typename detail::packed_type<T>::type>
auto | pack () const -> vector< T2, Elems >
| Returns a copy of the vector with elements represented in a narrower type.
template<PackableFrom< T > T2 = typename detail::packed_type<T>::type>
auto | pack_sign (bool v_sign) const -> vector< T2, Elems >
| Returns a copy of the vector with elements represented in a narrower type, with dynamic selection of whether vectors are signed or not.
vector & | push (value_type v)
| Adds a new element to the vector, moving existing elements one position up.
void | set (value_type v, unsigned idx)
| Updates the value of the element on the given index.
template<unsigned ElemsOut>
auto | split () const -> auto
| Returns the contents of the current vector stored in a std::tuple of subvectors.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2> requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void | store (T2 *ptr) const
| Writes the contents of the vector into the given memory address.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2> requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void | store_unaligned (T2 *ptr, unsigned aligned_elems) const
| Writes the contents of the vector into the given memory address.
native_type | to_native () const
| Returns the value of the vector using its native type.
template<UnpackableFrom< T > T2 = typename detail::unpacked_type<T>::type>
auto | unpack () const -> vector< T2, Elems >
| Returns a copy of the vector with elements represented in a wider type.
template<UnpackableFrom< T > T2 = typename detail::unpacked_type<T>::type>
auto | unpack_sign (bool v_sign) const -> vector< T2, Elems >
| Returns a copy of the vector with elements represented in a wider type, with dynamic selection of whether vectors are signed or not.
template<typename... SubVectors>
vector & | upd_all (SubVectors &&...subvectors)
| Updates the contents of the vector using the values in the given subvectors.
### Static Public Member Functions
static constexpr unsigned | bits ()
| Returns the total size of the vector in bits.
static constexpr unsigned | bytes ()
| Returns the total capacity of the vector in bytes.
static constexpr bool | is_complex ()
| Returns true if the element type is a complex number.
static constexpr bool | is_floating_point ()
| Returns true if the element type is floating-point.
static constexpr bool | is_integral ()
| Returns true if the element type is an integer.
static constexpr bool | is_real ()
| Returns true if the element type is a real number.
static constexpr bool | is_signed ()
| Returns true if the element type is signed.
static constexpr unsigned | size ()
| Returns the number of elements in the vector.

#### Member Typedef Documentation

## ◆ native_type

template<ElemBaseType T, unsigned Elems>

using aie::vector< T, Elems >::native_type = typename base_type::native_type

Equivalent intrinsic type for the same element type and size.

## ◆ storage_t

template<ElemBaseType T, unsigned Elems>

using aie::vector< T, Elems >::storage_t = typename base_type::storage_t

Type that holds the actual vector's data.

May be different to its native type.

## ◆ value_type

template<ElemBaseType T, unsigned Elems>

using aie::vector< T, Elems >::value_type = typename base_type::value_type

Type of the elements in the vector.

#### Constructor & Destructor Documentation

## ◆ vector() [1/4]

template<ElemBaseType T, unsigned Elems>

aie::vector< T, Elems >::vector | ( |  | ) |
| inline

Default constructor.

The value of the elements is undefined.

## ◆ vector() [2/4]

template<ElemBaseType T, unsigned Elems>

aie::vector< T, Elems >::vector | ( | storage_t | v | ) |
| inline

Construct a vector from internal native types.

Parameters

  v | Data used to construct the vector from.

## ◆ vector() [3/4]

template<ElemBaseType T, unsigned Elems>

aie::vector< T, Elems >::vector | ( | const native_type & | v | ) |
| inline

Construct from internal types.

This is a special case for 1024b internal vector types, which need to be broken into two 512b vectors

Parameters

  v | Data used to construct the vector from

## ◆ vector() [4/4]

template<ElemBaseType T, unsigned Elems>
template<typename... Values>

aie::vector< T, Elems >::vector | ( | value_type | v,
|  | Values &&... | values )
| inline explicit

Construct from a list of values.

Parameters

  v | First value in the list
  values | Rest of values in the list

#### Member Function Documentation

## ◆ bits()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::vector< T, Elems >::bits | ( |  | ) |
| inline static constexpr

Returns the total size of the vector in bits.

## ◆ bytes()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::vector< T, Elems >::bytes | ( |  | ) |
| inline static constexpr

Returns the total capacity of the vector in bytes.

## ◆ cast_to()

template<ElemBaseType T, unsigned Elems>
template<typename DstT>

auto aie::vector< T, Elems >::cast_to | ( |  | ) | const
| inline

Reinterprets the current vector as a vector of the given type.

The number of elements is automatically computed by the function

Template Parameters

  DstT | Type the vector will be cast to

## ◆ elem_const_ref()

template<ElemBaseType T, unsigned Elems>

vector_elem_const_ref< value_type, Elems > aie::vector< T, Elems >::elem_const_ref | ( | unsigned | idx | ) | const
| inline constexpr

Returns a constant reference object to the element on the given index.

Parameters

  idx | Index of the element.

## ◆ elem_ref() [1/2]

template<ElemBaseType T, unsigned Elems>

vector_elem_ref< value_type, Elems > aie::vector< T, Elems >::elem_ref | ( | unsigned | idx | ) |
| inline constexpr

Returns a reference object to the element on the given index.

Parameters

  idx | Index of the element.

## ◆ elem_ref() [2/2]

template<ElemBaseType T, unsigned Elems>

vector_elem_const_ref< value_type, Elems > aie::vector< T, Elems >::elem_ref | ( | unsigned | idx | ) | const
| inline constexpr

Returns a constant reference object to the element on the given index.

Parameters

  idx | Index of the element.

## ◆ extract()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>

vector< value_type, ElemsOut > aie::vector< T, Elems >::extract | ( | unsigned | idx | ) | const
| inline

Returns a subvector with the contents of a region of the vector.

Template Parameters

  ElemsOut | Size of the returned subvector.

Parameters

  idx | Index of the subvector to be returned.

## ◆ get()

template<ElemBaseType T, unsigned Elems>

value_type aie::vector< T, Elems >::get | ( | unsigned | idx | ) | const
| inline

Returns the value of the element on the given index.

Parameters

  idx | Index of the element.

## ◆ grow()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>

vector< T, ElemsOut > aie::vector< T, Elems >::grow | ( | unsigned | idx = 0 | ) | const
| inline constexpr

Returns a copy of the current vector in a larger vector.

The value of the new elements is undefined.

Template Parameters

  ElemsOut | Size of the output vector.

Parameters

  idx | Location of the subvector within the output vector

## ◆ grow_extract()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>

vector< value_type, ElemsOut > aie::vector< T, Elems >::grow_extract | ( | unsigned | idx | ) | const
| inline

Returns a copy of the current vector in a new size.

- Performs an extract(idx) operation when the new size is smaller.
- Performs a grow(idx) operation when the new size is bigger.

See also
  grow<ElemsOut>(unsigned) const
  extract<ElemsOut>(unsigned) const

## ◆ grow_replicate()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>

vector< T, ElemsOut > aie::vector< T, Elems >::grow_replicate | ( |  | ) | const
| inline constexpr

Returns a copy of the current vector in a larger vector.

The contents of the vector are replicated as many times as required to fill the output vector

Template Parameters

  ElemsOut | Size of the output vector.

## ◆ insert() [1/3]

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsIn>

vector & aie::vector< T, Elems >::insert | ( | unsigned | idx,
|  | const vector< T, ElemsIn > & | v )
| inline

Updates the contents of a region of the vector.

The updated region will contain the values in the given subvector.

Parameters

  idx | Index of the subvector to be replaced.
  v | Subvector to be written into the region.

Returns
  a reference to the updated vector.

## ◆ insert() [2/3]

template<ElemBaseType T, unsigned Elems>
template<NativeVectorType T2>

vector & aie::vector< T, Elems >::insert | ( | unsigned | idx,
|  | T2 | v )
| inline

Updates the contents of a region of the vector using.

The updated region will contain the values in the given native subvector.

Parameters

  idx | Index of the subvector to be replaced.
  v | Native subvector to be written into the region.

Returns
  a reference to the updated vector.

## ◆ insert() [3/3]

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsIn>

vector & aie::vector< T, Elems >::insert | ( | unsigned | idx,
|  | typename vector< T, ElemsIn >::native_type | v )
| inline

Updates the contents of a region of the vector using.

The updated region will contain the values in the given native subvector.

Parameters

  idx | Index of the subvector to be replaced.
  v | Native subvector to be written into the region.

Returns
  a reference to the updated vector.

## ◆ is_complex()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::vector< T, Elems >::is_complex | ( |  | ) |
| inline static constexpr

Returns true if the element type is a complex number.

## ◆ is_floating_point()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::vector< T, Elems >::is_floating_point | ( |  | ) |
| inline static constexpr

Returns true if the element type is floating-point.

## ◆ is_integral()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::vector< T, Elems >::is_integral | ( |  | ) |
| inline static constexpr

Returns true if the element type is an integer.

## ◆ is_real()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::vector< T, Elems >::is_real | ( |  | ) |
| inline static constexpr

Returns true if the element type is a real number.

## ◆ is_signed()

template<ElemBaseType T, unsigned Elems>

constexpr bool aie::vector< T, Elems >::is_signed | ( |  | ) |
| inline static constexpr

Returns true if the element type is signed.

## ◆ load()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2>
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)

void aie::vector< T, Elems >::load | ( | const T2 * | ptr | ) |
| inline

Replaces the contents of the vector with the values pointed by the given memory address.

Address is assumed to meet the alignment requirements for vector loads (>= 32 bytes).

Parameters

  ptr | Pointer to the location of the values in memory.

## ◆ load_unaligned()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2>
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)

void aie::vector< T, Elems >::load_unaligned | ( | const T2 * | ptr,
|  | unsigned | aligned_elems )
| inline

Replaces the contents of the vector with the values pointed by the given memory address.

Address is assumed to be aligned to the given amount of elements.

Parameters

  ptr | Pointer to the location of the values in memory.
  aligned_elems | Number of elements ptr is aligned to.

## ◆ operator native_type()

template<ElemBaseType T, unsigned Elems>

aie::vector< T, Elems >::operator native_type | ( |  | ) | const
| inline

Operator for conversion to the native type.

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

template<ElemBaseType T, unsigned Elems>

vector_elem_ref< value_type, Elems > aie::vector< T, Elems >::operator[] | ( | unsigned | idx | ) |
| inline constexpr

Returns a reference object to the element on the given index.

Note
  This returns a proxy object that is implicitly convertible to the underlying element type.

See also
  vector::get to retrieve the element value immediately.

Parameters

  idx | Index of the element.

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

template<ElemBaseType T, unsigned Elems>

vector_elem_const_ref< value_type, Elems > aie::vector< T, Elems >::operator[] | ( | unsigned | idx | ) | const
| inline constexpr

Returns a constant reference object to the element on the given index.

Note
  This returns a proxy object that is implicitly convertible to the underlying element type. To eagerly retrieve the element value please use get.

Parameters

  idx | Index of the element.

## ◆ pack()

template<ElemBaseType T, unsigned Elems>
template<PackableFrom< T > T2>

auto aie::vector< T, Elems >::pack | ( |  | ) | const->vector< T2, Elems >
| inline

Returns a copy of the vector with elements represented in a narrower type.

By default, packing a vector will produce a vector with half the number of bits. For example, packing a vector of 16b elements will produce a vector of 8b elements.

Note
  Only vectors with integer elements are allowed.
  Complex vectors can only unpack to other complex types.

Template Parameters

  T2 | target element type. It must be narrower than the vector's element type.

## ◆ pack_sign()

template<ElemBaseType T, unsigned Elems>
template<PackableFrom< T > T2>

auto aie::vector< T, Elems >::pack_sign | ( | bool | v_sign | ) | const->vector< T2, Elems >
| inline

Returns a copy of the vector with elements represented in a narrower type, with dynamic selection of whether vectors are signed or not.

By default, packing a vector will produce a vector with half the number of bits. For example, packing a vector of 16b elements will produce a vector of 8b elements.

Note
  Only vectors with integer elements are allowed.
  Complex vectors can only unpack to other complex types.

Template Parameters

  T2 | target element type. It must be narrower than the vector's element type.

Parameters

  v_sign | Returned vector is signed or not, regardless of the underlying type.

## ◆ push()

template<ElemBaseType T, unsigned Elems>

vector & aie::vector< T, Elems >::push | ( | value_type | v | ) |
| inline

Adds a new element to the vector, moving existing elements one position up.

Shifts all elements in the vector up and writes the given value into the first position of the vector. The element in the last position of the vector is lost).

Parameters

  v | Value to be written into the first position of the vector

## ◆ set()

template<ElemBaseType T, unsigned Elems>

void aie::vector< T, Elems >::set | ( | value_type | v,
|  | unsigned | idx )
| inline

Updates the value of the element on the given index.

Parameters

  v | Value to write.
  idx | Index of the element whose value is updated.

## ◆ size()

template<ElemBaseType T, unsigned Elems>

constexpr unsigned aie::vector< T, Elems >::size | ( |  | ) |
| inline static constexpr

Returns the number of elements in the vector.

## ◆ split()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>

auto aie::vector< T, Elems >::split | ( |  | ) | const->auto
| inline

Returns the contents of the current vector stored in a std::tuple of subvectors.

Template Parameters

  ElemsOut | Size of each subvector.

## ◆ store()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2>
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)

void aie::vector< T, Elems >::store | ( | T2 * | ptr | ) | const
| inline

Writes the contents of the vector into the given memory address.

Address is assumed to meet the alignment requirements for vector stores (>= 32 bytes).

Parameters

  ptr | Pointer to the location where the vector contents must be written in memory.

## ◆ store_unaligned()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2>
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)

void aie::vector< T, Elems >::store_unaligned | ( | T2 * | ptr,
|  | unsigned | aligned_elems ) const
| inline

Writes the contents of the vector into the given memory address.

Address is assumed to be aligned to the given amount of elements.

Parameters

  ptr | Pointer to the location where the vector contents must be written in memory.
  aligned_elems | Number of elements ptr is aligned to.

## ◆ to_native()

template<ElemBaseType T, unsigned Elems>

native_type aie::vector< T, Elems >::to_native | ( |  | ) | const
| inline

Returns the value of the vector using its native type.

## ◆ unpack()

template<ElemBaseType T, unsigned Elems>
template<UnpackableFrom< T > T2>

auto aie::vector< T, Elems >::unpack | ( |  | ) | const->vector< T2, Elems >
| inline

Returns a copy of the vector with elements represented in a wider type.

By default, unpacking a vector will produce a vector with twice the number of bits. For example, unpacking a vector of 8b elements will produce a vector of 16b elements.

Note
  Only vectors with integer elements are allowed.
  Complex vectors can only unpack to other complex types.

Template Parameters

  T2 | target element type. It must be wider than the vector's element type.

## ◆ unpack_sign()

template<ElemBaseType T, unsigned Elems>
template<UnpackableFrom< T > T2>

auto aie::vector< T, Elems >::unpack_sign | ( | bool | v_sign | ) | const->vector< T2, Elems >
| inline

Returns a copy of the vector with elements represented in a wider type, with dynamic selection of whether vectors are signed or not.

By default, unpacking a vector will produce a vector with twice the number of bits. For example, unpacking a vector of 8b elements will produce a vector of 16b elements.

Note
  Only vectors with integer elements are allowed.
  Complex vectors can only unpack to other complex types.

Template Parameters

  T2 | target element type. It must be wider than the vector's element type.

Parameters

  v_sign | Returned vector is signed or not, regardless of the underlying type.

## ◆ upd_all()

template<ElemBaseType T, unsigned Elems>
template<typename... SubVectors>

vector & aie::vector< T, Elems >::upd_all | ( | SubVectors &&... | subvectors | ) |
| inline

Updates the contents of the vector using the values in the given subvectors.

Subvectors must be of the same type and size.

Parameters

  subvectors | List of subvectors.

#### Friends And Related Symbol Documentation

## ◆ vector

template<ElemBaseType T, unsigned Elems>
template<ElemBaseType T2, unsigned E2>

friend class vector
| friend

## ◆ detail::vector_base

template<ElemBaseType T, unsigned Elems>
template<typename T2, unsigned E2>

friend class detail::vector_base
| friend

## ◆ aie::vector_elem_const_ref

class aie::vector_elem_const_ref

template<ElemBaseType T, unsigned N>
class aie::vector_elem_const_ref< T, N >

Reference to immutable vector element.

Template Parameters

  T | Type of the elements contained in the referenced vector. It must meet aie::ElemBaseType.
  Elems | Number of elements in the referenced vector.

See also
  aie::vector_elem_ref

### Public Types
using | parent_type = vector_type
using | value_type = T
using | vector_type = vector<T, N>
### Public Member Functions
constexpr | vector_elem_const_ref (const vector_elem_ref< T, N > &ref)
| Converts a mutable reference into an immutable reference.
value_type | get () const
| Access the element value.
| operator value_type () const
| Cast operator.
template<typename T2>
constexpr bool | operator!= (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator< (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator<= (T v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator== (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator> (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator>= (T2 v) const
| Compares element value with another.
### Public Attributes
unsigned | offset
| The position within a vector where the element is located.
const vector_type & | parent
| The vector where the referenced element is located.

#### Member Typedef Documentation

## ◆ parent_type

template<ElemBaseType T, unsigned N>

using aie::vector_elem_const_ref< T, N >::parent_type = vector_type

## ◆ value_type

template<ElemBaseType T, unsigned N>

using aie::vector_elem_const_ref< T, N >::value_type = T

## ◆ vector_type

template<ElemBaseType T, unsigned N>

using aie::vector_elem_const_ref< T, N >::vector_type = vector<T, N>

#### Constructor & Destructor Documentation

## ◆ vector_elem_const_ref()

template<ElemBaseType T, unsigned N>

aie::vector_elem_const_ref< T, N >::vector_elem_const_ref | ( | const vector_elem_ref< T, N > & | ref | ) |
| inline constexpr

Converts a mutable reference into an immutable reference.

#### Member Function Documentation

## ◆ get()

template<ElemBaseType T, unsigned N>

value_type aie::vector_elem_const_ref< T, N >::get | ( |  | ) | const
| inline

Access the element value.

## ◆ operator value_type()

template<ElemBaseType T, unsigned N>

aie::vector_elem_const_ref< T, N >::operator value_type | ( |  | ) | const
| inline

Cast operator.

Access the element value.

## ◆ operator!=()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_const_ref< T, N >::operator!= | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator<()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_const_ref< T, N >::operator< | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator<=()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_const_ref< T, N >::operator<= | ( | T | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator==()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_const_ref< T, N >::operator== | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator>()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_const_ref< T, N >::operator> | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator>=()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_const_ref< T, N >::operator>= | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

#### Member Data Documentation

## ◆ offset

template<ElemBaseType T, unsigned N>

unsigned aie::vector_elem_const_ref< T, N >::offset

The position within a vector where the element is located.

## ◆ parent

template<ElemBaseType T, unsigned N>

const vector_type& aie::vector_elem_const_ref< T, N >::parent

The vector where the referenced element is located.

## ◆ aie::vector_elem_ref

class aie::vector_elem_ref

template<ElemBaseType T, unsigned N>
class aie::vector_elem_ref< T, N >

Reference to vector element.

This type is returned by element access functions and represents a proxy to the actual element, which allows for optimizations in the API such as accessing the element from its vector without extracting it. This is common in element / vector operations. Otherwise, the element value is extracted when assigned to a variable of type T.

Template Parameters

  T | Type of the elements contained in the referenced vector. It must meet aie::ElemBaseType.
  Elems | Number of elements in the referenced vector.

See also
  aie::vector_elem_const_ref

### Public Types
using | parent_type = vector_type
using | value_type = T
using | vector_type = vector<T, N>
### Public Member Functions
value_type | get () const
| Access the element value.
| operator value_type () const
| Cast operator.
template<typename T2>
constexpr bool | operator!= (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator< (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator<= (T v) const
| Compares element value with another.
vector_elem_ref & | operator= (const value_type &v)
| Assignment operator.
vector_elem_ref & | operator= (const vector_elem_const_ref< T, N > &v)
| Assignment operator.
vector_elem_ref & | operator= (const vector_elem_ref< T, N > &v)
| Assignment operator.
template<typename T2>
constexpr bool | operator== (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator> (T2 v) const
| Compares element value with another.
template<typename T2>
constexpr bool | operator>= (T2 v) const
| Compares element value with another.
### Public Attributes
unsigned | offset
vector_type & | parent

#### Member Typedef Documentation

## ◆ parent_type

template<ElemBaseType T, unsigned N>

using aie::vector_elem_ref< T, N >::parent_type = vector_type

## ◆ value_type

template<ElemBaseType T, unsigned N>

using aie::vector_elem_ref< T, N >::value_type = T

## ◆ vector_type

template<ElemBaseType T, unsigned N>

using aie::vector_elem_ref< T, N >::vector_type = vector<T, N>

#### Member Function Documentation

## ◆ get()

template<ElemBaseType T, unsigned N>

value_type aie::vector_elem_ref< T, N >::get | ( |  | ) | const
| inline

Access the element value.

## ◆ operator value_type()

template<ElemBaseType T, unsigned N>

aie::vector_elem_ref< T, N >::operator value_type | ( |  | ) | const
| inline

Cast operator.

Access the element value.

## ◆ operator!=()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_ref< T, N >::operator!= | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator<()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_ref< T, N >::operator< | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator<=()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_ref< T, N >::operator<= | ( | T | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator=() [1/3]

template<ElemBaseType T, unsigned N>

vector_elem_ref & aie::vector_elem_ref< T, N >::operator= | ( | const value_type & | v | ) |
| inline

Assignment operator.

Overwrites the referenced value.

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

template<ElemBaseType T, unsigned N>

vector_elem_ref & aie::vector_elem_ref< T, N >::operator= | ( | const vector_elem_const_ref< T, N > & | v | ) |
| inline

Assignment operator.

Overwrites the referenced value.

## ◆ operator=() [3/3]

template<ElemBaseType T, unsigned N>

vector_elem_ref & aie::vector_elem_ref< T, N >::operator= | ( | const vector_elem_ref< T, N > & | v | ) |
| inline

Assignment operator.

Overwrites the referenced value.

## ◆ operator==()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_ref< T, N >::operator== | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator>()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_ref< T, N >::operator> | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

## ◆ operator>=()

template<ElemBaseType T, unsigned N>
template<typename T2>

bool aie::vector_elem_ref< T, N >::operator>= | ( | T2 | v | ) | const
| inline constexpr

Compares element value with another.

#### Member Data Documentation

## ◆ offset

template<ElemBaseType T, unsigned N>

unsigned aie::vector_elem_ref< T, N >::offset

## ◆ parent

template<ElemBaseType T, unsigned N>

vector_type& aie::vector_elem_ref< T, N >::parent