summaryrefslogtreecommitdiff
path: root/lib/wolff.h
blob: 4270f338909ee5a777bfb5b24ddf7985661c7b8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

#pragma once

#include <assert.h>
#include <fftw3.h>
#include <float.h>
#include <getopt.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>

#include <jst/graph.h>
#include <jst/rand.h>

#include "queue.h"

typedef struct {
  graph_t *g;
  bool *spins;
  int32_t M;
  double H;
} ising_state_t;

typedef struct {
  uint32_t nv;
  int32_t dJb;
  int32_t dHb;
} cluster_t;

cluster_t *flip_cluster(const graph_t *g, const double *ps, bool *x,
                        gsl_rng *r);

graph_t *graph_add_ext(const graph_t *g);

uint32_t wolff_step(double T, double H, ising_state_t *s, gsl_rng *r,
                    double *ps);