ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_distBand::setBandMean Interface Reference

Generate and return the mean of the Band distribution for an input set of parameters.
More...

Detailed Description

Generate and return the mean of the Band distribution for an input set of parameters.

See the documentation of pm_distBand for more information on the Band distribution.
This generic interface performs one of the following quantities:

  1. The mean of the Band distribution.
    The mean of the Band distribution with an unknown normalization (amplitude) over an arbitrary range \((\ms{lb}, \ms{ub})\) is defined by the following integral ratio,

    \begin{equation} \large \mu_E = \frac{ \int_{\ms{lb}}^{\ms{ub}} E ~ f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }{ \int_{\ms{lb}}^{\ms{ub}} f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE } ~, \end{equation}

    where \(\mu_E\) is the mean of the Band distribution.
    The mean of the Band distribution is particularly important for converting the photon fluence of a Band spectrum to the corresponding energy fluence.
    For example, the energy fluence \(\sergs\) of the Band distribution with the same physical unit as \(E\) can be computed from the corresponding the Band photon fluence \(\sphot\) as,

    \begin{equation} \large \sergs = \sphot \mu_E ~, \end{equation}

  2. The generalized mean of the Band distribution.
    Optionally, this generic interface also computes the above integral with new support \((\ms{lbnew}, \ms{ubnew})\),

    \begin{equation} \large \mu_E = \frac{ \int_{\ms{lbnew}}^{\ms{ubnew}} E ~ f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE }{ \int_{\ms{lb}}^{\ms{ub}} f_{\ms{BAND}}(E | \alpha, \beta, \ebreak) dE } ~, \end{equation}

    where \(\mu_E\) is not anymore the common definition of the distribution mean, but a generalization of the concept.
    This generalized mean facilitates the computation of the energy or photon fluence over a different range from the range of the original photon or energy fluence.
Warning
The input arguments lbnew, ubnew, lb, ub, ebreak must all be unit-less (without physical dimensions) or all have the same physical units (typically, \(\kev\)).
Note
The physical units of the input or output units can be changed via the facilities of module pm_physUnit.
Parameters
[out]mean: The output positive scalar or array of the same shape as any input array-like argument, of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128).
  1. If the input arguments lbnew and ubnew are missing, then mean will contain the mean of the Band distribution on return.
  2. If the input arguments lbnew and ubnew are present, then mean will contain the ratio of the UCDF of the Band distribution in the range \((\ms{lbnew}, \ms{ubnew})\) to the UCDF of the Band distribution in the \((\ms{lb}, \ms{ub})\) as defined above.
[in]lb: The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the output argument mean, representing the lower bound of the Band distribution.
[in]ub: The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the output argument mean, representing the upper bound of the Band distribution.
[in]alpha: The input scalar or array of the same shape as other array-like arguments of the same type and kind as mean, containing the first shape parameter of the distribution.
[in]beta: The input scalar or array of the same shape as other array-like arguments of the same type and kind as mean, containing the second shape parameter of the distribution.
[in]ebreak: The input scalar or array of the same shape as other array-like arguments of the same type and kind as mean, containing the normalized spectral break energy values: \(\ebreak = \frac{\ebreak}{100\kev}\).
[out]info: The output scalar of type integer of default kind IK.
On output, it is set to positive the number of iterations taken for the series representation of the Gamma function to converge.
If the algorithm fails to converge, then info is set to the negative of the number of iterations taken by the algorithm or, to the output error returned by brute force integrator getQuadErr.
An negative output value signifies the lack of convergence and failure to compute the UCDF.
This is likely to happen if the input value for alpha or beta are too extreme.
[in]lbnew: The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the output argument mean, representing the new lower bound of the Band distribution.
(optional, default = lb)
[in]ubnew: The input positive scalar or array of the same shape as any input array-like argument, of the same type and kind as the output argument mean, representing the new upper bound of the Band distribution.
(optional, default = ub)


Possible calling interfaces

