aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-04-23 22:57:27 +0200
committerWojtek Kosior <kwojtus@protonmail.com>2019-04-23 22:57:27 +0200
commita9245d4fa33ce7e0a681300540d4ec675a1e688a (patch)
tree5f2b787d5d8c43b32a53cb62d97d536454cd172c
parente328b72fd7d407b42ad49e40f6ea6fd0041d562a (diff)
downloadfortran-assignment1-a9245d4fa33ce7e0a681300540d4ec675a1e688a.tar.gz
fortran-assignment1-a9245d4fa33ce7e0a681300540d4ec675a1e688a.zip
specify array shape in declaration
-rw-r--r--src/bettermath.F909
-rw-r--r--src/dotmath.F9012
-rw-r--r--src/naivemath.F909
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)