Skip to content

Commit 6f93e38

Browse files
committed
Remove lnspace, add support for int types in linspace
1 parent 501f360 commit 6f93e38

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/stdlib_math_linspace.fypp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#:include "common.fypp"
2-
#:set RANKS = range(1, MAXRANK + 1)
3-
#:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES
42
submodule (stdlib_math) stdlib_math_linspace
53

64
implicit none
@@ -52,7 +50,7 @@ contains
5250

5351

5452
#:for k1, t1 in CMPLX_KINDS_TYPES
55-
#:set RName = rname("clinspace_default", 1, t1, k1)
53+
#:set RName = rname("linspace_default", 1, t1, k1)
5654
module procedure ${RName}$
5755

5856
res = linspace(start, end, DEFAULT_LINSPACE_LENGTH)
@@ -61,18 +59,36 @@ contains
6159
#:endfor
6260

6361
#:for k1, t1 in CMPLX_KINDS_TYPES
64-
#:set RName = rname("clinspace_n", 1, t1, k1)
62+
#:set RName = rname("linspace_n", 1, t1, k1)
6563
module procedure ${RName}$
6664

6765
real(${k1}$) :: x(n) ! array of the real part of complex number
6866
real(${k1}$) :: y(n) ! array of the imaginary part of the complex number
6967

70-
x = linspace(real(start), real(end), n)
71-
y = linspace(aimag(start), aimag(end), n)
68+
x = linspace(start%re, end%re, n)
69+
y = linspace(start%im, end%im, n)
7270

7371
res = cmplx(x, y, kind=${k1}$)
7472

7573
end procedure ${RName}$
7674
#:endfor
7775

76+
#:for k1, t1 in INT_KINDS_TYPES
77+
#:set RName = rname("linspace_default", 1, t1, k1)
78+
module procedure ${RName}$
79+
80+
res = linspace(real(start, kind=dp), real(end, kind=dp), DEFAULT_LINSPACE_LENGTH)
81+
82+
end procedure ${RName}$
83+
#:endfor
84+
85+
#:for k1, t1 in INT_KINDS_TYPES
86+
#:set RName = rname("linspace_n", 1, t1, k1)
87+
module procedure ${RName}$
88+
89+
res = linspace(real(start, kind=dp), real(end, kind=dp), n)
90+
91+
end procedure ${RName}$
92+
#:endfor
93+
7894
end submodule

0 commit comments

Comments
 (0)