From a9245d4fa33ce7e0a681300540d4ec675a1e688a Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 23 Apr 2019 22:57:27 +0200 Subject: specify array shape in declaration --- src/bettermath.F90 | 9 +++------ src/dotmath.F90 | 12 +++--------- src/naivemath.F90 | 9 +++------ 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/bettermath.F90 b/src/bettermath.F90 index c77bedf..091eb9c 100644 --- a/src/bettermath.F90 +++ b/src/bettermath.F90 @@ -41,10 +41,9 @@ CONTAINS FUNCTION bettmull_4(A, B) result(C) IMPLICIT none real(kind=4), intent(in), dimension(1:,1:) :: A, B - real(kind=4), dimension(:,:), allocatable :: C + real(kind=4), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j, k - allocate(C(size(A, 1), size(B, 2))) C = 0 DO j = 1, size(B, 2) @@ -61,10 +60,9 @@ CONTAINS FUNCTION bettmull_8(A, B) result(C) IMPLICIT none real(kind=8), intent(in), dimension(1:,1:) :: A, B - real(kind=8), dimension(:,:), allocatable :: C + real(kind=8), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j, k - allocate(C(size(A, 1), size(B, 2))) C = 0 DO j = 1, size(B, 2) @@ -81,10 +79,9 @@ CONTAINS FUNCTION bettmull_16(A, B) result(C) IMPLICIT none real(kind=16), intent(in), dimension(1:,1:) :: A, B - real(kind=16), dimension(:,:), allocatable :: C + real(kind=16), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j, k - allocate(C(size(A, 1), size(B, 2))) C = 0 DO j = 1, size(B, 2) diff --git a/src/dotmath.F90 b/src/dotmath.F90 index 81f1f13..eeeee45 100644 --- a/src/dotmath.F90 +++ b/src/dotmath.F90 @@ -41,11 +41,9 @@ CONTAINS FUNCTION dotmull_4(A, B) result(C) IMPLICIT none real(kind=4), intent(in), dimension(1:,1:) :: A, B - real(kind=4), dimension(:,:), allocatable :: C + real(kind=4), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j - allocate(C(size(A, 1), size(B, 2))) - DO j = 1, size(B, 2) DO i = 1, size(A, 1) @@ -58,11 +56,9 @@ CONTAINS FUNCTION dotmull_8(A, B) result(C) IMPLICIT none real(kind=8), intent(in), dimension(1:,1:) :: A, B - real(kind=8), dimension(:,:), allocatable :: C + real(kind=8), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j - allocate(C(size(A, 1), size(B, 2))) - DO j = 1, size(B, 2) DO i = 1, size(A, 1) @@ -75,11 +71,9 @@ CONTAINS FUNCTION dotmull_16(A, B) result(C) IMPLICIT none real(kind=16), intent(in), dimension(1:,1:) :: A, B - real(kind=16), dimension(:,:), allocatable :: C + real(kind=16), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j - allocate(C(size(A, 1), size(B, 2))) - DO j = 1, size(B, 2) DO i = 1, size(A, 1) diff --git a/src/naivemath.F90 b/src/naivemath.F90 index 47acaad..c0382f3 100644 --- a/src/naivemath.F90 +++ b/src/naivemath.F90 @@ -41,10 +41,9 @@ CONTAINS FUNCTION naivmull_4(A, B) result(C) IMPLICIT none real(kind=4), intent(in), dimension(1:,1:) :: A, B - real(kind=4), dimension(:,:), allocatable :: C + real(kind=4), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j, k - allocate(C(size(A, 1), size(B, 2))) C = 0 DO i = 1, size(A, 1) @@ -61,10 +60,9 @@ CONTAINS FUNCTION naivmull_8(A, B) result(C) IMPLICIT none real(kind=8), intent(in), dimension(1:,1:) :: A, B - real(kind=8), dimension(:,:), allocatable :: C + real(kind=8), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j, k - allocate(C(size(A, 1), size(B, 2))) C = 0 DO i = 1, size(A, 1) @@ -81,10 +79,9 @@ CONTAINS FUNCTION naivmull_16(A, B) result(C) IMPLICIT none real(kind=16), intent(in), dimension(1:,1:) :: A, B - real(kind=16), dimension(:,:), allocatable :: C + real(kind=16), dimension(size(A, 1), size(B, 2)) :: C integer :: i, j, k - allocate(C(size(A, 1), size(B, 2))) C = 0 DO i = 1, size(A, 1) -- cgit v1.2.3