diff options
-rw-r--r-- | src/dotmath.F90 | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/dotmath.F90 b/src/dotmath.F90 index bb1725b..81f1f13 100644 --- a/src/dotmath.F90 +++ b/src/dotmath.F90 @@ -38,5 +38,55 @@ MODULE dotmat 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 + integer :: i, j + + allocate(C(size(A, 1), size(B, 2))) + + DO j = 1, size(B, 2) + DO i = 1, size(A, 1) + + C(i,j) = dot_product(A(i,:), B(:,j)) + END DO + END DO + + END FUNCTION dotmull_4 + + 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 + integer :: i, j + + allocate(C(size(A, 1), size(B, 2))) + + DO j = 1, size(B, 2) + DO i = 1, size(A, 1) + + C(i,j) = dot_product(A(i,:), B(:,j)) + END DO + END DO + + END FUNCTION dotmull_8 + 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 + integer :: i, j + + allocate(C(size(A, 1), size(B, 2))) + + DO j = 1, size(B, 2) + DO i = 1, size(A, 1) + + C(i,j) = dot_product(A(i,:), B(:,j)) + END DO + END DO + + END FUNCTION dotmull_16 + END MODULE dotmat |