MomentGauge.Models.ExpFamilyBase#

Module Contents#

Classes#

BaseExpFamilyModel

The base class for exponential family model.

CanonicalExpFamilyModel

The base class for exponential family model using canonical form samplers.

GaugedExpFamilyModel

The base class for exponential family model with Gauge transformations.

class MomentGauge.Models.ExpFamilyBase.BaseExpFamilyModel(constant)#

The base class for exponential family model.

Specifically, the distribution has the form

\begin{equation} f(\mathbf{u};\boldsymbol{\beta},\mathbf{g}) = \exp\left( \sum_{i=0}^M \beta_i \phi_i(\mathbf{u},\mathbf{g}) \right) \end{equation}

in which \(\{\phi_i,i=0,\cdots,M\}\) are sufficient statistics, \(\boldsymbol{\beta}\) is the natural parameter of the distribution, \(\phi_0(\mathbf{u},\mathbf{g}) = 1\), and \(\mathbf{g}\) is extra gauge parameters that may or may not be requested by the moments \(\phi_i\).

Parameters:

constant (dict) –

dictionary with the following keys

’m’ : float - the mass of particle considered

’kB’ : float - the Boltzmann constant

m#

the mass of particle considered

Type:

float

kB#

the Boltzmann constant

Type:

float

constant#

dictionary with the keys containing ‘m’ and ‘kB’

Type:

dict

suff_statistics(u, gauge_paras=())#

Compute the value of sufficient statistics at certain \(\mathbf{u}\)

Parameters:
  • u (float array of shape (3)) – The 3D sample vector

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

Returns:

The array \(\{ \phi_0(\mathbf{u}), \cdots, \phi_M(\mathbf{u}) \}\)

Return type:

float array of shape (M+1)

moments_to_natural_paras(betas_ini, moments, gauge_paras=(), base_args=())#

Compute the natural parameters \(\boldsymbol{\beta}\) from the moments of sufficient statistics.

Specific implementation (Children) of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – A set of proposed natural parameter \(\boldsymbol{\beta}\)

  • moments (float array of shape (M+1)) – the target moments that we expect exponential familty with the natural parameter \(\boldsymbol{\beta}\) to have.

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

A tuple containing

beta: float array of shape (M+1) - The natural parameters \(\boldsymbol{\beta}\)

opt_info: tuple - A tuple containing other information of the optimization process

values: float - the optimal value of target_function.

residuals: float - the residual of the optimization.

step: float - the total number of Newton’s step iteration.

bsteps: float - the total number of Backtracking step.

Return type:

Tuple

natural_paras_to_moments(betas, gauge_paras=(), base_args=())#

Compute the moments of sufficient statistics given natural parameters.

Specific implementation of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

The array \(\{ M_0, \cdots, M_M \}\)

Return type:

float array of shape (M+1)

natural_paras_to_custom_moments(betas, statistics, gauge_paras=(), base_args=(), stats_gauge_paras=())#

Compute the moments of custom statistics given natural parameters.

Specific implementation of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • statistics (function) –

    A float-valued or tensor-valued function \(\phi_{i_1,\cdots,i_k}\) ( u , \(*\) gauge_paras ) with

    Parameters:

    u : float array of shape (3) - The 3D sample vector \(\mathbf{u}\)

    \(*\) gauge_paras : - Arbitrary many extra parameters such as \(\mathbf{g}\). The \(*\) refers to the unpacking operator in python.

    Returns:

    float or array of arbitrary shape \((d_1,\cdots,d_k)\) – the value of the statistic \(\phi_{i_1,\cdots,i_k}(\mathbf{u},\mathbf{g})\)

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics as gauge_paras. Defaut is (), an empty tuple.

  • stats_gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters the custom statistics function \(\phi_{i_1,\cdots,i_k}\) required as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

The moment value \(M_{i_1,\cdots,i_k}(\mathbf{g})\)

Return type:

float or array of arbitrary shape \((d_1,\cdots,d_k)\)

natural_paras_to_fluid_properties(betas, gauge_paras=(), base_args=())#

