Generate and return a reweighting of the input weight
vector, such that the sequence represented by output reweight
is the refined (skipped by the amount skip
) version of the sequence represented by the input weight
.
The following examples illustrate the specific functioning of this generic interface:
skip: 1
Weight: 5, 0, 1, 3, 1
RefinedWeight: 5, 0, 1, 3, 1
skip: 2
Weight: 5, 0, 1, 3, 1
RefinedWeight: 3, 0, 0, 2, 0
skip: 3
Weight: 5, 0, 1, 3, 1
RefinedWeight: 2, 0, 0, 1, 1
- Parameters
-
[in] | weight | : The input contiguous array of shape (:) of
-
type
integer of default kind IK,
-
type
integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64),
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the weights that are to be reweighted (refined).
Non-positive values are allowed, but ignored by definition and reset to zero in the output reweight .
|
[in] | skip | : The input scalar of the same type and kind as the input weight , representing the size of the skip in the sequence whose weight is given as input.
If the input weight is of type integer of default kind IK, then skip can be also of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128).
|
- Returns
reweight
: The output object of the same type, kind, rank, shape, and size as the input weight
containing the refined weights by the input amount skip
.
Any element of the input weight
that does not contribute to the output refined weight is set to 0
on output.
Possible calling interfaces ⛓
Generate and return a reweighting of the input weight vector, such that the sequence represented by o...
This module contains the types, classes, and procedures relevant to weights of random samples.
- Warning
- The condition
0 < skip
must hold.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- Developer Remark:
- The term
reweight
here stands for refined weight.
- See also
- getReweight
setReweight
getRefined
setRefined
getCompact
setCompact
getVerbose
Example usage ⛓
10 type(display_type) :: disp
11 integer(IK) :: lenwei, itry, ntry
= 10
16 integer(IKG),
allocatable :: weight(:)
19 call disp%show(
"lenwei = getUnifRand(0, 9); skip = getUnifRand(1, 4)")
25 call disp%show(
"weight = getUnifRand(-1, 9, lenwei)")
29 call disp%show(
"weight = getReweight(weight, skip)")
39 real(RKG),
allocatable :: weight(:)
42 call disp%show(
"lenwei = getUnifRand(0, 9); skip = getUnifRand(.1_RKG, 4._RKG)")
48 call disp%show(
"weight = getUnifRand(-1._RKG, 9._RKG, lenwei)")
52 call disp%show(
"weight = getReweight(weight, skip)")
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
44-1,
+2,
+0,
+9,
+5,
+1,
+3
47+0,
+0,
+0,
+2,
+2,
+0,
+1
128+2.92775822,
+8.00728416,
+7.48291016,
-0.369564295E-1,
+8.80005264
131+0.00000000,
+3.00000000,
+2.00000000,
+0.00000000,
+3.00000000
140+6.17512703,
+5.61630440,
+3.13610363,
+1.05797434,
+1.75172234,
+2.60289955,
+4.60285664,
+3.89813852
143+5.00000000,
+4.00000000,
+3.00000000,
+1.00000000,
+1.00000000,
+2.00000000,
+4.00000000,
+3.00000000
152+2.59312439,
+8.44668484,
+7.46217728,
+2.33511782,
+3.96270084,
+7.45240068,
-0.408355355,
+8.90172482
155+1.00000000,
+3.00000000,
+3.00000000,
+1.00000000,
+2.00000000,
+3.00000000,
+0.00000000,
+3.00000000
164+0.956561804,
+4.86224031,
+1.17463064,
+3.41727686
167+0.00000000,
+2.00000000,
+0.00000000,
+2.00000000
176+4.92713451,
+5.61678267,
+7.44877338,
+7.39346790,
+7.08212805,
+4.23346758,
+0.248645782,
+7.16406631
179+2.00000000,
+3.00000000,
+4.00000000,
+4.00000000,
+4.00000000,
+2.00000000,
+0.00000000,
+4.00000000
188+5.77644873,
+6.92206001,
+6.47661781,
+4.26101685,
-0.133745432
191+1.00000000,
+2.00000000,
+1.00000000,
+2.00000000,
+0.00000000
200+5.11314869,
+1.58222866,
+8.89996624,
+4.55349874,
+1.68513310,
+4.75707912,
+6.29916239,
-0.839481711,
+3.58928418
203+4.00000000,
+2.00000000,
+9.00000000,
+4.00000000,
+2.00000000,
+4.00000000,
+7.00000000,
+0.00000000,
+3.00000000
212+5.32775784,
+2.86829758,
+7.48034716,
+1.13149595,
+2.61846066,
+1.33722496,
+1.71288633,
+0.980745792,
+2.33814812
215+32.0000000,
+18.0000000,
+45.0000000,
+7.00000000,
+16.0000000,
+8.00000000,
+11.0000000,
+6.00000000,
+14.0000000
224+5.06593466,
+4.60801363,
-0.284409523E-2,
+5.16035509
227+5.00000000,
+4.00000000,
+0.00000000,
+5.00000000
236+5.35532761,
+0.476899147E-1,
+0.386598110E-1,
+8.37812996,
-0.670538902
239+1.00000000,
+0.00000000,
+0.00000000,
+3.00000000,
+0.00000000
- Test:
- test_pm_sampleWeight
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.
-
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.
-
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.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, Saturday 1:48 AM, August 20, 2016, Institute for Computational Engineering and Sciences, UT Austin, TX
Definition at line 374 of file pm_sampleWeight.F90.