Giter Site home page Giter Site logo

leonfoks / coretran Goto Github PK

View Code? Open in Web Editor NEW
92.0 9.0 12.0 5.04 MB

An easy to follow library to make Fortran easier in general with wrapped interfaces, sorting routines, kD-Trees, and other algorithms to handle scientific data and concepts. The library contains core fortran routines and object-oriented classes.

License: BSD 3-Clause "New" or "Revised" License

CMake 1.82% Fortran 97.40% C 0.77%
fortran fortran-routines sorting-algorithms kdtrees ford modern object-oriented scientific-computing

coretran's People

Contributors

anjohan avatar leonfoks avatar pnorton-usgs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coretran's Issues

ProgressBar seems nonfunctional

In module ProgressBar_Class, public :: set is commented out, as well as the subsequent lines.
As a result, the sample code provided at the head of ProgressBar_Class.f90 fails on the line call P%set(N, time = .false.) because "set’ at (1) is not a member of the ‘progressbar’ structure".

Is there a modification to the sample code envisioned, or is this dead code?

Uncommenting the codes leads to compile errors: set_i1_progressbar’ and ‘set_id1_progressbar’ for GENERIC ‘set’ at (1) are ambiguous and set_i1_progressbar’ must be a module procedure or an external procedure with an explicit interface at (1) etc.

cannot compile sm_rngChiSq.f90

c:\fortran\public_domain\coretran>gfortran -c --verbose sm_rngChiSq.f90
Built by Equation Solution http://www.Equation.com.
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-w64-mingw32
Configured with: ../gcc-8-20180408-mingw/configure --host=x86_64-w64-mingw32 --build=x86_64-unknown-linux-gnu --target=x86_64-w64-mingw32 --prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gcc/8-20180408 --with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/8-20171217 --with-gcc --with-gnu-ld --with-gnu-as --with-ld64=no --with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gmp --with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpfr --with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpc --with-cloog=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/cloog --with-diagnostics-color=auto --enable-cloog-backend=isl --enable-targets=i686-w64-mingw32,x86_64-w64-mingw32 --enable-lto --enable-languages=c,c++,fortran --enable-threads=win32 --enable-static --enable-shared=lto-plugin --enable-plugins --enable-ld=yes --enable-libquadmath --enable-libquadmath-support --enable-libgomp --disable-checking --disable-nls --disable-tls --disable-win32-registry
Thread model: win32
gcc version 8.0.1 20180408 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-c' '-v' '-mtune=generic' '-march=x86-64'
c:/equation/bin/../libexec/gcc/x86_64-w64-mingw32/8.0.1/f951.exe sm_rngChiSq.f90 -quiet -dumpbase sm_rngChiSq.f90 -mtune=generic -march=x86-64 -auxbase sm_rngChiSq -version -fintrinsic-modules-path c:/equation/bin/../lib/gcc/x86_64-w64-mingw32/8.0.1/finclude -o C:\Users\vivek\AppData\Local\Temp\ccEor6Qq.s
GNU Fortran (GCC) version 8.0.1 20180408 (experimental) (x86_64-w64-mingw32)
compiled by GNU C version 8.0.0 20171217 (experimental), GMP version 6.1.2, MPFR version 3.1.4, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (GCC) version 8.0.1 20180408 (experimental) (x86_64-w64-mingw32)
compiled by GNU C version 8.0.0 20171217 (experimental), GMP version 6.1.2, MPFR version 3.1.4, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
sm_rngChiSq.f90:19:18:

module procedure rngChisq_d1!(this,ndf,first)
1
Error: MODULE PROCEDURE at (1) must be in a generic module interface
sm_rngChiSq.f90:26:43:

call rngGamma(this,half*dble(ndf), first)
1
Error: Unexpected CALL statement in CONTAINS section at (1)
sm_rngChiSq.f90:27:19:

this = two * this
1
Error: Unexpected assignment statement in CONTAINS section at (1)
sm_rngChiSq.f90:28:5:

end procedure
1
Error: Expecting END SUBMODULE statement at (1)
sm_rngChiSq.f90:31:18:

module procedure rngChisq_d1D!(this,ndf,first)
1
Error: MODULE PROCEDURE at (1) must be in a generic module interface
sm_rngChiSq.f90:36:16:

integer :: i,N
1
Error: Unexpected data declaration statement in CONTAINS section at (1)
sm_rngChiSq.f90:37:14:

N=size(this)
1
Error: Unexpected assignment statement in CONTAINS section at (1)
sm_rngChiSq.f90:38:34:

call rngChisq(this(1),ndf,first)
1
Error: Unexpected CALL statement in CONTAINS section at (1)
sm_rngChiSq.f90:39:10:

