Cytnx v0.9.7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
cytnx::Accessor Class Reference

object that mimic the python slice to access elements in C++ [this is for c++ API only]. More...

#include <Accessor.hpp>

Public Member Functions

 Accessor (const cytnx_int64 &loc)
 access the specific index at the assigned rank in Tensor.
 
template<class T >
 Accessor (const std::initializer_list< T > &list)
 
template<class T >
 Accessor (const std::vector< T > &list)
 
int type () const
 

Static Public Member Functions

static Accessor all ()
 access the whole rank, this is similar to [:] in python
 
static Accessor range (const cytnx_int64 &min, const cytnx_int64 &max, const cytnx_int64 &step=1)
 access the range at assigned rank, this is similar to min:max:step in python
 
static Accessor tilend (const cytnx_int64 &min, const cytnx_int64 &step=1)
 
static Accessor step (const cytnx_int64 &step)
 
static Accessor qns (const std::vector< std::vector< cytnx_int64 > > &qns)
 

Detailed Description

object that mimic the python slice to access elements in C++ [this is for c++ API only].

Constructor & Destructor Documentation

◆ Accessor() [1/3]

cytnx::Accessor::Accessor ( const cytnx_int64 loc)
explicit

access the specific index at the assigned rank in Tensor.

Parameters
locthe specify index

See also cytnx::Tensor.get() for how to using them.

Example:

c++ API:

output>

 

python API:

output>

 

◆ Accessor() [2/3]

template<class T >
cytnx::Accessor::Accessor ( const std::initializer_list< T > &  list)
inlineexplicit

◆ Accessor() [3/3]

template<class T >
cytnx::Accessor::Accessor ( const std::vector< T > &  list)
inlineexplicit

Member Function Documentation

◆ all()

static Accessor cytnx::Accessor::all ( )
inlinestatic

access the whole rank, this is similar to [:] in python

Example:

c++ API:

output>

 

python API:

output>

 

◆ qns()

static Accessor cytnx::Accessor::qns ( const std::vector< std::vector< cytnx_int64 > > &  qns)
inlinestatic

◆ range()

static Accessor cytnx::Accessor::range ( const cytnx_int64 min,
const cytnx_int64 max,
const cytnx_int64 step = 1 
)
inlinestatic

access the range at assigned rank, this is similar to min:max:step in python

Parameters
min
max
step

Example:

c++ API:

output>

 

python API:

output>

 

◆ step()

static Accessor cytnx::Accessor::step ( const cytnx_int64 step)
inlinestatic

◆ tilend()

static Accessor cytnx::Accessor::tilend ( const cytnx_int64 min,
const cytnx_int64 step = 1 
)
inlinestatic

◆ type()

int cytnx::Accessor::type ( ) const
inline

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