Computes the autocorrelation from a microstructure function.
Parameters: 


Returns:  Autocorrelations for microstructure function X_. 
Nonperiodic example
>>> n_states = 2
>>> X = np.array([[[0, 0, 0],
... [0, 1, 0],
... [0, 0, 0]]])
>>> from pymks.bases import PrimitiveBasis
>>> prim_basis = PrimitiveBasis(n_states=n_states)
>>> X_ = prim_basis.discretize(X)
>>> X_auto = autocorrelate(X_, periodic_axes=(0, 1))
>>> X_test = np.array([[[0., 0., 0.],
... [0., 1./9, 0.],
... [0., 0., 0.]]])
>>> assert(np.allclose(np.real_if_close(X_auto[0, ..., 1]), X_test[0]))
Computes the crosscorrelations from a microstructure function.
Parameters: 


Returns:  Crosscorelations for microstructure function X_. 
Examples
Test for 2 states.
>>> n_states = 2
>>> X = np.array([[[0, 1, 0],
... [0, 1, 0],
... [0, 1, 0]]])
>>> from pymks.bases import PrimitiveBasis
>>> prim_basis = PrimitiveBasis(n_states=n_states)
>>> X_ = prim_basis.discretize(X)
>>> X_cross = crosscorrelate(X_, periodic_axes=[0, 1])
>>> X_test = np.array([[[[1/3.], [0.], [1/3.]],
... [[1/3.], [0.], [1/3.]],
... [[1/3.], [0.], [1/3.]]]])
>>> assert(np.allclose(X_cross, X_test))
Test for 3 states
>>> n_states = 3
>>> prim_basis = PrimitiveBasis(n_states=n_states)
>>> X_ = prim_basis.discretize(X)
>>> assert(crosscorrelate(X_, periodic_axes=[0, 1]).shape == (1, 3, 3, 3))
Test for 4 states
>>> n_states = 4
>>> prim_basis = PrimitiveBasis(n_states=n_states)
>>> X_ = prim_basis.discretize(X)
>>> assert(crosscorrelate(X_, periodic_axes=[0, 1]).shape == (1, 3, 3, 6))
Test for 5 states
>>> n_states = 5
>>> prim_basis = PrimitiveBasis(n_states=n_states)
>>> X_ = prim_basis.discretize(X)
>>> assert(crosscorrelate(X_, periodic_axes=[0, 1]).shape == (1, 3, 3, 10))
Computes the autocorrelations and crosscorrelations from a microstructure function.
Parameters: 


Returns:  Autocorrelations and crosscorrelations for microstructure funciton X_. 
Example
>>> from pymks import PrimitiveBasis
>>> prim_basis = PrimitiveBasis(2, [0, 1])
>>>
>>> np.random.seed(0)
>>> X = np.random.randint(2, size=(1, 3))
>>> X_ = prim_basis.discretize(X)
>>> X_corr = correlate(X_)
>>> X_result = np.array([[0, 0.5, 0],
... [1 / 3., 2 / 3., 0],
... [0, 0.5, 0.5]])
>>> assert np.allclose(X_corr, X_result)