openjij
Framework for the Ising model and QUBO.
Loading...
Searching...
No Matches
openjij::graph::Chimera< FloatType > Class Template Reference

chimera lattice graph More...

#include <chimera.hpp>

Inheritance diagram for openjij::graph::Chimera< FloatType >:
Collaboration diagram for openjij::graph::Chimera< FloatType >:

Public Member Functions

Index to_ind (std::int64_t r, std::int64_t c, std::int64_t i) const
 convert from (row x column x in-chimera) index to global index
ChimeraIndex to_rci (Index ind) const
 convert from global index to (row x column x in-chimera) index
 Chimera (std::size_t num_row, std::size_t num_column, FloatType init_val=0)
 chimera lattice graph constructor
 Chimera (const json &j, std::size_t num_row, std::size_t num_column, FloatType init_val=0)
 Square constructor (from nlohmann::json).
 Chimera (const Chimera< FloatType > &)=default
 chimera lattice graph copy constructor
 Chimera (Chimera< FloatType > &&)=default
 chimera lattice graph move constructor
std::size_t get_num_row () const
 get number of rows
std::size_t get_num_column () const
 get number of columns
std::size_t get_num_in_chimera () const
 get number of spins in each chimera unit
FloatType & J (std::size_t r, std::size_t c, std::size_t i, ChimeraDir dir)
 access J(row, colum, in-chimera, direction)
const FloatType & J (std::size_t r, std::size_t c, std::size_t i, ChimeraDir dir) const
 access J(row, colum, in-chimera, direction)
FloatType & h (std::size_t r, std::size_t c, std::size_t i)
 access h(row, colum, in-chimera) (local field)
const FloatType & h (std::size_t r, std::size_t c, std::size_t i) const
 access h(row, colum, in-chimera) (local field)
Spin & spin (Spins &spins, std::size_t r, std::size_t c, std::size_t i) const
 derive spin value at the index (row x column)
const Spin & spin (const Spins &spins, std::size_t r, std::size_t c, std::size_t i) const
 derive spin value at the index (row x column)
Public Member Functions inherited from openjij::graph::Sparse< double >
 Sparse (std::size_t num_spins, std::size_t num_edges)
 Sparse constructor.
const Nodes & adj_nodes (Index ind) const
 list of adjacent nodes
std::size_t get_num_edges () const
 get number of edges
double calc_energy (const Spins &spins) const
 calculate total energy
double energy (const Spins &spins) const
 calculate total energy
double & J (Index i, Index j)
 access J_{ij}
double & h (Index i)
 access h_{i} (local field)
Public Member Functions inherited from openjij::graph::Graph
 Graph (std::size_t num_spins)
 Graph constructor.
template<typename RandomNumberEngine>
const Spins gen_spin (RandomNumberEngine &random_numder_engine) const
 generate spins randomly.
template<typename RandomNumberEngine>
const Binaries gen_binary (RandomNumberEngine &random_numder_engine) const
 generate spins randomly.
std::size_t get_num_spins () const noexcept
 get number of spins
std::size_t size () const noexcept
 get number of spins

Private Member Functions

std::size_t mod_r (std::int64_t a) const
 mod function (a mod num_row)
std::size_t mod_c (std::int64_t a) const
 mod function (a mod num_column)
void _checkpair (Index idx1, Index idx2) const
 check if the pair has a valid connection

Private Attributes

FloatType _init_val
 initial value to be set to inreactions
std::size_t _num_row
 number of rows
std::size_t _num_column
 number of columns

Static Private Attributes

static constexpr std::size_t _num_in_chimera = 8
 number of spins in each chimera units (8)

Additional Inherited Members

Public Types inherited from openjij::graph::Sparse< double >
using Interactions
 interaction type
using value_type
 float type

Detailed Description

template<typename FloatType = double>
class openjij::graph::Chimera< FloatType >

chimera lattice graph

Template Parameters
FloatTypefloating-point type (default: double)

Constructor & Destructor Documentation

◆ Chimera() [1/4]

template<typename FloatType = double>
openjij::graph::Chimera< FloatType >::Chimera ( std::size_t num_row,
std::size_t num_column,
FloatType init_val = 0 )
inline

