@@ -6,7 +6,13 @@ module stdlib_experimental_quadrature
6
6
implicit none
7
7
8
8
private
9
- public :: trapz, trapz_weights
9
+
10
+ ! array integration
11
+ public :: trapz
12
+ public :: trapz_weights
13
+ public :: simps
14
+ public :: simps_weights
15
+
10
16
11
17
interface trapz
12
18
#:for KIND in REAL_KINDS
@@ -25,6 +31,7 @@ module stdlib_experimental_quadrature
25
31
#:endfor
26
32
end interface trapz
27
33
34
+
28
35
interface trapz_weights
29
36
#:for KIND in REAL_KINDS
30
37
pure module function trapz_weights_${KIND}$(x) result(w)
@@ -34,4 +41,35 @@ module stdlib_experimental_quadrature
34
41
#:endfor
35
42
end interface trapz_weights
36
43
44
+
45
+ interface simps
46
+ #:for KIND in REAL_KINDS
47
+ pure module function simps_dx_${KIND}$(y, dx, even) result(integral)
48
+ real(${KIND}$), dimension(:), intent(in) :: y
49
+ real(${KIND}$), intent(in) :: dx
50
+ integer, intent(in), optional :: even
51
+ real(${KIND}$) :: integral
52
+ end function simps_dx_${KIND}$
53
+ #:endfor
54
+ #:for KIND in REAL_KINDS
55
+ pure module function simps_x_${KIND}$(y, x, even) result(integral)
56
+ real(${KIND}$), dimension(:), intent(in) :: y
57
+ real(${KIND}$), dimension(size(y)), intent(in) :: x
58
+ integer, intent(in), optional :: even
59
+ real(${KIND}$) :: integral
60
+ end function simps_x_${KIND}$
61
+ #:endfor
62
+ end interface simps
63
+
64
+
65
+ interface simps_weights
66
+ #:for KIND in REAL_KINDS
67
+ pure module function simps_weights_${KIND}$(x, even) result(w)
68
+ real(${KIND}$), dimension(:), intent(in) :: x
69
+ real(${KIND}$), dimension(size(x)) :: w
70
+ integer, intent(in), optional :: even
71
+ end function simps_weights_${KIND}$
72
+ #:endfor
73
+ end interface simps_weights
74
+
37
75
end module stdlib_experimental_quadrature
0 commit comments