call setBandMean(mean, lb, ub, alpha, beta, ebreak, info)
call setBandMean(mean, lb, ub, alpha, beta, ebreak, info, lbnew, ubnew)
Generate and return the mean of the Band distribution for an input set of parameters.
This module contains procedures and generic interfaces for computing the Band photon distribution wid...
Definition: pm_distBand.F90:97
Warning
The condition 0 < lb must hold for the corresponding input arguments.
The condition lb < ub must hold for the corresponding input arguments.
The condition 0 < lbnew must hold for the corresponding input arguments.
The condition lbnew < ubnew must hold for the corresponding input arguments.
The condition 0 < fluence must hold for the corresponding input arguments.
The condition 0 < lbnew must hold for the corresponding input arguments.
The condition 0 < ubnew must hold for the corresponding input arguments.
The condition alpha /= -2 must hold for the corresponding input arguments.
The condition 0 < ebreak must hold for the corresponding input arguments.
The condition 0 < invEfold must hold for the corresponding input arguments.
The condition beta < alpha must hold for the corresponding input arguments.
The condition ebreak = (alpha - beta) * invEfold must hold for the corresponding input arguments.
The condition zeta = getZeta(alpha, beta, ebreak) must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
Remarks
The procedures under discussion are impure.
The procedures under discussion are elemental.
Note
The normalization (and the physical units) of the input energy is irrelevant as long as the input values ebreak and zeta are computed in the same physical dimensions and with the same normalizations.
See also
getBandUDF
setBandUCDF
setBandMean
getBandZeta
getBandEpeak
getBandEbreak
setBandPhoton
setBandEnergy


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_kind, only: RKG => RKH ! all processor kinds are supported.
5 use pm_io, only: display_type
6 use pm_distBand, only: setBandMean
9
10 implicit none
11
12 integer(IK) :: info
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 block
17
18 use pm_kind, only: RKG => RKD
19 real(RKG) :: mean, fluence, lbnew, ubnew, lb, ub, alpha, beta, ebreak
20
21 call disp%skip()
22 call disp%show("fluence = 2.044544e-07_RKG; lbnew = 50._RKG; ubnew = 300._RKG; lb = 50._RKG; ub = 300._RKG; alpha = -9.469590e-01_RKG; beta = -3.722981_RKG; ebreak = getBandEbreak(alpha, beta, 1.928073e+02_RKG);")
23 fluence = 2.044544e-07_RKG; lbnew = 50._RKG; ubnew = 300._RKG; lb = 50._RKG; ub = 300._RKG; alpha = -9.469590e-01_RKG; beta = -3.722981_RKG; ebreak = getBandEbreak(alpha, beta, 1.928073e+02_RKG);
24 call disp%show("call setBandMean(mean, lb, ub, alpha, beta, ebreak, info)")
25 call setBandMean(mean, lb, ub, alpha, beta, ebreak, info)
26 call disp%show("if (info < 0) error stop")
27 if (info < 0) error stop
28 call disp%show("real(ERGS2KEV * fluence / mean, RKG) ! photon fluence 1.084876")
29 call disp%show( real(ERGS2KEV * fluence / mean, RKG) )
30 call disp%skip()
31
32 end block
33
34end program example
Generate and return the spectral break energy parameter of the Band spectral model/distribution from ...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
Definition: pm_kind.F90:568
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
Definition: pm_kind.F90:858
This module contains relevant physical constants.
Definition: pm_physUnit.F90:41
real(RKB), parameter ERGS2KEV
The scalar constant of type real of kind RKB representing one ergs of energy in kilo-electronvolts.
Definition: pm_physUnit.F90:80
real(RKB), parameter KEV2ERGS
The scalar constant of type real of kind RKB representing one kilo-electronvolts of energy in ergs.
Definition: pm_physUnit.F90:79
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2fluence = 2.044544e-07_RKG; lbnew = 50._RKG; ubnew = 300._RKG; lb = 50._RKG; ub = 300._RKG; alpha = -9.469590e-01_RKG; beta = -3.722981_RKG; ebreak = getBandEbreak(alpha, beta, 1.928073e+02_RKG);
3call setBandMean(mean, lb, ub, alpha, beta, ebreak, info)
4if (info < 0) error stop
5real(ERGS2KEV * fluence / mean, RKG) ! photon fluence 1.084876
6+1.0860736204671377
7
8
Test:
test_pm_distBand


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Oct 16, 2009, 11:14 AM, Michigan

Definition at line 1008 of file pm_distBand.F90.


The documentation for this interface was generated from the following file: