ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_kind::modelr_type Type Reference

This is the abstract derived type for creating objects of class modelr_type that contain the characteristics of the processor representation model used for the requested integer data object.
More...

Inheritance diagram for pm_kind::modelr_type:
Collaboration diagram for pm_kind::modelr_type:

Public Attributes

real(RKHepsilon
 The scalar real of the highest kind RKH supported by the ParaMonte library, whose value is almost negligible compared with the value 1.0 in the model that includes the real data type of interest, that is \(b^{1-p}\) as detailed in the real data model of model_type.
More...
 
real(RKHRhuge
 The scalar real of the highest kind RKHR supported by the ParaMonte library, representing the largest value in the model that includes the real data type of interest.
More...
 
integer(IKmaxexponent
 The scalar integer of default kind IK, representing the maximum exponent in the model that includes the real data type of interest.
This corresponds to \(e_{max}\) in the model set for the real data type detailed in model_type.
More...
 
integer(IKminexponent
 The scalar integer of default kind IK, representing the minimum exponent in the model that includes the real data type of interest.
This corresponds to \(e_{min}\) in the model set for the real data type detailed in model_type.
More...
 
integer(IKprecision
 The scalar integer of default kind IK, representing the equivalent decimal precision (number of digits after the decimal point) in the model representing real numbers with the same type parameter value as the real data type of interest.
The value is int((p - 1) * log10(b)) + k where k is 1 if b is an integral power of 10 and 0 otherwise.
The meaning of the real data type model parameters are detailed in model_type.
More...
 
real(RKHRtiny
 The scalar real of the highest kind RKHR supported by the ParaMonte library, representing the smallest positive number \(b^{e_min} - 1\) in the model that includes the real data type of interest.
The meaning of the real data type model parameters are detailed in model_type.
More...
 
- Public Attributes inherited from pm_kind::modeln_type
integer(IKdigits
 The scalar integer of default kind IK, whose value is the number of significant bit digits in the model that includes the numeric data type of interest, that is q or p in the integer and real models detailed in model_type.
More...
 
integer(IKradix
 The scalar integer of default kind IK, whose value is the base in the model that includes the numeric data of interest, that is r or b in the integer and real models detailed in model_type.
More...
 
integer(IKrange
 The scalar integer of default kind IK, holding the equivalent decimal exponent range in the models representing integer or real data type of interest.
The value is int(log10(huge)) for integer data type and int(min(log10(huge), -log10(tiny))) for real data type, where huge and tiny are the largest and smallest positive numbers in the corresponding model.
More...
 
- Public Attributes inherited from pm_kind::model_type
integer(IKkind
 The scalar integer of default kind IK, representing the processor-dependent kind type-parameter of data type of interest.
More...
 
integer(IKstorage_size
 The scalar integer of default kind IK, whose value is the size, in bits, that would be taken in memory by a scalar of the same type and kind as the data type of interest.
More...
 

Detailed Description

This is the abstract derived type for creating objects of class modelr_type that contain the characteristics of the processor representation model used for the requested integer data object.

See the documentations of model_type for details of model sets for supported data types.

Parameters
[in]mold: The input scalar or array of arbitrary rank of either
  1. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
whose type and kind will determine the characteristics of the output model object.
The specific value of the input mold is irrelevant and ignored.
Returns
model : The output scalar or array of type,
  1. modelr_type,
containing the characteristics of the processor representation model used for the input data entity.


Possible calling interfaces

type(modeln_type), allocatable :: modelNum
class(model_type), allocatable :: model
type(modelr_type) :: modelReal
modelReal = modelr_type(mold)
modelNum = modelr_type(mold)
model = modelr_type(mold)
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
This is the abstract derived type for creating objects of class model_type that contain the character...
Definition: pm_kind.F90:1504
This is the abstract derived type for creating objects of class modeln_type that contain the characte...
Definition: pm_kind.F90:1544
This is the abstract derived type for creating objects of class modelr_type that contain the characte...
Definition: pm_kind.F90:1746
Remarks
The procedures under discussion are pure.
The procedures under discussion are elemental.
See also
model_type
modeln_type
modeli_type
modelb_type
modelr_type


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_kind, only: modelr_type
5 use pm_io, only: display_type
6
7 implicit none
8
9 type(display_type) :: disp
10 disp = display_type(file = "main.out.F90")
11
12 block
13 use pm_kind, only: TKG => RKS
14 type(modelr_type) :: model
15 real(TKG) :: mold
16 call disp%skip()
17 call disp%show("kind(mold)")
18 call disp%show( kind(mold) )
19 call disp%show("model = modelr_type(mold)")
20 model = modelr_type(mold)
21 call disp%show("[model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size]")
22 call disp%show( [model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size] )
23 call disp%show("[model%epsilon, model%huge, model%tiny]")
24 call disp%show( [model%epsilon, model%huge, model%tiny] )
25 call disp%skip()
26 end block
27
28 block
29 use pm_kind, only: TKG => RKD
30 type(modelr_type) :: model
31 real(TKG) :: mold
32 call disp%skip()
33 call disp%show("kind(mold)")
34 call disp%show( kind(mold) )
35 call disp%show("model = modelr_type(mold)")
36 model = modelr_type(mold)
37 call disp%show("[model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size]")
38 call disp%show( [model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size] )
39 call disp%show("[model%epsilon, model%huge, model%tiny]")
40 call disp%show( [model%epsilon, model%huge, model%tiny] )
41 call disp%skip()
42 end block
43
44 block
45 use pm_kind, only: TKG => RKH
46 type(modelr_type) :: model
47 real(TKG) :: mold
48 call disp%skip()
49 call disp%show("kind(mold)")
50 call disp%show( kind(mold) )
51 call disp%show("model = modelr_type(mold)")
52 model = modelr_type(mold)
53 call disp%show("[model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size]")
54 call disp%show( [model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size] )
55 call disp%show("[model%epsilon, model%huge, model%tiny]")
56 call disp%show( [model%epsilon, model%huge, model%tiny] )
57 call disp%skip()
58 end block
59
60end program example
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
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
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
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
2kind(mold)
3+4
4model = modelr_type(mold)
5[model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size]
6+24, +128, -125, +6, +2, +37, +32
7[model%epsilon, model%huge, model%tiny]
8+0.119209289550781250000000000000000000E-6, +0.340282346638528859811704183484516925E+39, +0.117549435082228750796873653722224568E-37
9
10
11kind(mold)
12+8
13model = modelr_type(mold)
14[model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size]
15+53, +1024, -1021, +15, +2, +307, +64
16[model%epsilon, model%huge, model%tiny]
17+0.222044604925031308084726333618164062E-15, +0.179769313486231570814527423731704357E+309, +0.222507385850720138309023271733240406E-307
18
19
20kind(mold)
21+16
22model = modelr_type(mold)
23[model%digits, model%maxexponent, model%minexponent, model%precision, model%radix, model%range, model%storage_size]
24+113, +16384, -16381, +33, +2, +4931, +128
25[model%epsilon, model%huge, model%tiny]
26+0.192592994438723585305597794258492732E-33, +0.118973149535723176508575932662800702E+4933, +0.336210314311209350626267781732175260E-4931
27
28
Test:
test_pm_kind


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, September 1, 2017, 11:35 PM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin

Definition at line 1746 of file pm_kind.F90.

Member Data Documentation

◆ epsilon

real(RKH) pm_kind::modelr_type::epsilon

The scalar real of the highest kind RKH supported by the ParaMonte library, whose value is almost negligible compared with the value 1.0 in the model that includes the real data type of interest, that is \(b^{1-p}\) as detailed in the real data model of model_type.

Note
EPSILON makes it easy to select a delta for algorithms (such as root locators) that search until the calculation is within delta of an estimate.
If delta is too small (smaller than the decimal resolution of the data type), the algorithm might never halt.
By scaling the value returned by EPSILON to the estimate, you obtain a delta that ensures search termination.

Definition at line 1747 of file pm_kind.F90.

◆ huge

real(RKHR) pm_kind::modelr_type::huge

The scalar real of the highest kind RKHR supported by the ParaMonte library, representing the largest value in the model that includes the real data type of interest.

Definition at line 1754 of file pm_kind.F90.

◆ maxexponent

integer(IK) pm_kind::modelr_type::maxexponent

The scalar integer of default kind IK, representing the maximum exponent in the model that includes the real data type of interest.
This corresponds to \(e_{max}\) in the model set for the real data type detailed in model_type.

Definition at line 1756 of file pm_kind.F90.

◆ minexponent

integer(IK) pm_kind::modelr_type::minexponent

The scalar integer of default kind IK, representing the minimum exponent in the model that includes the real data type of interest.
This corresponds to \(e_{min}\) in the model set for the real data type detailed in model_type.

Definition at line 1758 of file pm_kind.F90.

◆ precision

integer(IK) pm_kind::modelr_type::precision

The scalar integer of default kind IK, representing the equivalent decimal precision (number of digits after the decimal point) in the model representing real numbers with the same type parameter value as the real data type of interest.
The value is int((p - 1) * log10(b)) + k where k is 1 if b is an integral power of 10 and 0 otherwise.
The meaning of the real data type model parameters are detailed in model_type.

Definition at line 1760 of file pm_kind.F90.

◆ tiny

real(RKHR) pm_kind::modelr_type::tiny

The scalar real of the highest kind RKHR supported by the ParaMonte library, representing the smallest positive number \(b^{e_min} - 1\) in the model that includes the real data type of interest.
The meaning of the real data type model parameters are detailed in model_type.

Definition at line 1764 of file pm_kind.F90.


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