do i=2,N
1
Error: Unexpected DO statement in CONTAINS section at (1)
sm_rngChiSq.f90:40:38:

 call rngChisq(this(i),ndf,.false.)
                                  1

Error: Unexpected CALL statement in CONTAINS section at (1)
sm_rngChiSq.f90:41:5:

end do
1
Error: Expecting END SUBMODULE statement at (1)
sm_rngChiSq.f90:42:5:

end procedure
1
Error: Expecting END SUBMODULE statement at (1)

Does `dDynamicArray` allow us to remove multiple elements at the same time?

Hi, @leonfoks

I'm testing the functionalities of idDynamicArray_Class. And I know that I can remove one element of an array by using idDynamicArray%remove(index), where index is an integer.

What I want to know is that whether dDynamicArray allows us to remove multiple elements at the same time.
For example, I have an array called array_a = (/ 12, 36, 48, 24, 6, 8 /), and I want to delete array_a(1), array_a(4) and array_a(5). Is there any way to achieve this goal?

Add a release

This is a request to git tag a release of coretran.

Mean example is too verbose

I understand the advantage of demonstrating the power of coretran on a very simple example, however the native Fortran code for the mean example is unnecessarily verbose and misrepresents the level of verbosity of Fortran. The following can make it much more succinct:

  • No need to explicitly allocate - use automatic allocation on assignment.
  • No need to explicitly deallocate at the end of the program - let the array get cleaned-up by the compiler.
  • No need to explicitly re-cast integer to real - let the compiler do the type coercion.

The equivalent and correct example:

program theMean_program
use, intrinsic :: iso_fortran_env, only: real64, int32
implicit none
real(real64), allocatable :: a(:)
real(real64) :: theMean
integer(int32) :: i, istat, N
N=1000

! Create numbers from 1 to N
a = [(real(i,kind=real64), i=1,N)]

! Compute the mean
theMean = sum(a)/N

end program

Build with gfortran 9.3

With gfortran 9.3, building coretran fails on Linux and macOS.

Here's a sample traceback on macOS:

[ 50%] Building Fortran object CMakeFiles/coretran.dir/sorting/m_select.f90.o
[ 51%] Building Fortran object CMakeFiles/coretran.dir/maths/m_maths.f90.o
[ 52%] Building Fortran object CMakeFiles/coretran.dir/maths/sm_maths_d1D.f90.o
[ 54%] Building Fortran object CMakeFiles/coretran.dir/maths/sm_maths_i1D.f90.o
/Users/mpiper/projects/coretran/src/maths/sm_maths_i1D.f90:1:18:

    1 | submodule (m_maths) sm_maths_i1D
      |                  1
......
    4 | use m_allocate, only: allocate
      |                              2
Error: Symbol ‘allocate’ at (1) conflicts with the symbol at (2)
/Users/mpiper/projects/coretran/src/maths/sm_maths_i1D.f90:1:18:

    1 | submodule (m_maths) sm_maths_i1D
      |                  1
......
    5 | use m_deallocate, only: deallocate
      |                                  2
Error: Symbol ‘deallocate’ at (1) conflicts with the symbol at (2)
/Users/mpiper/projects/coretran/src/maths/sm_maths_i1D.f90:1:18:

    1 | submodule (m_maths) sm_maths_i1D
      |                  1
......
    6 | use m_errors, only:eMsg
      |                       2
Error: Symbol ‘emsg’ at (1) conflicts with the symbol at (2)
/Users/mpiper/projects/coretran/src/maths/sm_maths_i1D.f90:1:18:

    1 | submodule (m_maths) sm_maths_i1D
      |                  1
......
    7 | use m_sort, only: argsort
      |                         2
Error: Symbol ‘argsort’ at (1) conflicts with the symbol at (2)
/Users/mpiper/projects/coretran/src/maths/sm_maths_i1D.f90:1:18:

    1 | submodule (m_maths) sm_maths_i1D
      |                  1
......
    8 | use m_select, only: argSelect
      |                             2
Error: Symbol ‘argselect’ at (1) conflicts with the symbol at (2)
/Users/mpiper/projects/coretran/src/maths/sm_maths_i1D.f90:1:18:

    1 | submodule (m_maths) sm_maths_i1D
      |                  1
......
    9 | use m_array1D, only: arange
      |                           2
Error: Symbol ‘arange’ at (1) conflicts with the symbol at (2)

lines too long in m_tests.f90

I am using GNU Fortran (GCC) 8.0.1 20180408 (experimental) on Windows 10.

c:\fortran\public_domain\coretran>gfortran -c m_tests.f90
m_tests.f90:424:132:

