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

Generate a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is normalized by the specified input shift and scale along the specified axis dim.
More...

Detailed Description

Generate a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is normalized by the specified input shift and scale along the specified axis dim.

Here, ndim stands for the number of dimensions (data attributes) of the input sample and nsam represents the number of data points in the sample.
If the input shift is the negative of the mean of the sample and scale is the square-root of the inverse of the variance of the sample, then the returned sample will be a standard score (i.e., z-score).

Parameters
[in]sample: The input contiguous array of shape (nsam), (ndim, nsam), or (nsam, ndim) of,
  1. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  2. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the sample to be normalized.
[in]dim: The input scalar of type integer of default kind IK, whose value represents the dimension of the input sample containing different nsam observations:
  1. If dim = 1, the input sample is assumed to have the shape (nsam, ndim).
  2. If dim = 2, the input sample is assumed to have the shape (ndim, nsam).
(optional. It must be present if and only if the input arguments the condition rank(sample) > 1 holds.)
[in]shift: The input scalar or the contiguous vector of the same type and kind as sample, representing the amount by which the input sample must be shifted.
  1. If the input rank(sample) = 1, then shift must be a scalar.
  2. If the input rank(sample) = 2, then shift must be a vector of size ndim.
If the sample is to be shifted toward the origin to have a mean of zero, then the input shift corresponds to the negative of the current mean of the sample that is returned by procedures collectively represented by the generic interface getMean.
Note that the size of the input shift must be consistent with the size of the input sample:
  1. If the input argument dim = 1 then, size(shift) == size(sample, 2) == ndim must hold.
  2. If the input argument dim = 2 then, size(shift) == size(sample, 1) == ndim must hold.
[in]scale: The input scalar or the contiguous vector of,
  1. the same type and kind as sample,
  2. type real of the same kind as that of sample if sample is of type complex,
representing the amount by which the input sample must be scaled.
  1. If the input rank(sample) = 1, then scale must be a scalar.
  2. If the input rank(sample) = 2, then scale must be a vector of size ndim.
If the sample is to be scaled to have a unit variance, then the input scale corresponds to the square-root of the inverse of the variance of the sample that is returned by procedures collectively represented by the generic interface getVar.
Note that the size of the input scale must be consistent with the size of the input sample:
  1. If the input argument dim = 1 then, size(scale) == size(sample, 2) == ndim must hold.
  2. If the input argument dim = 2 then, size(scale) == size(sample, 1) == ndim must hold.
[in]operation: The input scalar constant that can be any of the following:
  1. The constant transHerm implying that a Hermitian transpose of the input sample must be returned.
    In other words, the actions getNormed(sample, dim, transHerm) and transpose(conjg(getNormed(sample, dim))) are equivalent.
    Specifying transHerm for source of type other than complex is identical to specifying transSymm for source of type other than complex.
(optional, default = .false.. It can be present only if the condition rank(sample) == 2 holds.)
Returns
sampleNormed : The output object of the same type and kind and rank as sample, containing the normalized sample.
  1. If the input sample is a vector, then sampleNormed has the same shape and size as that of sample.
  2. If the input sample is a matrix of shape (nrow, ncol), then
    1. sampleNormed has the shape (nrow, ncol) if operation is missing.
    2. sampleNormed has the shape (ncol, nrow) if operation = transHerm.


Possible calling interfaces

