openjij
Framework for the Ising model and QUBO.
|
two-body all-to-all interactions The Hamiltonian is like More...
#include <dense.hpp>
Public Types | |
using | Interactions = Eigen::Matrix< FloatType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > |
interaction type (Eigen) The stored matrix has the following triangular form: | |
using | value_type = FloatType |
float type | |
Public Member Functions | |
Dense (std::size_t num_spins) | |
Dense constructor. | |
Dense (const json &j) | |
Dense constructor (from nlohmann::json) | |
void | set_interaction_matrix (const Interactions &interaction) |
set interaction matrix from Eigen Matrix. | |
Dense (const Dense< FloatType > &)=default | |
Dense copy constructor. | |
Dense (Dense< FloatType > &&)=default | |
Dense move constructor. | |
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) | |
const Interactions | get_interactions () const |
get interactions (Eigen Matrix) | |
![]() | |
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 Attributes | |
Interactions | _J |
interactions | |
two-body all-to-all interactions The Hamiltonian is like
\[ H = \sum_{i<j}J_{ij} \sigma_i \sigma_j + \sum_{i}h_{i} \sigma_i \]
FloatType | float type of Sparse class (double or float) |
using openjij::graph::Dense< FloatType >::Interactions = Eigen::Matrix<FloatType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> |
interaction type (Eigen) The stored matrix has the following triangular form:
\[ \begin{pmatrix} J_{0,0} & J_{0,1} & \cdots & J_{0,N-1} & h_{0}\\ 0 & J_{1,1} & \cdots & J_{1,N-1} & h_{1}\\ \vdots & \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & \cdots & J_{N-1,N-1} & h_{N-1}\\ 0 & 0 & \cdots & 0 & 1 \\ \end{pmatrix} \]
float type
|
inlineexplicit |
Dense constructor.
num_spins | the number of spins |
References openjij::graph::Dense< FloatType >::_J.
Dense constructor (from nlohmann::json)
j | JSON object this object must be a serialized object of dense BQM. |
References openjij::graph::json_parse().
|
default |
Dense copy constructor.
|
default |
Dense move constructor.
|
inline |
References openjij::graph::Dense< FloatType >::energy(), and openjij::graph::json_parse().
|
inline |
calculate total energy
spins |
References openjij::graph::Dense< FloatType >::energy().
Referenced by openjij::declare_Dense().
|
inline |
References openjij::graph::Dense< FloatType >::energy(), openjij::graph::Graph::get_num_spins(), and openjij::graph::json_parse().
|
inline |
calculate total energy
spins |
References openjij::graph::Dense< FloatType >::_J, openjij::graph::Graph::get_num_spins(), and openjij::graph::json_parse().
Referenced by openjij::graph::Dense< FloatType >::calc_energy(), openjij::graph::Dense< FloatType >::calc_energy(), and openjij::graph::Dense< FloatType >::energy().
|
inline |
get interactions (Eigen Matrix)
The returned matrix has the following symmetric form:
\[ \begin{pmatrix} J_{0,0} & J_{0,1} & \cdots & J_{0,N-1} & h_{0}\\ J_{0,1} & J_{1,1} & \cdots & J_{1,N-1} & h_{1}\\ \vdots & \vdots & \vdots & \vdots & \vdots \\ J_{0,N-1} & J_{N-1,1} & \cdots & J_{N-1,N-1} & h_{N-1}\\ h_{0} & h_{1} & \cdots & h_{N-1} & 1 \\ \end{pmatrix} \]
References openjij::graph::json_parse().
access h_{i} (local field)
i | Index i |
References openjij::graph::Graph::get_num_spins(), openjij::graph::Dense< FloatType >::J(), and openjij::graph::json_parse().
Referenced by openjij::declare_Dense(), and openjij::utility::gen_matrix_from_graph().
|
inline |
access h_{i} (local field)
i | Index i |
References openjij::graph::Graph::get_num_spins(), openjij::graph::Dense< FloatType >::J(), and openjij::graph::json_parse().
|
inline |
access J_{ij}
i | Index i |
j | Index j |
References openjij::graph::Dense< FloatType >::_J, openjij::graph::Graph::get_num_spins(), and openjij::graph::json_parse().
Referenced by openjij::declare_Dense(), openjij::utility::gen_matrix_from_graph(), openjij::graph::Dense< FloatType >::h(), and openjij::graph::Dense< FloatType >::h().
access J_{ij}
i | Index i |
j | Index j |
References openjij::graph::Dense< FloatType >::_J, openjij::graph::Graph::get_num_spins(), and openjij::graph::json_parse().
|
inline |
set interaction matrix from Eigen Matrix.
interaction | Eigen matrix |
References openjij::graph::Dense< FloatType >::_J, openjij::graph::Graph::get_num_spins(), and openjij::graph::json_parse().
|
private |