Skip to content

Commit 3901cab

Browse files
committed
use explicit-shape-arrays instead
1 parent 92e3525 commit 3901cab

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/stdlib_linalg.fypp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ module stdlib_linalg
8989
!! Computes the cross product of two vectors, returning a rank-1 and size-3 array
9090
!! ([Specification](../page/specs/stdlib_linalg.html#cross_product-computes-the-cross-product-of-two-3-d-vectors))
9191
#:for k1, t1 in RCI_KINDS_TYPES
92-
module function cross_product_${t1[0]}$${k1}$(a, b) result(res)
93-
${t1}$, intent(in) :: a(:), b(:)
92+
pure module function cross_product_${t1[0]}$${k1}$(a, b) result(res)
93+
${t1}$, intent(in) :: a(3), b(3)
9494
${t1}$ :: res(3)
9595
end function cross_product_${t1[0]}$${k1}$
9696
#:endfor

src/stdlib_linalg_cross_product.fypp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ submodule (stdlib_linalg) stdlib_linalg_cross_product
77
contains
88

99
#:for k1, t1 in RCI_KINDS_TYPES
10-
module function cross_product_${t1[0]}$${k1}$(a, b) result(res)
11-
${t1}$, intent(in) :: a(:), b(:)
10+
pure module function cross_product_${t1[0]}$${k1}$(a, b) result(res)
11+
${t1}$, intent(in) :: a(3), b(3)
1212
${t1}$ :: res(3)
1313

14-
if (size(a) /= 3 .or. size(b) /= 3) &
15-
call error_stop("The size of a and b should be 3.")
16-
1714
res(1) = a(2) * b(3) - a(3) * b(2)
1815
res(2) = a(3) * b(1) - a(1) * b(3)
1916
res(3) = a(1) * b(2) - a(2) * b(1)

0 commit comments

Comments
 (0)