Compute the fluid properties including number density \(n\), density \(\rho\), flow velocities \(\mathbf{v} = \{v_\alpha, \alpha \in \{x,y,z\}\}\), temperature \(T\), pressure \(p\), stress \(\{\sigma_{\alpha \beta}, \alpha, \beta \in \{x,y,z\}\}\) and heat flux \(\{q_{\alpha}, \alpha \in \{x,y,z\}\}\).

\begin{equation} \begin{split} n &= \frac{\rho}{m}= \int f(\mathbf{u}) d^3 \mathbf{u} \\ v_\alpha &= \frac{1}{n}\int u_\alpha f(\mathbf{u}) d^3 \mathbf{u}\\ p &= n k_B T = \frac{1}{3} \int m c_\alpha c_\alpha f(\mathbf{u}) d^3 \mathbf{u} \\ \sigma_{\alpha\beta} &= \int m c_\alpha c_\beta f(\mathbf{u}) d^3 \mathbf{u} - p \delta_{\alpha\beta} \\ \epsilon &= \frac{3}{2} k_B T = \frac{1}{n}\int \frac{m}{2} \mathbf{c}^2 f(\mathbf{u}) d^3 \mathbf{u} \\ q_\alpha &= \int \frac{m}{2} c_\alpha \mathbf{c}^2 f(\mathbf{u}) d^3 \mathbf{u}; \quad \alpha, \beta \in \{x,y,z\} \end{split} \end{equation}

in which \(m\) is the mass of gas molecule.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

Array containing macroscopic quantities \(\{ \rho, n, v_x, v_y, v_z, T, p, \sigma_{xx}, \sigma_{xy}, \sigma_{xz}, \sigma_{yy}, \sigma_{yz}, \sigma_{zz}, q_x, q_y, q_z \}\)

Return type:

float array of shape (16)

class MomentGauge.Models.ExpFamilyBase.CanonicalExpFamilyModel(constant)#

Bases: BaseExpFamilyModel

The base class for exponential family model using canonical form samplers.

During sampling, the natural parameter are first converted to fit canonical forms.

Specifically, the distribution has the form

\begin{equation} \begin{split} f(\mathbf{u};\boldsymbol{\beta},\mathbf{g}) &= \frac{\beta_0}{Z(\boldsymbol{\beta},\mathbf{g})} \exp\left( \sum_{i=1}^M \beta_i \phi_i(\mathbf{u},\mathbf{g}) \right)\\ Z(\boldsymbol{\beta},\mathbf{g}) &= \int \exp\left( \sum_{i=1}^M \beta_i \phi_i(\mathbf{u},\mathbf{g}) \right) d\mathbf{u} \end{split} \end{equation}

in which \(\{\phi_i,i=0,\cdots,M\}\) are sufficient statistics, \(\boldsymbol{\beta}\) is the natural parameter of the distribution, \(\phi_0(\mathbf{u},\mathbf{g}) = 1\), and \(\mathbf{g}\) is extra gauge parameters that may or may not be requested by the moments \(\phi_i\).

Parameters:

constant (dict) –

dictionary with the following keys

’m’ : float - the mass of particle considered

’kB’ : float - the Boltzmann constant

m#

the mass of particle considered

Type:

float

kB#

the Boltzmann constant

Type:

float

constant#

dictionary with the keys containing ‘m’ and ‘kB’

Type:

dict

moments_to_natural_paras(betas_ini, moments, gauge_paras=(), base_args=())#

Compute the natural parameters \(\boldsymbol{\beta}\) from the moments of sufficient statistics.

Specific implementation (Children) of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – A set of proposed natural parameter \(\boldsymbol{\beta}\)

  • moments (float array of shape (M+1)) – the target moments that we expect exponential familty with the natural parameter \(\boldsymbol{\beta}\) to have.

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

A tuple containing

beta: float array of shape (M+1) - The natural parameters \(\boldsymbol{\beta}\)

opt_info: tuple - A tuple containing other information of the optimization process

values: float - the optimal value of target_function.

residuals: float - the residual of the optimization.

step: float - the total number of Newton’s step iteration.

bsteps: float - the total number of Backtracking step.

Return type:

Tuple

suff_statistics(u, gauge_paras=())#

Compute the value of sufficient statistics at certain \(\mathbf{u}\)

Parameters:
  • u (float array of shape (3)) – The 3D sample vector

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

Returns:

