openjij
Framework for the Ising model and QUBO.
|
chimera lattice graph More...
#include <chimera.hpp>
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) | |
![]() | |
Sparse (std::size_t num_spins, std::size_t num_edges) | |
Sparse constructor. | |
Sparse (std::size_t num_spins) | |
Sparse delegate constructor. | |
Sparse (const json &j, std::size_t num_edges) | |
Sparse constructor (from nlohmann::json) | |
Sparse (const json &j) | |
Sparse constructor (from nlohmann::json) | |
Sparse (const Sparse< FloatType > &)=default | |
Sparse copy constructor. | |
Sparse (Sparse< FloatType > &&)=default | |
Sparse move constructor. | |
const Nodes & | adj_nodes (Index ind) const |
list of adjacent nodes | |
std::size_t | get_num_edges () const |
get number of edges | |
FloatType | calc_energy (const Spins &spins) const |
calculate total energy | |
FloatType | calc_energy (const Eigen::Matrix< FloatType, Eigen::Dynamic, 1, Eigen::ColMajor > &spins) const |
FloatType | energy (const Spins &spins) const |
calculate total energy | |
FloatType | energy (const Eigen::Matrix< FloatType, Eigen::Dynamic, 1, Eigen::ColMajor > &spins) const |
FloatType & | J (Index i, Index j) |
access J_{ij} | |
const FloatType & | J (Index i, Index j) const |
access J_{ij} | |
FloatType & | h (Index i) |
access h_{i} (local field) | |
const FloatType & | h (Index i) const |
access h_{i} (local field) | |
![]() | |
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 | |
![]() | |
using | Interactions = std::unordered_map< std::pair< Index, Index >, FloatType, utility::PairHash > |
interaction type | |
using | value_type = FloatType |
float type | |
chimera lattice graph
FloatType | floating-point type (default: double) |
|
inline |
chimera lattice graph constructor
num_row | number of rows |
num_column | number of columns |
init_val | initial value set to interaction (default: 0) |
References openjij::graph::Chimera< FloatType >::_init_val, openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Chimera< FloatType >::_num_row, openjij::graph::Sparse< FloatType >::J(), and openjij::graph::Chimera< FloatType >::to_ind().
|
inline |
Square constructor (from nlohmann::json)
j | JSON object |
num_row | number of rows |
num_column | number of columns |
init_val | initial value set to interaction (default: 0) |
References openjij::graph::Chimera< FloatType >::_checkpair(), openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Sparse< FloatType >::h(), openjij::graph::Sparse< FloatType >::J(), and openjij::graph::json_parse().
|
default |
chimera lattice graph copy constructor
|
default |
chimera lattice graph move constructor
|
inlineprivate |
check if the pair has a valid connection
idx1 | index1 |
idx2 | index2 |
References openjij::graph::Chimera< FloatType >::to_rci().
Referenced by openjij::graph::Chimera< FloatType >::Chimera().
|
inline |
get number of columns
References openjij::graph::Chimera< FloatType >::_num_column.
|
inline |
get number of spins in each chimera unit
References openjij::graph::Chimera< FloatType >::_num_in_chimera.
|
inline |
|
inline |
access h(row, colum, in-chimera) (local field)
r | row index |
c | column index |
i | in-chimera index |
References openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Chimera< FloatType >::_num_row, openjij::graph::Sparse< FloatType >::h(), openjij::graph::json_parse(), and openjij::graph::Chimera< FloatType >::to_ind().
Referenced by openjij::declare_Chimera().
|
inline |
access h(row, colum, in-chimera) (local field)
r | row index |
c | column index |
i | in-chimera index |
References openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Chimera< FloatType >::_num_row, openjij::graph::Sparse< FloatType >::h(), openjij::graph::json_parse(), and openjij::graph::Chimera< FloatType >::to_ind().
|
inline |
access J(row, colum, in-chimera, direction)
r | row index |
c | column index |
i | in-chimera index |
dir | chimera direction |
References openjij::graph::Chimera< FloatType >::_init_val, openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Chimera< FloatType >::_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::json_parse(), openjij::graph::MINUS_C, openjij::graph::MINUS_R, openjij::graph::PLUS_C, openjij::graph::PLUS_R, and openjij::graph::Chimera< FloatType >::to_ind().
Referenced by openjij::declare_Chimera().
|
inline |
access J(row, colum, in-chimera, direction)
r | row index |
c | column index |
i | in-chimera index |
dir | chimera direction |
References openjij::graph::Chimera< FloatType >::_init_val, openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Chimera< FloatType >::_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::json_parse(), openjij::graph::MINUS_C, openjij::graph::MINUS_R, openjij::graph::PLUS_C, openjij::graph::PLUS_R, and openjij::graph::Chimera< FloatType >::to_ind().
|
inlineprivate |
mod function (a mod num_column)
a | parameter ([-1:num_column]) |
References openjij::graph::Chimera< FloatType >::_num_column.
Referenced by openjij::graph::Chimera< FloatType >::to_ind().
|
inlineprivate |
mod function (a mod num_row)
a | parameter ([-1:num_row]) |
References openjij::graph::Chimera< FloatType >::_num_row.
Referenced by openjij::graph::Chimera< FloatType >::to_ind().
|
inline |
derive spin value at the index (row x column)
spins | spin array |
r | row index |
c | column index |
i | in-chimera index |
References openjij::graph::json_parse(), and openjij::graph::Chimera< FloatType >::to_ind().
|
inline |
derive spin value at the index (row x column)
spins | spin array |
r | row index |
c | column index |
i | in-chimera index |
References openjij::graph::json_parse(), and openjij::graph::Chimera< FloatType >::to_ind().
|
inline |
convert from (row x column x in-chimera) index to global index
r | row index |
c | column index |
i | in-chimera index |
References openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, openjij::graph::Chimera< FloatType >::_num_row, openjij::graph::Chimera< FloatType >::mod_c(), and openjij::graph::Chimera< FloatType >::mod_r().
Referenced by openjij::graph::Chimera< FloatType >::Chimera(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::spin(), and openjij::graph::Chimera< FloatType >::spin().
|
inline |
convert from global index to (row x column x in-chimera) index
ind |
References openjij::graph::Chimera< FloatType >::_num_column, openjij::graph::Chimera< FloatType >::_num_in_chimera, and openjij::graph::Graph::get_num_spins().
Referenced by openjij::graph::Chimera< FloatType >::_checkpair().
|
private |
initial value to be set to inreactions
Referenced by openjij::graph::Chimera< FloatType >::Chimera(), openjij::graph::Chimera< FloatType >::J(), and openjij::graph::Chimera< FloatType >::J().
|
private |
number of columns
Referenced by openjij::graph::Chimera< FloatType >::Chimera(), openjij::graph::Chimera< FloatType >::get_num_column(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::mod_c(), openjij::graph::Chimera< FloatType >::to_ind(), and openjij::graph::Chimera< FloatType >::to_rci().
|
staticconstexprprivate |
number of spins in each chimera units (8)
Referenced by openjij::graph::Chimera< FloatType >::Chimera(), openjij::graph::Chimera< FloatType >::Chimera(), openjij::graph::Chimera< FloatType >::get_num_in_chimera(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::to_ind(), and openjij::graph::Chimera< FloatType >::to_rci().
|
private |
number of rows
Referenced by openjij::graph::Chimera< FloatType >::Chimera(), openjij::graph::Chimera< FloatType >::get_num_row(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::h(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::J(), openjij::graph::Chimera< FloatType >::mod_r(), and openjij::graph::Chimera< FloatType >::to_ind().