hamiltonian_ising: Hamiltonian of Generalized Ising Model

Description Usage Arguments Details Value Examples

View source: R/ising.R

Description

hamiltonian_ising is used to compute the energy of given configuration in a generalized Ising model.

Usage

1

Arguments

u

a binary (-1, 1-valued) vector or matrix. If u is a matrix, each row is taken as an input vector.

h

a vector giving the external field.

J

a symmetric matrix with zero diagonals giving the interaction. If J is NULL, the model degenerates to the case of independent binary.

Details

The generalized Ising model (also known as quadratic exponential binary distribution) is generalizing the adjacent coupling of Ising model to two-way interactions. The probability mass function of generalized Ising model is

P(u \vert h, J) = \frac{1}{Z(h, J)} e^{- H(u; h, J)},

where H(u; h, J) = - h^T u - \frac{1}{2} u^T J u is the Hamiltonian.

Value

a vector giving the energy of configuration u

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
hamiltonian_ising(
  u = c(+1, +1),
  h = c(0, 0),
  J = matrix(c(0, -1, -1, 0), 2, 2)
)

hamiltonian_ising(
  u = matrix(c(-1, +1, +1, -1), 2, 2, byrow = TRUE),
  h = c(2, 3),
  J = matrix(0, 2, 2)
)

XiaoqiLu/ziclust documentation built on Dec. 18, 2021, 7:22 p.m.