@@ -4,7 +4,7 @@ module stdlib_io
4
4
! ! Provides a support for file handling
5
5
! ! ([Specification](../page/specs/stdlib_io.html))
6
6
7
- use stdlib_kinds, only: sp, dp, qp, &
7
+ use stdlib_kinds, only: sp, dp, xdp, qp, &
8
8
int8, int16, int32, int64
9
9
use stdlib_error, only: error_stop
10
10
use stdlib_optval, only: optval
@@ -22,9 +22,11 @@ module stdlib_io
22
22
FMT_INT = ' (*(i0,1x))' , &
23
23
FMT_REAL_SP = ' (*(es15.8e2,1x))' , &
24
24
FMT_REAL_DP = ' (*(es24.16e3,1x))' , &
25
+ FMT_REAL_XDP = ' (*(es26.18e3,1x))' , &
25
26
FMT_REAL_QP = ' (*(es44.35e4,1x))' , &
26
27
FMT_COMPLEX_SP = ' (*(es15.8e2,1x,es15.8e2))' , &
27
28
FMT_COMPLEX_DP = ' (*(es24.16e3,1x,es24.16e3))' , &
29
+ FMT_COMPLEX_XDP = ' (*(es26.18e3,1x,es26.18e3))' , &
28
30
FMT_COMPLEX_QP = ' (*(es44.35e4,1x,es44.35e4))'
29
31
30
32
interface loadtxt
@@ -34,14 +36,12 @@ module stdlib_io
34
36
! ! ([Specification](../page/specs/stdlib_io.html#description))
35
37
module procedure loadtxt_rsp
36
38
module procedure loadtxt_rdp
37
- module procedure loadtxt_rqp
38
39
module procedure loadtxt_iint8
39
40
module procedure loadtxt_iint16
40
41
module procedure loadtxt_iint32
41
42
module procedure loadtxt_iint64
42
43
module procedure loadtxt_csp
43
44
module procedure loadtxt_cdp
44
- module procedure loadtxt_cqp
45
45
end interface loadtxt
46
46
47
47
interface savetxt
@@ -51,14 +51,12 @@ module stdlib_io
51
51
! ! ([Specification](../page/specs/stdlib_io.html#description_2))
52
52
module procedure savetxt_rsp
53
53
module procedure savetxt_rdp
54
- module procedure savetxt_rqp
55
54
module procedure savetxt_iint8
56
55
module procedure savetxt_iint16
57
56
module procedure savetxt_iint32
58
57
module procedure savetxt_iint64
59
58
module procedure savetxt_csp
60
59
module procedure savetxt_cdp
61
- module procedure savetxt_cqp
62
60
end interface
63
61
64
62
contains
@@ -157,53 +155,6 @@ subroutine loadtxt_rdp(filename, d)
157
155
close (s)
158
156
159
157
end subroutine loadtxt_rdp
160
- subroutine loadtxt_rqp (filename , d )
161
- ! ! version: experimental
162
- ! !
163
- ! ! Loads a 2D array from a text file.
164
- ! !
165
- ! ! Arguments
166
- ! ! ---------
167
- ! !
168
- ! ! Filename to load the array from
169
- character (len=* ), intent (in ) :: filename
170
- ! ! The array 'd' will be automatically allocated with the correct dimensions
171
- real (qp), allocatable , intent (out ) :: d(:,:)
172
- ! !
173
- ! ! Example
174
- ! ! -------
175
- ! !
176
- ! !```fortran
177
- ! ! real(qp), allocatable :: data(:, :)
178
- ! ! call loadtxt("log.txt", data) ! 'data' will be automatically allocated
179
- ! !```
180
- ! !
181
- ! ! Where 'log.txt' contains for example::
182
- ! !
183
- ! ! 1 2 3
184
- ! ! 2 4 6
185
- ! ! 8 9 10
186
- ! ! 11 12 13
187
- ! ! ...
188
- ! !
189
- integer :: s
190
- integer :: nrow, ncol, i
191
-
192
- s = open (filename)
193
-
194
- ! determine number of columns
195
- ncol = number_of_columns(s)
196
-
197
- ! determine number or rows
198
- nrow = number_of_rows(s)
199
-
200
- allocate (d(nrow, ncol))
201
- do i = 1 , nrow
202
- read (s, FMT_REAL_qp) d(i, :)
203
- end do
204
- close (s)
205
-
206
- end subroutine loadtxt_rqp
207
158
subroutine loadtxt_iint8 (filename , d )
208
159
! ! version: experimental
209
160
! !
@@ -488,54 +439,6 @@ subroutine loadtxt_cdp(filename, d)
488
439
close (s)
489
440
490
441
end subroutine loadtxt_cdp
491
- subroutine loadtxt_cqp (filename , d )
492
- ! ! version: experimental
493
- ! !
494
- ! ! Loads a 2D array from a text file.
495
- ! !
496
- ! ! Arguments
497
- ! ! ---------
498
- ! !
499
- ! ! Filename to load the array from
500
- character (len=* ), intent (in ) :: filename
501
- ! ! The array 'd' will be automatically allocated with the correct dimensions
502
- complex (qp), allocatable , intent (out ) :: d(:,:)
503
- ! !
504
- ! ! Example
505
- ! ! -------
506
- ! !
507
- ! !```fortran
508
- ! ! complex(qp), allocatable :: data(:, :)
509
- ! ! call loadtxt("log.txt", data) ! 'data' will be automatically allocated
510
- ! !```
511
- ! !
512
- ! ! Where 'log.txt' contains for example::
513
- ! !
514
- ! ! 1 2 3
515
- ! ! 2 4 6
516
- ! ! 8 9 10
517
- ! ! 11 12 13
518
- ! ! ...
519
- ! !
520
- integer :: s
521
- integer :: nrow, ncol, i
522
-
523
- s = open (filename)
524
-
525
- ! determine number of columns
526
- ncol = number_of_columns(s)
527
- ncol = ncol / 2
528
-
529
- ! determine number or rows
530
- nrow = number_of_rows(s)
531
-
532
- allocate (d(nrow, ncol))
533
- do i = 1 , nrow
534
- read (s, FMT_COMPLEX_qp) d(i, :)
535
- end do
536
- close (s)
537
-
538
- end subroutine loadtxt_cqp
539
442
540
443
541
444
subroutine savetxt_rsp (filename , d )
@@ -592,33 +495,6 @@ subroutine savetxt_rdp(filename, d)
592
495
end do
593
496
close (s)
594
497
end subroutine savetxt_rdp
595
- subroutine savetxt_rqp (filename , d )
596
- ! ! version: experimental
597
- ! !
598
- ! ! Saves a 2D array into a text file.
599
- ! !
600
- ! ! Arguments
601
- ! ! ---------
602
- ! !
603
- character (len=* ), intent (in ) :: filename ! File to save the array to
604
- real (qp), intent (in ) :: d(:,:) ! The 2D array to save
605
- ! !
606
- ! ! Example
607
- ! ! -------
608
- ! !
609
- ! !```fortran
610
- ! ! real(qp) :: data(3, 2)
611
- ! ! call savetxt("log.txt", data)
612
- ! !```
613
- ! !
614
-
615
- integer :: s, i
616
- s = open (filename, " w" )
617
- do i = 1 , size (d, 1 )
618
- write (s, FMT_REAL_qp) d(i, :)
619
- end do
620
- close (s)
621
- end subroutine savetxt_rqp
622
498
subroutine savetxt_iint8 (filename , d )
623
499
! ! version: experimental
624
500
! !
@@ -781,33 +657,6 @@ subroutine savetxt_cdp(filename, d)
781
657
end do
782
658
close (s)
783
659
end subroutine savetxt_cdp
784
- subroutine savetxt_cqp (filename , d )
785
- ! ! version: experimental
786
- ! !
787
- ! ! Saves a 2D array into a text file.
788
- ! !
789
- ! ! Arguments
790
- ! ! ---------
791
- ! !
792
- character (len=* ), intent (in ) :: filename ! File to save the array to
793
- complex (qp), intent (in ) :: d(:,:) ! The 2D array to save
794
- ! !
795
- ! ! Example
796
- ! ! -------
797
- ! !
798
- ! !```fortran
799
- ! ! complex(qp) :: data(3, 2)
800
- ! ! call savetxt("log.txt", data)
801
- ! !```
802
- ! !
803
-
804
- integer :: s, i
805
- s = open (filename, " w" )
806
- do i = 1 , size (d, 1 )
807
- write (s, FMT_COMPLEX_qp) d(i, :)
808
- end do
809
- close (s)
810
- end subroutine savetxt_cqp
811
660
812
661
813
662
integer function number_of_columns (s )
0 commit comments