The array \(\{ \phi_0(\mathbf{u}), \cdots, \phi_M(\mathbf{u}) \}\)

Return type:

float array of shape (M+1)

natural_paras_to_moments(betas, gauge_paras=(), base_args=())#

Compute the moments of sufficient statistics given natural parameters.

Specific implementation of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

The array \(\{ M_0, \cdots, M_M \}\)

Return type:

float array of shape (M+1)

natural_paras_to_custom_moments(betas, statistics, gauge_paras=(), base_args=(), stats_gauge_paras=())#

Compute the moments of custom statistics given natural parameters.

Specific implementation of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • statistics (function) –

    A float-valued or tensor-valued function \(\phi_{i_1,\cdots,i_k}\) ( u , \(*\) gauge_paras ) with

    Parameters:

    u : float array of shape (3) - The 3D sample vector \(\mathbf{u}\)

    \(*\) gauge_paras : - Arbitrary many extra parameters such as \(\mathbf{g}\). The \(*\) refers to the unpacking operator in python.

    Returns:

    float or array of arbitrary shape \((d_1,\cdots,d_k)\) – the value of the statistic \(\phi_{i_1,\cdots,i_k}(\mathbf{u},\mathbf{g})\)

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics as gauge_paras. Defaut is (), an empty tuple.

  • stats_gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters the custom statistics function \(\phi_{i_1,\cdots,i_k}\) required as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

The moment value \(M_{i_1,\cdots,i_k}(\mathbf{g})\)

Return type:

float or array of arbitrary shape \((d_1,\cdots,d_k)\)

natural_paras_to_fluid_properties(betas, gauge_paras=(), base_args=())#

Compute the fluid properties including number density \(n\), density \(\rho\), flow velocities \(\mathbf{v} = \{v_\alpha, \alpha \in \{x,y,z\}\}\), temperature \(T\), pressure \(p\), stress \(\{\sigma_{\alpha \beta}, \alpha, \beta \in \{x,y,z\}\}\) and heat flux \(\{q_{\alpha}, \alpha \in \{x,y,z\}\}\).

\begin{equation} \begin{split} n &= \frac{\rho}{m}= \int f(\mathbf{u}) d^3 \mathbf{u} \\ v_\alpha &= \frac{1}{n}\int u_\alpha f(\mathbf{u}) d^3 \mathbf{u}\\ p &= n k_B T = \frac{1}{3} \int m c_\alpha c_\alpha f(\mathbf{u}) d^3 \mathbf{u} \\ \sigma_{\alpha\beta} &= \int m c_\alpha c_\beta f(\mathbf{u}) d^3 \mathbf{u} - p \delta_{\alpha\beta} \\ \epsilon &= \frac{3}{2} k_B T = \frac{1}{n}\int \frac{m}{2} \mathbf{c}^2 f(\mathbf{u}) d^3 \mathbf{u} \\ q_\alpha &= \int \frac{m}{2} c_\alpha \mathbf{c}^2 f(\mathbf{u}) d^3 \mathbf{u}; \quad \alpha, \beta \in \{x,y,z\} \end{split} \end{equation}

in which \(m\) is the mass of gas molecule.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

Array containing macroscopic quantities \(\{ \rho, n, v_x, v_y, v_z, T, p, \sigma_{xx}, \sigma_{xy}, \sigma_{xz}, \sigma_{yy}, \sigma_{yz}, \sigma_{zz}, q_x, q_y, q_z \}\)

Return type:

float array of shape (16)

class MomentGauge.Models.ExpFamilyBase.GaugedExpFamilyModel(constant)#

Bases: BaseExpFamilyModel

The base class for exponential family model with Gauge transformations.

It add two methods moments_gauge_transformation() and natural_paras_gauge_transformation() to BaseExpFamilyModel

Parameters:

constant (dict) –

dictionary with the following keys

’m’ : float - the mass of particle considered

’kB’ : float - the Boltzmann constant

m#

the mass of particle considered

Type:

float

kB#

the Boltzmann constant

Type:

float

constant#

dictionary with the keys containing ‘m’ and ‘kB’

Type:

dict

moments_gauge_transformation(moments, gauge_para2=(), gauge_para1=(), base_args=())#

Gauge transformation for moments of sufficient statistics. The transformation is defined as

