ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_mathSqrt.F90
Go to the documentation of this file.
1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3!!!! !!!!
4!!!! ParaMonte: Parallel Monte Carlo and Machine Learning Library. !!!!
5!!!! !!!!
6!!!! Copyright (C) 2012-present, The Computational Data Science Lab !!!!
7!!!! !!!!
8!!!! This file is part of the ParaMonte library. !!!!
9!!!! !!!!
10!!!! LICENSE !!!!
11!!!! !!!!
12!!!! https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md !!!!
13!!!! !!!!
14!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16
64
65!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66
68
69 use pm_kind, only: SK, IK
70 use pm_search, only: linear, linear_type
71 use pm_search, only: binary, binary_type
72
73 implicit none
74
75 character(*, SK), parameter :: MODULE_NAME = "@pm_mathSqrt"
76
77!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78
141 interface getSqrt
142
143 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144
145#if IK5_ENABLED
146 PURE elemental module function getSqrtDef_IK5(posint) result(intSqrt)
147#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
148 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtDef_IK5
149#endif
150 use pm_kind, only: IKG => IK5
151 integer(IKG) , value :: posint
152 integer(IKG) :: intSqrt
153 end function
154#endif
155
156#if IK4_ENABLED
157 PURE elemental module function getSqrtDef_IK4(posint) result(intSqrt)
158#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
159 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtDef_IK4
160#endif
161 use pm_kind, only: IKG => IK4
162 integer(IKG) , value :: posint
163 integer(IKG) :: intSqrt
164 end function
165#endif
166
167#if IK3_ENABLED
168 PURE elemental module function getSqrtDef_IK3(posint) result(intSqrt)
169#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
170 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtDef_IK3
171#endif
172 use pm_kind, only: IKG => IK3
173 integer(IKG) , value :: posint
174 integer(IKG) :: intSqrt
175 end function
176#endif
177
178#if IK2_ENABLED
179 PURE elemental module function getSqrtDef_IK2(posint) result(intSqrt)
180#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
181 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtDef_IK2
182#endif
183 use pm_kind, only: IKG => IK2
184 integer(IKG) , value :: posint
185 integer(IKG) :: intSqrt
186 end function
187#endif
188
189#if IK1_ENABLED
190 PURE elemental module function getSqrtDef_IK1(posint) result(intSqrt)
191#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
192 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtDef_IK1
193#endif
194 use pm_kind, only: IKG => IK1
195 integer(IKG) , value :: posint
196 integer(IKG) :: intSqrt
197 end function
198#endif
199
200 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201
202#if IK5_ENABLED
203 PURE elemental module function getSqrtBin_IK5(posint, method) result(intSqrt)
204#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
205 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtBin_IK5
206#endif
207 use pm_kind, only: IKG => IK5
208 type(binary_type) , intent(in) :: method
209 integer(IKG) , value :: posint
210 integer(IKG) :: intSqrt
211 end function
212#endif
213
214#if IK4_ENABLED
215 PURE elemental module function getSqrtBin_IK4(posint, method) result(intSqrt)
216#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
217 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtBin_IK4
218#endif
219 use pm_kind, only: IKG => IK4
220 type(binary_type) , intent(in) :: method
221 integer(IKG) , value :: posint
222 integer(IKG) :: intSqrt
223 end function
224#endif
225
226#if IK3_ENABLED
227 PURE elemental module function getSqrtBin_IK3(posint, method) result(intSqrt)
228#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
229 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtBin_IK3
230#endif
231 use pm_kind, only: IKG => IK3
232 type(binary_type) , intent(in) :: method
233 integer(IKG) , value :: posint
234 integer(IKG) :: intSqrt
235 end function
236#endif
237
238#if IK2_ENABLED
239 PURE elemental module function getSqrtBin_IK2(posint, method) result(intSqrt)
240#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
241 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtBin_IK2
242#endif
243 use pm_kind, only: IKG => IK2
244 type(binary_type) , intent(in) :: method
245 integer(IKG) , value :: posint
246 integer(IKG) :: intSqrt
247 end function
248#endif
249
250#if IK1_ENABLED
251 PURE elemental module function getSqrtBin_IK1(posint, method) result(intSqrt)
252#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
253 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtBin_IK1
254#endif
255 use pm_kind, only: IKG => IK1
256 type(binary_type) , intent(in) :: method
257 integer(IKG) , value :: posint
258 integer(IKG) :: intSqrt
259 end function
260#endif
261
262 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263
264#if IK5_ENABLED
265 PURE elemental module function getSqrtLin_IK5(posint, method) result(intSqrt)
266#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
267 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtLin_IK5
268#endif
269 use pm_kind, only: IKG => IK5
270 type(linear_type) , intent(in) :: method
271 integer(IKG) , value :: posint
272 integer(IKG) :: intSqrt
273 end function
274#endif
275
276#if IK4_ENABLED
277 PURE elemental module function getSqrtLin_IK4(posint, method) result(intSqrt)
278#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
279 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtLin_IK4
280#endif
281 use pm_kind, only: IKG => IK4
282 type(linear_type) , intent(in) :: method
283 integer(IKG) , value :: posint
284 integer(IKG) :: intSqrt
285 end function
286#endif
287
288#if IK3_ENABLED
289 PURE elemental module function getSqrtLin_IK3(posint, method) result(intSqrt)
290#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
291 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtLin_IK3
292#endif
293 use pm_kind, only: IKG => IK3
294 type(linear_type) , intent(in) :: method
295 integer(IKG) , value :: posint
296 integer(IKG) :: intSqrt
297 end function
298#endif
299
300#if IK2_ENABLED
301 PURE elemental module function getSqrtLin_IK2(posint, method) result(intSqrt)
302#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
303 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtLin_IK2
304#endif
305 use pm_kind, only: IKG => IK2
306 type(linear_type) , intent(in) :: method
307 integer(IKG) , value :: posint
308 integer(IKG) :: intSqrt
309 end function
310#endif
311
312#if IK1_ENABLED
313 PURE elemental module function getSqrtLin_IK1(posint, method) result(intSqrt)
314#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
315 !DEC$ ATTRIBUTES DLLEXPORT :: getSqrtLin_IK1
316#endif
317 use pm_kind, only: IKG => IK1
318 type(linear_type) , intent(in) :: method
319 integer(IKG) , value :: posint
320 integer(IKG) :: intSqrt
321 end function
322#endif
323
324 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325
326 end interface
327
328!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329
330end module pm_mathSqrt
Generate and return the integer square root of an input non-negative integer.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter IK3
Definition: pm_kind.F90:368
integer, parameter IK1
Definition: pm_kind.F90:382
integer, parameter IK2
Definition: pm_kind.F90:375
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 IK4
Definition: pm_kind.F90:361
integer, parameter IK5
Definition: pm_kind.F90:354
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
This module contains procedures and generic interfaces for computing the square root of integers.
Definition: pm_mathSqrt.F90:67
character(*, SK), parameter MODULE_NAME
Definition: pm_mathSqrt.F90:75
This module contains abstract and concrete derived types that are required for compile-time resolutio...
Definition: pm_search.F90:50
type(linear_type), parameter linear
This is a scalar parameter object of type linear_type that is exclusively used to request linear sear...
Definition: pm_search.F90:131
type(binary_type), parameter binary
This is a scalar parameter object of type binary_type that is exclusively used to request binary sear...
Definition: pm_search.F90:184
This is a concrete derived type whose instances are exclusively used to request binary search algorit...
Definition: pm_search.F90:163
This is a concrete derived type whose instances are exclusively used to request linear search algorit...
Definition: pm_search.F90:110