call test%test(all(da%i%values(1:3) == [30, 20, 10]) .and. all(da%v%values(1:3) == [30.d0, 20.d0, 10.d0]), 'dArgDynamicArray%prepend')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:424:110:

call test%test(all(da%i%values(1:3) == [30, 20, 10]) .and. all(da%v%values(1:3) == [30.d0, 20.d0, 10.d0]), 'dArgDynamicArray%prepend')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:426:132:

call test%test(all(da%i%values(1:4) == [30, 20, 10, 40]) .and. all(da%v%values(1:4) == [30.d0, 20.d0, 10.d0, 40.d0]), 'dArgDynamicArray%append')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:426:121:

call test%test(all(da%i%values(1:4) == [30, 20, 10, 40]) .and. all(da%v%values(1:4) == [30.d0, 20.d0, 10.d0, 40.d0]), 'dArgDynamicArray%append')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:428:132:

call test%test(all(da%i%values(1:3) == [30, 10, 40]) .and. all(da%v%values(1:3) == [30.d0, 10.d0, 40.d0]), 'dArgDynamicArray%remove')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:428:110:

call test%test(all(da%i%values(1:3) == [30, 10, 40]) .and. all(da%v%values(1:3) == [30.d0, 10.d0, 40.d0]), 'dArgDynamicArray%remove')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:443:132:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSorted')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:443:103:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSorted')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:449:132:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:449:103:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:451:132:

