aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bettermath.F9059
1 files changed, 59 insertions, 0 deletions
diff --git a/src/bettermath.F90 b/src/bettermath.F90
index 4b64c54..e2c0773 100644
--- a/src/bettermath.F90
+++ b/src/bettermath.F90
@@ -38,5 +38,64 @@ MODULE bettmat
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
+ integer :: i, j, k
+
+ allocate(C(size(A, 1), size(B, 2)))
+ C = 0
+
+ DO j = 1, size(B(1,:))
+ DO k = 1, size(A(1,:))
+ DO i = 1, size(A(:,1))
+
+ C(i,j) = C(i,j) + A(i,k) * B(k,j)
+ END DO
+ END DO
+ END DO
+
+ END FUNCTION bettmull_4
+
+ 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
+ integer :: i, j, k
+
+ allocate(C(size(A, 1), size(B, 2)))
+ C = 0
+
+ DO j = 1, size(B(1,:))
+ DO k = 1, size(A(1,:))
+ DO i = 1, size(A(:,1))
+
+ C(i,j) = C(i,j) + A(i,k) * B(k,j)
+ END DO
+ END DO
+ END DO
+
+ END FUNCTION bettmull_8
+ 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
+ integer :: i, j, k
+
+ allocate(C(size(A, 1), size(B, 2)))
+ C = 0
+
+ DO j = 1, size(B(1,:))
+ DO k = 1, size(A(1,:))
+ DO i = 1, size(A(:,1))
+
+ C(i,j) = C(i,j) + A(i,k) * B(k,j)
+ END DO
+ END DO
+ END DO
+
+ END FUNCTION bettmull_16
+
END MODULE bettmat