sampleNormed(:) = getNormed(sample(:), shift, scale)
sampleNormed(:,:) = getNormed(sample(:,:), dim, shift(:), scale(:))
sampleNormed(:,:) = getNormed(sample(:,:), dim, shift(:), scale(:), operation)
Generate a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is normalized by the specifie...
This module contains classes and procedures for normalizing univariate or multivariate samples by arb...
Warning
The condition 1 <= dim .and. dim <= rank(sample) must hold for the corresponding input arguments.
The condition size(scale) == size(sample, 3 - dim) .or. rank(sample) /= 2 must hold for the corresponding input arguments.
The condition size(shift) == size(sample, 3 - dim) .or. rank(sample) /= 2 must hold for the corresponding input arguments.
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.
See also
getScaled
setScaled
getNormed
setNormed


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_sampleVar, only: getVar
5 use pm_sampleMean, only: getMean
6 use pm_sampleNorm, only: transHerm
7 use pm_sampleNorm, only: getNormed
10 use pm_io, only: display_type
11
12 implicit none
13
14 integer(IK) :: dim
15 type(display_type) :: disp
16 disp = display_type(file = "main.out.F90")
17
18 call disp%skip()
19 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
20 call disp%show("!Normalize a 1D zero-mean sample to have a unit variance.")
21 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
22 call disp%skip()
23
24 block
25 use pm_kind, only: TKG => RKS ! All kinds are supported.
26 real(TKG), allocatable :: sample(:)
27 call disp%show("sample = getLinSpace(x1 = 0., x2 = 10., count = 11_IK)")
28 sample = getLinSpace(x1 = 0., x2 = 10., count = 11_IK)
29 call disp%show("sample")
30 call disp%show( sample )
31 call disp%show("getMean(sample)")
32 call disp%show( getMean(sample) )
33 call disp%show("getVar(sample)")
34 call disp%show( getVar(sample) )
35 call disp%show("sample = getNormed(sample, -getMean(sample), 1._TKG / sqrt(getVar(sample)))")
36 sample = getNormed(sample, -getMean(sample), 1._TKG / sqrt(getVar(sample)))
37 call disp%show("sample")
38 call disp%show( sample )
39 call disp%show("getMean(sample)")
40 call disp%show( getMean(sample) )
41 call disp%show("getVar(sample)")
42 call disp%show( getVar(sample) )
43 call disp%skip()
44 end block
45
46 block
47 use pm_kind, only: TKG => RKS ! All kinds are supported.
48 complex(TKG), allocatable :: sample(:)
49 call disp%show("sample = cmplx(getLinSpace(x1 = 0., x2 = 10., count = 11_IK), -getLinSpace(x1 = 0., x2 = 10., count = 11_IK), TKG)")
50 sample = cmplx(getLinSpace(x1 = 0., x2 = 10., count = 11_IK), -getLinSpace(x1 = 0., x2 = 10., count = 11_IK), TKG)
51 call disp%show("sample")
52 call disp%show( sample )
53 call disp%show("getMean(sample)")
54 call disp%show( getMean(sample) )
55 call disp%show("getVar(sample)")
56 call disp%show( getVar(sample) )
57 call disp%show("sample = getNormed(sample, -getMean(sample), 1._TKG / sqrt(getVar(sample)))")
58 sample = getNormed(sample, -getMean(sample), 1._TKG / sqrt(getVar(sample)))
59 call disp%show("sample")
60 call disp%show( sample )
61 call disp%show("getMean(sample)")
62 call disp%show( getMean(sample) )
63 call disp%show("getVar(sample)")
64 call disp%show( getVar(sample) )
65 call disp%skip()
66 end block
67
68 call disp%skip()
69 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
70 call disp%show("!Normalize a 2D zero-mean sample to have a unit variance.")
71 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
72 call disp%skip()
73
74 block
75 use pm_kind, only: TKG => RKS ! All kinds are supported.
76 real(TKG), allocatable :: sample(:,:)
77 call disp%show("sample = reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5])")
78 sample = reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5])
79 call disp%show("dim = 2")
80 dim = 2
81 call disp%show("call setShifted(sample, dim, -getMean(sample, dim))")
82 call setShifted(sample, dim, -getMean(sample, dim))
83 call disp%show("sample")
84 call disp%show( sample )
85 call disp%show("getMean(sample, dim)")
86 call disp%show( getMean(sample, dim) )
87 call disp%show("getVar(sample, dim)")
88 call disp%show( getVar(sample, dim) )
89 call disp%show("sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)))")
90 sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)))
91 call disp%show("sample")
92 call disp%show( sample )
93 call disp%show("getMean(sample, dim)")
94 call disp%show( getMean(sample, dim) )
95 call disp%show("getVar(sample, dim)")
96 call disp%show( getVar(sample, dim) )
97 call disp%skip()
98 end block
99
100 block
101 use pm_kind, only: TKG => RKS ! All kinds are supported.
102 complex(TKG), allocatable :: sample(:,:)
103 call disp%show("sample = cmplx(reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]), -reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]))")
104 sample = cmplx(reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]), -reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]))
105 call disp%show("dim = 2")
106 dim = 2
107 call disp%show("call setShifted(sample, dim, -getMean(sample, dim))")
108 call setShifted(sample, dim, -getMean(sample, dim))
109 call disp%show("sample")
110 call disp%show( sample )
111 call disp%show("getMean(sample, dim)")
112 call disp%show( getMean(sample, dim) )
113 call disp%show("getVar(sample, dim)")
114 call disp%show( getVar(sample, dim) )
115 call disp%show("sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)))")
116 sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)))
117 call disp%show("sample")
118 call disp%show( sample )
119 call disp%show("getMean(sample, dim)")
120 call disp%show( getMean(sample, dim) )
121 call disp%show("getVar(sample, dim)")
122 call disp%show( getVar(sample, dim) )
123 call disp%skip()
124 end block
125
126 call disp%skip()
127 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
128 call disp%show("!Normalize a 2D zero-mean sample to have a unit variance and transpose the result upon return.")
129 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
130 call disp%skip()
131
132 block
133 use pm_kind, only: TKG => RKS ! All kinds are supported.
134 real(TKG), allocatable :: sample(:,:)
135 call disp%show("sample = reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5])")
136 sample = reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5])
137 call disp%show("dim = 2")
138 dim = 2
139 call disp%show("call setShifted(sample, dim, -getMean(sample, dim))")
140 call setShifted(sample, dim, -getMean(sample, dim))
141 call disp%show("sample")
142 call disp%show( sample )
143 call disp%show("getMean(sample, dim)")
144 call disp%show( getMean(sample, dim) )
145 call disp%show("getVar(sample, dim)")
146 call disp%show( getVar(sample, dim) )
147 call disp%show("sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)), transHerm)")
148 sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)), transHerm)
149 call disp%show("sample")
150 call disp%show( sample )
151 call disp%show("getMean(sample, 3_IK - dim)")
152 call disp%show( getMean(sample, 3_IK - dim) )
153 call disp%show("getVar(sample, 3_IK - dim)")
154 call disp%show( getVar(sample, 3_IK - dim) )
155 call disp%skip()
156 end block
157
158 block
159 use pm_kind, only: TKG => RKS ! All kinds are supported.
160 complex(TKG), allocatable :: sample(:,:)
161 call disp%show("sample = cmplx(reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]), -reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]))")
162 sample = cmplx(reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]), -reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]))
163 call disp%show("dim = 2")
164 dim = 2
165 call disp%show("call setShifted(sample, dim, -getMean(sample, dim))")
166 call setShifted(sample, dim, -getMean(sample, dim))
167 call disp%show("sample")
168 call disp%show( sample )
169 call disp%show("getMean(sample, dim)")
170 call disp%show( getMean(sample, dim) )
171 call disp%show("getVar(sample, dim)")
172 call disp%show( getVar(sample, dim) )
173 call disp%show("sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)), transHerm)")
174 sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)), transHerm)
175 call disp%show("sample")
176 call disp%show( sample )
177 call disp%show("getMean(sample, 3_IK - dim)")
178 call disp%show( getMean(sample, 3_IK - dim) )
179 call disp%show("getVar(sample, 3_IK - dim)")
180 call disp%show( getVar(sample, 3_IK - dim) )
181 call disp%skip()
182 end block
183
184end program example
Generate count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
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
Generate and return the (weighted) mean of an input sample of nsam observations with ndim = 1 or 2 at...
Return a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is shifted by the specified inp...
Generate and return the variance of the input sample of type complex or real of shape (nsam) or (ndim...
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
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 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 RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
This module contains classes and procedures for computing the first moment (i.e., the statistical mea...
This module contains classes and procedures for shifting univariate or multivariate samples by arbitr...
This module contains classes and procedures for computing the properties related to the covariance ma...
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
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!Normalize a 1D zero-mean sample to have a unit variance.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6sample = getLinSpace(x1 = 0., x2 = 10., count = 11_IK)
7sample
8+0.00000000, +1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000, +6.00000000, +7.00000000, +8.00000000, +9.00000000, +10.0000000
9getMean(sample)
10+5.00000000
11getVar(sample)
12+10.0000000
13sample = getNormed(sample, -getMean(sample), 1._TKG / sqrt(getVar(sample)))
14sample
15-1.58113885, -1.26491106, -0.948683262, -0.632455528, -0.316227764, +0.00000000, +0.316227764, +0.632455528, +0.948683262, +1.26491106, +1.58113885
16getMean(sample)
17+0.325116254E-7
18getVar(sample)
19+1.00000000
20
21sample = cmplx(getLinSpace(x1 = 0., x2 = 10., count = 11_IK), -getLinSpace(x1 = 0., x2 = 10., count = 11_IK), TKG)
22sample
23(+0.00000000, -0.00000000), (+1.00000000, -1.00000000), (+2.00000000, -2.00000000), (+3.00000000, -3.00000000), (+4.00000000, -4.00000000), (+5.00000000, -5.00000000), (+6.00000000, -6.00000000), (+7.00000000, -7.00000000), (+8.00000000, -8.00000000), (+9.00000000, -9.00000000), (+10.0000000, -10.0000000)
24getMean(sample)
25(+5.00000000, -5.00000000)
26getVar(sample)
27+20.0000000
28sample = getNormed(sample, -getMean(sample), 1._TKG / sqrt(getVar(sample)))
29sample
30(-1.11803401, +1.11803401), (-0.894427180, +0.894427180), (-0.670820355, +0.670820355), (-0.447213590, +0.447213590), (-0.223606795, +0.223606795), (+0.00000000, +0.00000000), (+0.223606795, -0.223606795), (+0.447213590, -0.447213590), (+0.670820355, -0.670820355), (+0.894427180, -0.894427180), (+1.11803401, -1.11803401)
31getMean(sample)
32(+0.00000000, +0.00000000)
33getVar(sample)
34+1.00000000
35
36
37!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38!Normalize a 2D zero-mean sample to have a unit variance.
39!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40
41sample = reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5])
42dim = 2
43call setShifted(sample, dim, -getMean(sample, dim))
44sample
45-4.00000000, -2.00000000, +0.00000000, +2.00000000, +4.00000000
46-4.00000000, -2.00000000, +0.00000000, +2.00000000, +4.00000000
47getMean(sample, dim)
48+0.00000000, +0.00000000
49getVar(sample, dim)
50+8.00000000, +8.00000000
51sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)))
52sample
53-1.41421354, -0.707106769, +0.00000000, +0.707106769, +1.41421354
54-1.41421354, -0.707106769, +0.00000000, +0.707106769, +1.41421354
55getMean(sample, dim)
56+0.238418583E-7, +0.238418583E-7
57getVar(sample, dim)
58+0.999999940, +0.999999940
59
60sample = cmplx(reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]), -reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]))
61dim = 2
62call setShifted(sample, dim, -getMean(sample, dim))
63sample
64(-4.00000000, +4.00000000), (-2.00000000, +2.00000000), (+0.00000000, +0.00000000), (+2.00000000, -2.00000000), (+4.00000000, -4.00000000)
65(-4.00000000, +4.00000000), (-2.00000000, +2.00000000), (+0.00000000, +0.00000000), (+2.00000000, -2.00000000), (+4.00000000, -4.00000000)
66getMean(sample, dim)
67(+0.00000000, +0.00000000), (+0.00000000, +0.00000000)
68getVar(sample, dim)
69+16.0000000, +16.0000000
70sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)))
71sample
72(-1.00000000, +1.00000000), (-0.500000000, +0.500000000), (+0.00000000, +0.00000000), (+0.500000000, -0.500000000), (+1.00000000, -1.00000000)
73(-1.00000000, +1.00000000), (-0.500000000, +0.500000000), (+0.00000000, +0.00000000), (+0.500000000, -0.500000000), (+1.00000000, -1.00000000)
74getMean(sample, dim)
75(+0.00000000, +0.00000000), (+0.00000000, +0.00000000)
76getVar(sample, dim)
77+1.00000000, +1.00000000
78
79
80!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81!Normalize a 2D zero-mean sample to have a unit variance and transpose the result upon return.
82!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83
84sample = reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5])
85dim = 2
86call setShifted(sample, dim, -getMean(sample, dim))
87sample
88-4.00000000, -2.00000000, +0.00000000, +2.00000000, +4.00000000
89-4.00000000, -2.00000000, +0.00000000, +2.00000000, +4.00000000
90getMean(sample, dim)
91+0.00000000, +0.00000000
92getVar(sample, dim)
93+8.00000000, +8.00000000
94sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)), transHerm)
95sample
96-1.41421354, -1.41421354
97-0.707106769, -0.707106769
98+0.00000000, +0.00000000
99+0.707106769, +0.707106769
100+1.41421354, +1.41421354
101getMean(sample, 3_IK - dim)
102+0.238418583E-7, +0.238418583E-7
103getVar(sample, 3_IK - dim)
104+0.999999940, +0.999999940
105
106sample = cmplx(reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]), -reshape(getLinSpace(x1 = 1._TKG, x2 = 10._TKG, count = 10_IK), [2,5]))
107dim = 2
108call setShifted(sample, dim, -getMean(sample, dim))
109sample
110(-4.00000000, +4.00000000), (-2.00000000, +2.00000000), (+0.00000000, +0.00000000), (+2.00000000, -2.00000000), (+4.00000000, -4.00000000)
111(-4.00000000, +4.00000000), (-2.00000000, +2.00000000), (+0.00000000, +0.00000000), (+2.00000000, -2.00000000), (+4.00000000, -4.00000000)
112getMean(sample, dim)
113(+0.00000000, +0.00000000), (+0.00000000, +0.00000000)
114getVar(sample, dim)
115+16.0000000, +16.0000000
116sample = getNormed(sample, dim, -getMean(sample, dim), 1._TKG / sqrt(getVar(sample, dim)), transHerm)
117sample
118(-1.00000000, -1.00000000), (-1.00000000, -1.00000000)
119(-0.500000000, -0.500000000), (-0.500000000, -0.500000000)
120(+0.00000000, -0.00000000), (+0.00000000, -0.00000000)
121(+0.500000000, +0.500000000), (+0.500000000, +0.500000000)
122(+1.00000000, +1.00000000), (+1.00000000, +1.00000000)
123getMean(sample, 3_IK - dim)
124(+0.00000000, +0.00000000), (+0.00000000, +0.00000000)
125getVar(sample, 3_IK - dim)
126+1.00000000, +1.00000000
127
128
Test:
test_pm_sampleNorm
Todo:
Very Low Priority: The functionality of this interface can be expanded to include normalizing of higher dimensional input sample and whole sample input arrays of arbitrary shape, although the latter is trivial using the Fortran array syntax.


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, Saturday 2:48 AM, August 22, 2021, Dallas, TX

Definition at line 281 of file pm_sampleNorm.F90.


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