\begin{equation} M_i(\mathbf{g}' )= T_{ij}(\mathbf{g}',\mathbf{g}) M_j(\mathbf{g}); \quad i,j = 0, \cdots, M \end{equation}

which is induced from the gauge transformation \(T_{ij}(\mathbf{g}',\mathbf{g})\) between sufficient statistics \(\phi_i(\mathbf{u},\mathbf{g})\) such that

\begin{equation} \phi_i(\mathbf{u}, \mathbf{g}' )= T_{ij}(\mathbf{g}',\mathbf{g}) \phi_j(\mathbf{u}, \mathbf{g}); \quad i,j = 0, \cdots, M \end{equation}

with \(\phi_i(\mathbf{u},\mathbf{g})\) is sufficient statistics parameterized by gauge parameters \(\mathbf{g}\).

Parameters:
  • moments (float array of shape (M+1)) – the moments \(M_i(\mathbf{g})\) of sufficient statistics

  • gauge_para2 (tuple) – Tuple containing arbitrary many extra gauge parameters such as \(\mathbf{g}'\)

  • gauge_para1 (tuple) – Tuple containing arbitrary many extra gauge parameters such as \(\mathbf{g}\)

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

the moments \(M_i(\mathbf{g}')\) of sufficient statistics

Return type:

float array of shape (M+1)

natural_paras_gauge_transformation(betas, gauge_para2=(), gauge_para1=(), base_args=())#

Gauge transformation for natural parameters. The transformation is defined as

\begin{equation} \beta_i(\mathbf{g}' )= T_{ij}^T(\mathbf{g},\mathbf{g}') \beta_j(\mathbf{g}); \quad i,j = 0, \cdots, M \end{equation}

which is induced from the gauge transformation \(T_{ij}(\mathbf{g}',\mathbf{g})\) between sufficient statistics \(\phi_i(\mathbf{u},\mathbf{g})\) such that

\begin{equation} \phi_i(\mathbf{u}, \mathbf{g}' )= T_{ij}(\mathbf{g}',\mathbf{g}) \phi_j(\mathbf{u}, \mathbf{g}); \quad i,j = 0, \cdots, M \end{equation}

with \(\phi_i(\mathbf{u},\mathbf{g})\) is sufficient statistics parameterized by gauge parameters \(\mathbf{g}\).

Parameters:
  • betas (float array of shape (M+1)) – the moments \(\beta_i(\mathbf{g})\) of sufficient statistics

  • gauge_para2 (tuple) – Tuple containing arbitrary many extra gauge parameters such as \(\mathbf{g}'\)

  • gauge_para1 (tuple) – Tuple containing arbitrary many extra gauge parameters such as \(\mathbf{g}\)

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

the moments \(\beta_i(\mathbf{g}')\) of sufficient statistics

Return type:

float array of shape (M+1)

standard_gauge_para_from_moments(moments, gauge_para=())#

the standard gauge parameters \(\mathbf{g}\) prefered among all possible gauges.

Parameters:
  • moments (float array of shape (N)) – The array containing moments of sufficient statistics given the gauge parameters \(\mathbf{g}\)

  • gauge_para (tuple) – Tuple containing arbitrary many extra gauge parameters such as \(\mathbf{g}\)

Returns:

the standard gauge parameters \(\mathbf{g}\) prefered among all possible gauges.

Return type:

float array

suff_statistics(u, gauge_paras=())#

Compute the value of sufficient statistics at certain \(\mathbf{u}\)

Parameters:
  • u (float array of shape (3)) – The 3D sample vector

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

Returns:

The array \(\{ \phi_0(\mathbf{u}), \cdots, \phi_M(\mathbf{u}) \}\)

Return type:

float array of shape (M+1)

moments_to_natural_paras(betas_ini, moments, gauge_paras=(), base_args=())#

Compute the natural parameters \(\boldsymbol{\beta}\) from the moments of sufficient statistics.

Specific implementation (Children) of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – A set of proposed natural parameter \(\boldsymbol{\beta}\)

  • moments (float array of shape (M+1)) – the target moments that we expect exponential familty with the natural parameter \(\boldsymbol{\beta}\) to have.

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

A tuple containing

beta: float array of shape (M+1) - The natural parameters \(\boldsymbol{\beta}\)

opt_info: tuple - A tuple containing other information of the optimization process

values: float - the optimal value of target_function.

residuals: float - the residual of the optimization.

step: float - the total number of Newton’s step iteration.

bsteps: float - the total number of Backtracking step.

Return type:

Tuple

natural_paras_to_moments(betas, gauge_paras=(), base_args=())#

Compute the moments of sufficient statistics given natural parameters.

Specific implementation of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

The array \(\{ M_0, \cdots, M_M \}\)

Return type:

float array of shape (M+1)

natural_paras_to_custom_moments(betas, statistics, gauge_paras=(), base_args=(), stats_gauge_paras=())#

Compute the moments of custom statistics given natural parameters.

Specific implementation of BaseExpFamilyModel should replace gauge_paras and base_args to explicit arguments.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • statistics (function) –

    A float-valued or tensor-valued function \(\phi_{i_1,\cdots,i_k}\) ( u , \(*\) gauge_paras ) with

    Parameters:

    u : float array of shape (3) - The 3D sample vector \(\mathbf{u}\)

    \(*\) gauge_paras : - Arbitrary many extra parameters such as \(\mathbf{g}\). The \(*\) refers to the unpacking operator in python.

    Returns:

    float or array of arbitrary shape \((d_1,\cdots,d_k)\) – the value of the statistic \(\phi_{i_1,\cdots,i_k}(\mathbf{u},\mathbf{g})\)

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics as gauge_paras. Defaut is (), an empty tuple.

  • stats_gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters the custom statistics function \(\phi_{i_1,\cdots,i_k}\) required as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

The moment value \(M_{i_1,\cdots,i_k}(\mathbf{g})\)

Return type:

float or array of arbitrary shape \((d_1,\cdots,d_k)\)

natural_paras_to_fluid_properties(betas, gauge_paras=(), base_args=())#

Compute the fluid properties including number density \(n\), density \(\rho\), flow velocities \(\mathbf{v} = \{v_\alpha, \alpha \in \{x,y,z\}\}\), temperature \(T\), pressure \(p\), stress \(\{\sigma_{\alpha \beta}, \alpha, \beta \in \{x,y,z\}\}\) and heat flux \(\{q_{\alpha}, \alpha \in \{x,y,z\}\}\).

\begin{equation} \begin{split} n &= \frac{\rho}{m}= \int f(\mathbf{u}) d^3 \mathbf{u} \\ v_\alpha &= \frac{1}{n}\int u_\alpha f(\mathbf{u}) d^3 \mathbf{u}\\ p &= n k_B T = \frac{1}{3} \int m c_\alpha c_\alpha f(\mathbf{u}) d^3 \mathbf{u} \\ \sigma_{\alpha\beta} &= \int m c_\alpha c_\beta f(\mathbf{u}) d^3 \mathbf{u} - p \delta_{\alpha\beta} \\ \epsilon &= \frac{3}{2} k_B T = \frac{1}{n}\int \frac{m}{2} \mathbf{c}^2 f(\mathbf{u}) d^3 \mathbf{u} \\ q_\alpha &= \int \frac{m}{2} c_\alpha \mathbf{c}^2 f(\mathbf{u}) d^3 \mathbf{u}; \quad \alpha, \beta \in \{x,y,z\} \end{split} \end{equation}

in which \(m\) is the mass of gas molecule.

Parameters:
  • betas (float array of shape (M+1)) – the natural parameter \(\boldsymbol{\beta}\) of the distribution

  • gauge_paras (tuple) – A tuple ( para1, para2, … ) containing arbitrary many extra parameters, i.e \(\mathbf{g}\) , required by sufficient statistics \(\{\phi_i\}\) as gauge_paras. Defaut is (), an empty tuple.

  • base_args (tuple) – A tuple ( para1, para2, … ) containing arbitrary many parameters required by BaseSampler.sample. Defaut is (), an empty tuple.

Returns:

Array containing macroscopic quantities \(\{ \rho, n, v_x, v_y, v_z, T, p, \sigma_{xx}, \sigma_{xy}, \sigma_{xz}, \sigma_{yy}, \sigma_{yz}, \sigma_{zz}, q_x, q_y, q_z \}\)

Return type:

float array of shape (16)