call test%test(all(da%i%values(1:4)==[3, 4, 1, 2]) .and. all(da%v%values(1:4)==[10.d0, 15.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:451:113:

call test%test(all(da%i%values(1:4)==[3, 4, 1, 2]) .and. all(da%v%values(1:4)==[10.d0, 15.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:459:132:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSorted')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:459:103:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSorted')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:465:132:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:465:103:

call test%test(all(da%i%values(1:3)==[3, 1, 2]) .and. all(da%v%values(1:3)==[10.d0, 20.d0, 30.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:467:132:

call test%test(all(da%i%values(1:3)==[3, 4, 1]) .and. all(da%v%values(1:3)==[10.d0, 15.d0, 20.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:467:103:

call test%test(all(da%i%values(1:3)==[3, 4, 1]) .and. all(da%v%values(1:3)==[10.d0, 15.d0, 20.d0]), 'dArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:497:132:

call test%test(all(ida%i%values(1:4) == [30, 20, 10, 40]) .and. all(ida%v%values(1:4) == [30, 20, 10, 40]), 'iArgDynamicArray%append')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:497:111:

call test%test(all(ida%i%values(1:4) == [30, 20, 10, 40]) .and. all(ida%v%values(1:4) == [30, 20, 10, 40]), 'iArgDynamicArray%append')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:520:132:

call test%test(all(ida%i%values(1:3)==[3, 1, 2]) .and. all(ida%v%values(1:3)==[10, 20, 30]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:520:132:

call test%test(all(ida%i%values(1:3)==[3, 1, 2]) .and. all(ida%v%values(1:3)==[10, 20, 30]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Syntax error in argument list at (1)
m_tests.f90:522:132:

call test%test(all(ida%i%values(1:4)==[3, 4, 1, 2]) .and. all(ida%v%values(1:4)==[10, 15, 20, 30]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:522:103:

call test%test(all(ida%i%values(1:4)==[3, 4, 1, 2]) .and. all(ida%v%values(1:4)==[10, 15, 20, 30]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:536:132:

call test%test(all(ida%i%values(1:3)==[3, 1, 2]) .and. all(ida%v%values(1:3)==[10, 20, 30]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:536:132:

call test%test(all(ida%i%values(1:3)==[3, 1, 2]) .and. all(ida%v%values(1:3)==[10, 20, 30]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Syntax error in argument list at (1)
m_tests.f90:538:132:

call test%test(all(ida%i%values(1:3)==[3, 4, 1]) .and. all(ida%v%values(1:3)==[10, 15, 20]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:538:132:

call test%test(all(ida%i%values(1:3)==[3, 4, 1]) .and. all(ida%v%values(1:3)==[10, 15, 20]), 'iArgDynamicArray%insertSortedUnique')
1
Error: Syntax error in argument list at (1)
m_tests.f90:564:132:

call test%test(all(idda%i%values(1:2) == [20_i64, 10_i64]) .and. all(idda%v%values(1:2) == [20_i64, 10_i64]), 'idArgDynamicArray%insert')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:564:113:

call test%test(all(idda%i%values(1:2) == [20_i64, 10_i64]) .and. all(idda%v%values(1:2) == [20_i64, 10_i64]), 'idArgDynamicArray%insert')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:566:132:

call test%test(all(idda%i%values(1:3) == [30_i64, 20_i64, 10_i64]) .and. all(idda%v%values(1:3) == [30_i64, 20_i64, 10_i64]), 'idArgDynamicArray%prepend')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:566:129:

call test%test(all(idda%i%values(1:3) == [30_i64, 20_i64, 10_i64]) .and. all(idda%v%values(1:3) == [30_i64, 20_i64, 10_i64]), 'idArgDynamicArray%prepend')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:568:132:

call test%test(all(idda%i%values(1:4) == [30_i64, 20_i64, 10_i64, 40_i64]) .and. all(idda%v%values(1:4) == [30_i64, 20_i64, 10_i64, 40_i64]), 'idArgDynamicArray%append')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:568:132:

call test%test(all(idda%i%values(1:4) == [30_i64, 20_i64, 10_i64, 40_i64]) .and. all(idda%v%values(1:4) == [30_i64, 20_i64, 10_i64, 40_i64]), 'idArgDynamicArray%append')
1
Error: Syntax error in array constructor at (1)
m_tests.f90:570:132:

call test%test(all(idda%i%values(1:3) == [30_i64, 10_i64, 40_i64]) .and. all(idda%v%values(1:3) == [30_i64, 10_i64, 40_i64]), 'idArgDynamicArray%remove')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:570:129:

call test%test(all(idda%i%values(1:3) == [30_i64, 10_i64, 40_i64]) .and. all(idda%v%values(1:3) == [30_i64, 10_i64, 40_i64]), 'idArgDynamicArray%remove')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:585:132:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSorted')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:585:110:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSorted')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:591:132:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:591:110:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:593:132:

call test%test(all(idda%i%values(1:4)==[3, 4, 1, 2]) .and. all(idda%v%values(1:4)==[10_i64, 15_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:593:121:

call test%test(all(idda%i%values(1:4)==[3, 4, 1, 2]) .and. all(idda%v%values(1:4)==[10_i64, 15_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:601:132:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSorted')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:601:110:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSorted')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:607:132:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:607:110:

call test%test(all(idda%i%values(1:3)==[3, 1, 2]) .and. all(idda%v%values(1:3)==[10_i64, 20_i64, 30_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:609:132:

call test%test(all(idda%i%values(1:3)==[3, 4, 1]) .and. all(idda%v%values(1:3)==[10_i64, 15_i64, 20_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:609:110:

call test%test(all(idda%i%values(1:3)==[3, 4, 1]) .and. all(idda%v%values(1:3)==[10_i64, 15_i64, 20_i64]), 'idArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:637:132:

call test%test(all(rda%i%values(1:3) == [30, 20, 10]) .and. all(rda%v%values(1:3) == [30.0, 20.0, 10.0]), 'rArgDynamicArray%prepend')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:637:109:

call test%test(all(rda%i%values(1:3) == [30, 20, 10]) .and. all(rda%v%values(1:3) == [30.0, 20.0, 10.0]), 'rArgDynamicArray%prepend')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:639:132:

call test%test(all(rda%i%values(1:4) == [30, 20, 10, 40]) .and. all(rda%v%values(1:4) == [30.0, 20.0, 10.0, 40.0]), 'rArgDynamicArray%append')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:639:119:

call test%test(all(rda%i%values(1:4) == [30, 20, 10, 40]) .and. all(rda%v%values(1:4) == [30.0, 20.0, 10.0, 40.0]), 'rArgDynamicArray%append')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:641:132:

call test%test(all(rda%i%values(1:3) == [30, 10, 40]) .and. all(rda%v%values(1:3) == [30.0, 10.0, 40.0]), 'rArgDynamicArray%remove')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:641:109:

call test%test(all(rda%i%values(1:3) == [30, 10, 40]) .and. all(rda%v%values(1:3) == [30.0, 10.0, 40.0]), 'rArgDynamicArray%remove')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:656:132:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSorted')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:656:132:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSorted')
1
Error: Syntax error in argument list at (1)
m_tests.f90:662:132:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:662:102:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:664:132:

call test%test(all(rda%i%values(1:4)==[3, 4, 1, 2]) .and. all(rda%v%values(1:4)==[10.0, 15.0, 20.0, 30.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:664:111:

call test%test(all(rda%i%values(1:4)==[3, 4, 1, 2]) .and. all(rda%v%values(1:4)==[10.0, 15.0, 20.0, 30.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:672:132:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSorted')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:672:132:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSorted')
1
Error: Syntax error in argument list at (1)
m_tests.f90:678:132:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:678:102:

call test%test(all(rda%i%values(1:3)==[3, 1, 2]) .and. all(rda%v%values(1:3)==[10.0, 20.0, 30.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:680:132:

call test%test(all(rda%i%values(1:3)==[3, 4, 1]) .and. all(rda%v%values(1:3)==[10.0, 15.0, 20.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:680:102:

call test%test(all(rda%i%values(1:3)==[3, 4, 1]) .and. all(rda%v%values(1:3)==[10.0, 15.0, 20.0]), 'rArgDynamicArray%insertSortedUnique')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1039:132:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - sqrt(c1D(ia1D(1:10)))) <= 1.d-15), '2D - KdTreeSearch%kNearest, k nearest')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1039:112:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - sqrt(c1D(ia1D(1:10)))) <= 1.d-15), '2D - KdTreeSearch%kNearest, k nearest')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1048:132:

call test%test(all(da%i%values == ia1D(1:15)) .and. all(abs(da%v%values - (c1D(1:15))) <= 1.d-15), '2D - KdTreeSearch%kNearest, radius search')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1048:102:

call test%test(all(da%i%values == ia1D(1:15)) .and. all(abs(da%v%values - (c1D(1:15))) <= 1.d-15), '2D - KdTreeSearch%kNearest, radius search')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1052:132:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - (c1D(1:10))) <= 1.d-15), '2D - KdTreeSearch%kNearest, k radius search')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1052:102:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - (c1D(1:10))) <= 1.d-15), '2D - KdTreeSearch%kNearest, k radius search')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1093:132:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - sqrt(d1D(ia1D(1:10)))) <= 1.d-15), '3D - KdTreeSearch%kNearest')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1093:112:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - sqrt(d1D(ia1D(1:10)))) <= 1.d-15), '3D - KdTreeSearch%kNearest')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1101:132:

call test%test(all(da%i%values == ia1D(1:15)) .and. all(abs(da%v%values - (d1D(1:15))) <= 1.d-15), '3D - KdTreeSearch%kNearest, radius search')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1101:102:

call test%test(all(da%i%values == ia1D(1:15)) .and. all(abs(da%v%values - (d1D(1:15))) <= 1.d-15), '3D - KdTreeSearch%kNearest, radius search')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1105:132:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - (d1D(1:10))) <= 1.d-15), '3D - KdTreeSearch%kNearest, k radius search')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1105:102:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - (d1D(1:10))) <= 1.d-15), '3D - KdTreeSearch%kNearest, k radius search')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1149:132:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - sqrt(c1D(ia1D(1:10)))) <= 1.d-15), 'KD - KdTreeSearch%kNearest')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1149:112:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - sqrt(c1D(ia1D(1:10)))) <= 1.d-15), 'KD - KdTreeSearch%kNearest')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1159:132:

call test%test(all(da%i%values == ia1D(1:15)) .and. all(abs(da%v%values - (d1D(1:15))) <= 1.d-15), 'KD - KdTreeSearch%kNearest, radius search')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1159:102:

call test%test(all(da%i%values == ia1D(1:15)) .and. all(abs(da%v%values - (d1D(1:15))) <= 1.d-15), 'KD - KdTreeSearch%kNearest, radius search')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1163:132:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - (d1D(1:10))) <= 1.d-15), 'KD - KdTreeSearch%kNearest, k radius search')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1163:102:

call test%test(all(da%i%values == ia1D(1:10)) .and. all(abs(da%v%values - (d1D(1:10))) <= 1.d-15), 'KD - KdTreeSearch%kNearest, k radius search')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1535:132:

call test%test(all(shape(a3D) == [20,20,20]) .and. all(a3D(1:10,1:10,1:10) == 3.d0) .and. all(a3D(11:20,11:20,11:20) == 0.d0),'reallocate_d3D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1535:129:

call test%test(all(shape(a3D) == [20,20,20]) .and. all(a3D(1:10,1:10,1:10) == 3.d0) .and. all(a3D(11:20,11:20,11:20) == 0.d0),'reallocate_d3D')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1550:132:

call test%test(all(shape(ia3D) == [20,20,20]) .and. all(ia3d(1:10,1:10,1:10) == 3) .and. all(ia3D(11:20,11:20,11:20) == 0),'reallocate_i3D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1550:126:

call test%test(all(shape(ia3D) == [20,20,20]) .and. all(ia3d(1:10,1:10,1:10) == 3) .and. all(ia3D(11:20,11:20,11:20) == 0),'reallocate_i3D')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1565:132:

call test%test(all(shape(iad3D) == [20,20,20]) .and. all(iad3d(1:10,1:10,1:10) == 3) .and. all(iad3D(11:20,11:20,11:20) == 0),'reallocate_id3D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1565:130:

call test%test(all(shape(iad3D) == [20,20,20]) .and. all(iad3d(1:10,1:10,1:10) == 3) .and. all(iad3D(11:20,11:20,11:20) == 0),'reallocate_id3D')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1575:132:

call test%test(all(shape(z2D) == [20,20]) .and. all(z2D(1:10,1:10) == (2.d0, 0.d0)) .and. all(z2D(11:20,11:20) == (0.d0, 0.d0)),'reallocate_c2D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1575:131:

call test%test(all(shape(z2D) == [20,20]) .and. all(z2D(1:10,1:10) == (2.d0, 0.d0)) .and. all(z2D(11:20,11:20) == (0.d0, 0.d0)),'reallocate_c2D')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1580:132:

call test%test(all(shape(z3D) == [20,20,20]) .and. all(z3D(1:10,1:10,1:10) == (3.d0, 0.d0)) .and. all(z3D(11:20,11:20,11:20) == (0.d0, 0.d0)),'reallocate_c3D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1580:132:

call test%test(all(shape(z3D) == [20,20,20]) .and. all(z3D(1:10,1:10,1:10) == (3.d0, 0.d0)) .and. all(z3D(11:20,11:20,11:20) == (0.d0, 0.d0)),'reallocate_c3D')
1
Error: Expected a right parenthesis in expression at (1)
m_tests.f90:1590:132:

call test%test(all(shape(zz2D) == [20,20]) .and. all(zz2D(1:10,1:10) == (2.d0, 0.d0)) .and. all(zz2D(11:20,11:20) == (0.d0, 0.d0)),'reallocate_z2D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1590:132:

call test%test(all(shape(zz2D) == [20,20]) .and. all(zz2D(1:10,1:10) == (2.d0, 0.d0)) .and. all(zz2D(11:20,11:20) == (0.d0, 0.d0)),'reallocate_z2D')
1
Error: Syntax error in argument list at (1)
m_tests.f90:1595:132:

call test%test(all(shape(zz3D) == [20,20,20]) .and. all(zz3D(1:10,1:10,1:10) == (3.d0, 0.d0)) .and. all(zz3D(11:20,11:20,11:20) == (0.d0, 0.d0)),'reallocate_z3D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1595:132:

call test%test(all(shape(zz3D) == [20,20,20]) .and. all(zz3D(1:10,1:10,1:10) == (3.d0, 0.d0)) .and. all(zz3D(11:20,11:20,11:20) == (0.d0, 0.d0)),'reallocate_z3D')
1
Error: Syntax error in expression at (1)
m_tests.f90:1605:132:

call test%test(all(shape(la2D) == [20,20]) .and. all(la2D(1:10,1:10) .eqv. .true.) .and. all(la2D(11:20,11:20) .eqv. .false.),'reallocate_l2D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1605:129:

call test%test(all(shape(la2D) == [20,20]) .and. all(la2D(1:10,1:10) .eqv. .true.) .and. all(la2D(11:20,11:20) .eqv. .false.),'reallocate_l2D')
1
Error: Unterminated character constant beginning at (1)
m_tests.f90:1610:132:

call test%test(all(shape(la3D) == [20,20,20]) .and. all(la3D(1:10,1:10,1:10) .eqv. .true.) .and. all(la3D(11:20,11:20,11:20) .eqv. .false.),'reallocate_l3D')
1
Error: Line truncated at (1) [-Werror=line-truncation]
m_tests.f90:1610:132:

call test%test(all(shape(la3D) == [20,20,20]) .and. all(la3D(1:10,1:10,1:10) .eqv. .true.) .and. all(la3D(11:20,11:20,11:20) .eqv. .false.),'reallocate_l3D')
1
Error: Syntax error in expression at (1)
f951.exe: some warnings being treated as errors

Mean example is broken

There are typos and illegal names in the native Fortran version of the mean which do not allow it to compile.

Below is the correct code:

program theMean_program
use, intrinsic :: iso_fortran_env, only: real64, int32
implicit none
real(real64), allocatable :: a(:)
real(real64) :: theMean
! Some parameters to handle everything
integer(int32) :: i, istat, N
N=1000

! Allocate a and check for errors
allocate(a(N), stat=istat)
if (istat /= 0) then
  stop "Could not allocate a"
endif

! Create numbers from 1 to N
a = [(real(i,kind=real64), i=1,N)]

! Compute the mean
theMean = sum(a)/real(N,kind=real64)

! Deallocate memory
deallocate(a, stat=istat)
if (istat /= 0) then
  stop "Could not deallocate a"
endif
end program

(I did not test the coretran variant)

Unable to compile with ifortran

I've tried compiling with all the versions of intels ifortran compiler which I have available on my system:

ifortran 16.0
sm_maths_d1D.f90
error 6834: Array speicifications must be given for result name, not function

ifortran 17.0, 18.3, 19.0
Errors in the make step with sm_geometry.f90 - A separate interface body must have been declared in the program unit or an ancestor of the program unit for the separate module procedure

Failed to compile the library in Linux with gfortran version using gfortran version 6.3.1

Hello, @leonfoks

Following your instructions, I typed cmake ../src in the command line, and everything is OK. Then I typed make to compile the library. However, it failed and returned to me error information as follows.

[ 81%] Building Fortran object CMakeFiles/coretran.dir/spatial/m_KdTree.f90.o
[ 83%] Building Fortran object CMakeFiles/coretran.dir/spatial/m_geometry.f90.o
[ 84%] Building Fortran object CMakeFiles/coretran.dir/spatial/sm_KdTreeBranch_class.f90.o
[ 86%] Building Fortran object CMakeFiles/coretran.dir/spatial/sm_KdTreeSearch_class.f90.o
/home/wangy/downloads/coretran/src/spatial/sm_KdTreeSearch_class.f90:1135:0:

   module procedure rangeSearch_KD!(search, tree, D, lowerBound, upperBound) result(iPoints)
 
internal compiler error: in gfc_get_symbol_decl, at fortran/trans-decl.c:1419
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
CMakeFiles/coretran.dir/build.make:731: recipe for target 'CMakeFiles/coretran.dir/spatial/sm_KdTreeSearch_class.f90.o' failed
make[2]: *** [CMakeFiles/coretran.dir/spatial/sm_KdTreeSearch_class.f90.o] Error 1
CMakeFiles/Makefile2:116: recipe for target 'CMakeFiles/coretran.dir/all' failed
make[1]: *** [CMakeFiles/coretran.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
make: *** [all] Error 2

Could you help me address this issue?

compile failed on GNU Fortran (GCC) 7.3.1 (Red Hat 7.3.1-5)

Compile failed as follows:

rmcd@localhost build]$ make
[ 1%] Building Fortran object CMakeFiles/coretran.dir/core/m_variableKind.f90.o
[ 2%] Building Fortran object CMakeFiles/coretran.dir/core/m_errors.f90.o
[ 4%] Building Fortran object CMakeFiles/coretran.dir/core/m_unitTester.f90.o
[ 5%] Building Fortran object CMakeFiles/coretran.dir/core/m_allocate.f90.o
/home/rmcd/git/coretran/src/core/m_allocate.f90:44.4:

module subroutine allocate_r1D(this, n)
1

Error: Unclassifiable statement at (1)
/home/rmcd/git/coretran/src/core/m_allocate.f90:47.11:

  real(r32), allocatable, intent(inout) :: this(:) 
       1

Error: Parameter 'r32' at (1) has not been declared or is a variable, which does not reduce to a constant expression
/home/rmcd/git/coretran/src/core/m_allocate.f90:49.14:

  integer(i32), intent(in) :: n 
          1

Error: Parameter 'i32' at (1) has not been declared or is a variable, which does not reduce to a constant expression
/home/rmcd/git/coretran/src/core/m_allocate.f90:51.7:

end subroutine
   1

Error: Expecting END INTERFACE statement at (1)

Build with shared libs off - fails with coretranTest

Building cortran with shared libs off fails with coretranTest. Build succeds with coretran but fails with the test as below. Build with sharedlibs on succeeds. Not sure if this is a cmake issue or not. Any help would be appreciated.

[ 91%] Building Fortran object CMakeFiles/coretran.dir/time/ProgressBar_Class.f90.o
[ 92%] Linking Fortran static library /home/rmcd/git/coretran/lib/libcoretran.a
[ 92%] Built target coretran
[ 94%] Linking Fortran executable /home/rmcd/git/coretran/bin/coretranTest
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lm
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lm
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -ldl
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lm
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lpthread
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [/home/rmcd/git/coretran/bin/coretranTest] Error 1
make[1]: *** [tests/CMakeFiles/coretranTest.dir/all] Error 2
make: *** [all] Error 2

dynamicArrays folder missing CMakeLists.txt

The CMakeLists.txt file appears to be missing from dynamicArrays folder. I created the file with the content below, and it compiled. Please advise if this is not the correct content.

target_sources(${libName}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/m_dynamicArray.f90"
"${CMAKE_CURRENT_LIST_DIR}/m_fixedArray.f90"
"${CMAKE_CURRENT_LIST_DIR}/sm_dDynamicArray.f90"
"${CMAKE_CURRENT_LIST_DIR}/sm_iDynamicArray.f90"
"${CMAKE_CURRENT_LIST_DIR}/sm_idDynamicArray.f90"
"${CMAKE_CURRENT_LIST_DIR}/sm_rDynamicArray.f90"
)

Random number generator is not thread safe nor has cycle skipping capabilities

Common problem with random number generators is their inability to generate independent generators on each thread, across nodes and then cycle skip. Most people simply use independent generators on each thread, each with a different seed.

A better way is to generate each with the same seed, and cycle skip according to the rank of the thread.

  • Find a Fortran xorshiftXXX based prng. Found public domain, need to check.
  • Modify to make more sense and better OOP
  • Incorporate into the random module

line too long in prng_class.f90

There is a line that is too long in prng_class.f90:

c:\fortran\public_domain\coretran>gfortran -c prng_class.f90
prng_class.f90:167:132:

generic, public :: rngExponential => rngExponential_d1_Prng_, rngExponential_d1D_Prng_, rngExponential_d2D_Prng_, rngExponential_d3D_Prng_
1
Error: Line truncated at (1) [-Werror=line-truncation]
prng_class.f90:167:38:

generic, public :: rngExponential => rngExponential_d1_Prng_, rngExponential_d1D_Prng_, rngExponential_d2D_Prng_, rngExponential_d3D_Prng_
1
Error: Undefined specific binding 'rngexponential_d' as target of GENERIC 'rngexponential' at (1)
f951.exe: some warnings being treated as errors

line too long in Stopwatch_Class.f90

c:\fortran\public_domain\coretran>gfortran -c Stopwatch_Class.f90
Stopwatch_Class.f90:219:132:

 res = trim(str(this%StopTime_(5)))//':'//trim(str(this%StopTime_(6)))//':'//trim(str(this%StopTime_(7)))//'.'//trim(str(this%StopTime_(8)))
                                                                                                                                1

Error: Line truncated at (1) [-Werror=line-truncation]
Stopwatch_Class.f90:219:132:

 res = trim(str(this%StopTime_(5)))//':'//trim(str(this%StopTime_(6)))//':'//trim(str(this%StopTime_(7)))//'.'//trim(str(this%StopTime_(8)))
                                                                                                                                1

Error: 'sto' at (1) is not a member of the 'stopwatch' structure
f951.exe: some warnings being treated as errors

Issues about the module "m_random"

Hi,

I found three possible issues when I tested "coretran" with some simple programs.

  1. Outputs of rngInteger are constants
    For testing the functionalities of rngInteger, I write the code as shown below.
       Program main
          ! Import modules
          Use variableKind, only: r64,i32
          Use m_allocate, only: allocate
          Use m_deallocate, only: deallocate
          Use m_random, only: rngInteger, rngNormal, rngUniform
    
          Implicit None
    
         ! Data dictionary: declare parameters
         Integer(i32), allocatable :: a(:)
         Integer(i32) :: N, I
    
         N = 10
    
         ! Allocate memory
         call allocate(a, N)
    
         call rngInteger(a, 1, 10)
    
         Do i = 1, N
             Write (*,*) a(i)
         End Do
    
        ! Deallocate memory
        call deallocate(a)
    
    End Program
    

And the results of this code are as shown in the figure below. Obviously, the outputs are not random numbers.
SharedScreenshot

  1. The second program is used to test the functionalities of rngNormal. And the code is shown below.
Program main
  ! Import modules
  Use variableKind, only: r64,i32
  Use m_allocate, only: allocate
  Use m_deallocate, only: deallocate
  Use m_random, only: rngInteger, rngNormal, rngUniform
  use m_array1D, only: arange
  use m_maths, only: mean, std
  
  Implicit None
  
  ! Data dictionary: declare parameters
  Real(r64), allocatable :: a(:)
  Integer(i32) :: N, i
  
  N = 10
  
  ! Allocate memory
  call allocate(a, N)
  
  call rngNormal(a)
  
  Do i = 1, N
    Write (*,*) a(i)
  End Do
  
  ! Deallocate memory
  call deallocate(a)

End Program

However, this program output nothing! To be exact, It seemed trapped in an endless cycle because my machine keeps running until I killed this program.

  1. The third example illustrates the issue about rngUniform. The code is shown below.
Program main
  ! Import modules
  Use variableKind, only: r64,i32
  Use m_allocate, only: allocate
  Use m_deallocate, only: deallocate
  Use m_random, only: rngInteger, rngNormal, rngUniform
  use m_array1D, only: arange
  use m_maths, only: mean, std
  
  Implicit None
  
  ! Data dictionary: declare parameters
  Real(r64), allocatable :: a(:)
  Integer(i32) :: N, i
  
  N = 10
  
  ! Allocate memory
  call allocate(a, N)
  
  call rngUniform(a)
  
  Do i = 1, N
    Write (*,*) a(i)
  End Do
  
  ! Deallocate memory
  call deallocate(a)


End Program

And the output of this program is shown in the figure below. I don't understand why this error appears.
SharedScreenshot_1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.