coniii.enumerate module¶
-
coniii.enumerate.
fast_logsumexp
(X, coeffs=None)¶ Simplified version of logsumexp to do correlation calculation in Ising equation files. Scipy’s logsumexp can be around 10x slower in comparison.
- X : ndarray
- Terms inside logs.
- coeffs : ndarray
- Factors in front of exponentials.
- float
- Value of magnitude of quantity inside log (the sum of exponentials).
- float
- Sign.
-
coniii.enumerate.
get_3idx
(n)¶ Get binary 3D matrix with truth values where index values correspond to the index of all possible ijk parameters. We can do this by recognizing that the pattern along each plane in the third dimension is like the upper triangle pattern that just moves up and over by one block each cut lower into the box.
-
coniii.enumerate.
get_nidx
(k, n)¶ Get the kth order indices corresponding to all the states in which k elements are firing up out of n spins. The ordering correspond to that returned by bin_states().
print where(exact.get_3idx(4)) print where(exact.get_nidx(3,4)) <<<<<
-
coniii.enumerate.
get_terms
(subix, prefix, binstate, br, ix0)¶ Spins are put in explicitly
-
coniii.enumerate.
get_terms01
(subix, prefix, binstate, br, ix0)¶ Specific to {0,1}.
-
coniii.enumerate.
get_terms11
(subix, prefix, binstate, br, ix0)¶ Specific to {-1,1}.
-
coniii.enumerate.
mp_fast_logsumexp
(X, coeffs=None)¶ fast_logsumexp for high precision numbers using mpmath.
- X : ndarray
- Terms inside logs.
- coeffs : ndarray
- Factors in front of exponentials.
- float
- Value of magnitude of quantity inside log (the sum of exponentials).
- float
- Sign.
-
coniii.enumerate.
pairwise
(n, sym=0, **kwargs)¶ Wrapper for writing pairwise maxent model (Ising) files.
- n : int
- System size.
- sym : int, 0
- Can be 0 or 1.
**kwargs
None
-
coniii.enumerate.
triplet
(n, sym=0, **kwargs)¶ Wrapper for writing triplet-order maxent model.
- n : int
- System size.
- sym : int, 0
- Can be 0 or 1.
**kwargs
None
-
coniii.enumerate.
write_eqns
(n, sym, corrTermsIx, suffix='', high_prec=False)¶ Create strings for writing out the equations and then write them to file.
TODO: This code needs some cleanup.
- n : int
- number of spins
- sym : int
- value of 1 will use {-1,1} formulation, 0 means {0,1}
- corrTermsIx : list of ndarrays
- Allows specification of arbitrary correlations to constrain using an index based structure. These should be index arrays as would be returned by np.where that specify which correlations to write down. Each consecutive array should specify a matrix of sequentially increasing dimension. [Nx1, NxN, NxNxN, …]
suffix : str, ‘’ high_prec : bool, False
-
coniii.enumerate.
write_py
(n, sym, contraintTermsIx, signs, expterms, Z, extra='', suffix='', high_prec=False)¶ Write out Ising equations for Python.
- n : int
- System size.
contraintTermsIx : list of str signs : list of ndarray
Sign for each term in the numerator when computing correlations.- expterms : list of str
- Every single energy term.
- Z : str
- Energies for all states that will be put into partition function.
- extra : str, ‘’
- any extra lines to add at the end
suffix : str, ‘’ high_prec : bool, False
If True, write version that uses mpmath for high precision calculations.