Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand test_loadtxt to huge and tiny numbers and update savetxt/loadtxt edit descriptors #90

Merged
merged 24 commits into from
Sep 4, 2021
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cfb472f
add comment suggested in issue 492
Aug 28, 2021
43a3da1
make the default INSTALL_PREFIX clearer in the documentation
Aug 28, 2021
b22f2d1
fix incorrect statement about default location
Aug 28, 2021
12da563
Merge pull request #501 from gareth-nx/pr/doc_updates
milancurcic Aug 28, 2021
0e88261
Merge remote-tracking branch 'upstream/test' into test
milancurcic Aug 29, 2021
c193450
Port test_open.f90 to test-drive
milancurcic Aug 29, 2021
5824208
Port test_parse_mode.f90 to test-drive
milancurcic Aug 29, 2021
c7ae718
Add private attribute
milancurcic Aug 30, 2021
917da6e
Port test_savetxt.f90 to test-drive
milancurcic Aug 30, 2021
b92b60b
Port test_savetxt_qp.f90 to test-drive
milancurcic Aug 30, 2021
f0f3478
Port test_loadtxt.f90 to test-drive
milancurcic Aug 30, 2021
08f10c3
Add complex data test to test_loadtxt.f90
milancurcic Aug 30, 2021
2ef8724
Port test_loadtxt_qp.f90 to test-drive
milancurcic Aug 30, 2021
ff8bf75
Fix indent in Makefile
milancurcic Aug 30, 2021
b0aedd3
Clean all test artifacts in Makefile.manual
milancurcic Aug 30, 2021
4e8894d
Fix error handling in test_loadtxt
milancurcic Aug 31, 2021
c2acb91
Don't reuse output file names between tests
milancurcic Aug 31, 2021
85d6e58
Use portable formats in savetxt and loadtxt
milancurcic Sep 1, 2021
3890ea9
Update tests for savetxt and loadtxt; compare exact values, not appro…
milancurcic Sep 1, 2021
693b885
Remove unused variable
milancurcic Sep 1, 2021
843a7cc
Update edit descriptors for savetxt and loadtxt; Small fix in number_…
milancurcic Sep 4, 2021
e026dc4
Tests loadtxt with tiny and huge numbers
milancurcic Sep 4, 2021
8dbfcc8
Resolve conflicts against awvwgk:test
milancurcic Sep 4, 2021
18b0cd2
Compare arrays exactly in test_savetxt_qp.f90
milancurcic Sep 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update edit descriptors for savetxt and loadtxt; Small fix in number_…
…of_rows() to make ifort happy
milancurcic committed Sep 4, 2021
commit 843a7ccba73701a570662264d557fc6a2bb4b905
38 changes: 13 additions & 25 deletions src/stdlib_io.fypp
Original file line number Diff line number Diff line change
@@ -22,12 +22,12 @@ module stdlib_io
! Format strings with edit descriptors for each type and kind
character(*), parameter :: &
FMT_INT = '(*(i0,1x))', &
FMT_REAL_SP = '(*(es15.8,1x))', &
FMT_REAL_DP = '(*(es23.16,1x))', &
FMT_REAL_QP = '(*(es42.35,1x))', &
FMT_COMPLEX_SP = '(*(es15.8,1x,es15.8))', &
FMT_COMPLEX_DP = '(*(es23.16,1x,es23.16))', &
FMT_COMPLEX_QP = '(*(es42.35,1x,es42.35))'
FMT_REAL_SP = '(*(es15.8e2,1x))', &
FMT_REAL_DP = '(*(es24.16e3,1x))', &
FMT_REAL_QP = '(*(es44.35e4,1x))', &
FMT_COMPLEX_SP = '(*(es15.8e2,1x,es15.8e2))', &
FMT_COMPLEX_DP = '(*(es24.16e3,1x,es24.16e3))', &
FMT_COMPLEX_QP = '(*(es44.35e4,1x,es44.35e4))'

interface loadtxt
!! version: experimental
@@ -93,7 +93,7 @@ contains
#:endif

! determine number or rows
nrow = number_of_rows_numeric(s)
nrow = number_of_rows(s)

allocate(d(nrow, ncol))
do i = 1, nrow
@@ -174,36 +174,24 @@ contains
end function number_of_columns


integer function number_of_rows_numeric(s) result(nrows)
integer function number_of_rows(s) result(nrows)
!! version: experimental
!!
!! determine number or rows
integer,intent(in)::s
!! Determine the number or rows in a file
integer, intent(in)::s
integer :: ios

real :: r
complex :: z

rewind(s)
nrows = 0
do
read(s, *, iostat=ios) r
read(s, *, iostat=ios)
if (ios /= 0) exit
nrows = nrows + 1
end do

rewind(s)

! If there are no rows of real numbers, it may be that they are complex
if( nrows == 0) then
do
read(s, *, iostat=ios) z
if (ios /= 0) exit
nrows = nrows + 1
end do
rewind(s)
end if
end function number_of_rows_numeric
end function number_of_rows


integer function open(filename, mode, iostat) result(u)
@@ -341,4 +329,4 @@ contains

end function parse_mode

end module
end module stdlib_io