chimera lattice graph constructor

Parameters
num_rownumber of rows
num_columnnumber of columns
init_valinitial value set to interaction (default: 0)

References _init_val, _num_column, _num_in_chimera, _num_row, openjij::graph::Sparse< FloatType >::J(), openjij::graph::Sparse< double >::Sparse(), and to_ind().

Referenced by Chimera(), Chimera(), and Chimera().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Chimera() [2/4]

template<typename FloatType = double>
openjij::graph::Chimera< FloatType >::Chimera ( const json & j,
std::size_t num_row,
std::size_t num_column,
FloatType init_val = 0 )
inline

Square constructor (from nlohmann::json).

Parameters
jJSON object
num_rownumber of rows
num_columnnumber of columns
init_valinitial value set to interaction (default: 0)

References _checkpair(), _num_in_chimera, Chimera(), openjij::graph::Sparse< FloatType >::h(), openjij::graph::Sparse< FloatType >::J(), and openjij::graph::json_parse().

Here is the call graph for this function:

◆ Chimera() [3/4]

template<typename FloatType = double>
openjij::graph::Chimera< FloatType >::Chimera ( const Chimera< FloatType > & )
default

chimera lattice graph copy constructor

References Chimera().

Here is the call graph for this function:

◆ Chimera() [4/4]

template<typename FloatType = double>
openjij::graph::Chimera< FloatType >::Chimera ( Chimera< FloatType > && )
default

chimera lattice graph move constructor

References Chimera().

Here is the call graph for this function:

Member Function Documentation

◆ _checkpair()

template<typename FloatType = double>
void openjij::graph::Chimera< FloatType >::_checkpair ( Index idx1,
Index idx2 ) const
inlineprivate

check if the pair has a valid connection

Parameters
idx1index1
idx2index2

References to_rci().

Referenced by Chimera().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_num_column()

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::get_num_column ( ) const
inline

get number of columns

Returns
number of columns

References _num_column.

Referenced by openjij::declare_Chimera().

Here is the caller graph for this function:

◆ get_num_in_chimera()

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::get_num_in_chimera ( ) const
inline

get number of spins in each chimera unit

Returns
number of spins in each chimera unit

References _num_in_chimera.

Referenced by openjij::declare_Chimera().

Here is the caller graph for this function:

◆ get_num_row()

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::get_num_row ( ) const
inline

get number of rows

Returns
number of rows

References _num_row.

Referenced by openjij::declare_Chimera().

Here is the caller graph for this function:

◆ h() [1/2]

template<typename FloatType = double>
FloatType & openjij::graph::Chimera< FloatType >::h ( std::size_t r,
std::size_t c,
std::size_t i )
inline

access h(row, colum, in-chimera) (local field)

Parameters
rrow index
ccolumn index
iin-chimera index
Returns
corresponding interaction value

References _num_column, _num_in_chimera, _num_row, openjij::graph::Sparse< FloatType >::h(), and to_ind().

Referenced by openjij::declare_Chimera().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ h() [2/2]

template<typename FloatType = double>
const FloatType & openjij::graph::Chimera< FloatType >::h ( std::size_t r,
std::size_t c,
std::size_t i ) const
inline

access h(row, colum, in-chimera) (local field)

Parameters
rrow index
ccolumn index
iin-chimera index
Returns
corresponding interaction value

References _num_column, _num_in_chimera, _num_row, openjij::graph::Sparse< FloatType >::h(), and to_ind().

Here is the call graph for this function:

◆ J() [1/2]

template<typename FloatType = double>
FloatType & openjij::graph::Chimera< FloatType >::J ( std::size_t r,
std::size_t c,
std::size_t i,
ChimeraDir dir )
inline

access J(row, colum, in-chimera, direction)

Parameters
rrow index
ccolumn index
iin-chimera index
dirchimera direction
Returns
corresponding interaction value

References _init_val, _num_column, _num_in_chimera, _num_row, openjij::graph::IN_0or4, openjij::graph::IN_1or5, openjij::graph::IN_2or6, openjij::graph::IN_3or7, openjij::graph::Sparse< FloatType >::J(), openjij::graph::MINUS_C, openjij::graph::MINUS_R, openjij::graph::PLUS_C, openjij::graph::PLUS_R, and to_ind().

Referenced by openjij::declare_Chimera().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ J() [2/2]

template<typename FloatType = double>
const FloatType & openjij::graph::Chimera< FloatType >::J ( std::size_t r,
std::size_t c,
std::size_t i,
ChimeraDir dir ) const
inline

access J(row, colum, in-chimera, direction)

Parameters
rrow index
ccolumn index
iin-chimera index
dirchimera direction
Returns
corresponding interaction value

References _init_val, _num_column, _num_in_chimera, _num_row, openjij::graph::IN_0or4, openjij::graph::IN_1or5, openjij::graph::IN_2or6, openjij::graph::IN_3or7, openjij::graph::Sparse< FloatType >::J(), openjij::graph::MINUS_C, openjij::graph::MINUS_R, openjij::graph::PLUS_C, openjij::graph::PLUS_R, and to_ind().

Here is the call graph for this function:

◆ mod_c()

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::mod_c ( std::int64_t a) const
inlineprivate

mod function (a mod num_column)

Parameters
aparameter ([-1:num_column])
Returns
(a mod num_column)

References _num_column.

Referenced by to_ind().

Here is the caller graph for this function:

◆ mod_r()

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::mod_r ( std::int64_t a) const
inlineprivate

mod function (a mod num_row)

Parameters
aparameter ([-1:num_row])
Returns
(a mod num_row)

References _num_row.

Referenced by to_ind().

Here is the caller graph for this function:

◆ spin() [1/2]

template<typename FloatType = double>
const Spin & openjij::graph::Chimera< FloatType >::spin ( const Spins & spins,
std::size_t r,
std::size_t c,
std::size_t i ) const
inline

derive spin value at the index (row x column)

Parameters
spinsspin array
rrow index
ccolumn index
iin-chimera index
Returns
corresponding spin

References to_ind().

Here is the call graph for this function:

◆ spin() [2/2]

template<typename FloatType = double>
Spin & openjij::graph::Chimera< FloatType >::spin ( Spins & spins,
std::size_t r,
std::size_t c,
std::size_t i ) const
inline

derive spin value at the index (row x column)

Parameters
spinsspin array
rrow index
ccolumn index
iin-chimera index
Returns
corresponding spin

References to_ind().

Here is the call graph for this function:

◆ to_ind()

template<typename FloatType = double>
Index openjij::graph::Chimera< FloatType >::to_ind ( std::int64_t r,
std::int64_t c,
std::int64_t i ) const
inline

convert from (row x column x in-chimera) index to global index

Parameters
rrow index
ccolumn index
iin-chimera index
Returns
corresponding global index

References _num_column, _num_in_chimera, _num_row, mod_c(), and mod_r().

Referenced by Chimera(), openjij::declare_Chimera(), h(), h(), J(), J(), spin(), and spin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_rci()

template<typename FloatType = double>
ChimeraIndex openjij::graph::Chimera< FloatType >::to_rci ( Index ind) const
inline

convert from global index to (row x column x in-chimera) index

Parameters
ind
Returns

References _num_column, _num_in_chimera, and openjij::graph::Graph::get_num_spins().

Referenced by _checkpair(), and openjij::declare_Chimera().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _init_val

template<typename FloatType = double>
FloatType openjij::graph::Chimera< FloatType >::_init_val
private

initial value to be set to inreactions

Referenced by Chimera(), J(), and J().

◆ _num_column

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::_num_column
private

number of columns

Referenced by Chimera(), get_num_column(), h(), h(), J(), J(), mod_c(), to_ind(), and to_rci().

◆ _num_in_chimera

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::_num_in_chimera = 8
staticconstexprprivate

number of spins in each chimera units (8)

Referenced by Chimera(), Chimera(), get_num_in_chimera(), h(), h(), J(), J(), to_ind(), and to_rci().

◆ _num_row

template<typename FloatType = double>
std::size_t openjij::graph::Chimera< FloatType >::_num_row
private

number of rows

Referenced by Chimera(), get_num_row(), h(), h(), J(), J(), mod_r(), and to_ind().


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