Skip to content

Commit 4310db5

Browse files
committed
Replace matmul with gemm.
1 parent c6857bc commit 4310db5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/stdlib_linalg_matrix_functions.fypp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES
33
submodule (stdlib_linalg) stdlib_linalg_matrix_functions
44
use stdlib_linalg_constants
5+
use stdlib_linalg_blas, only: gemm
56
use stdlib_linalg_lapack, only: gesv
67
use stdlib_linalg_state, only: linalg_state_type, linalg_error_handling, LINALG_ERROR, &
78
LINALG_INTERNAL_ERROR, LINALG_VALUE_ERROR
@@ -97,10 +98,14 @@ contains
9798
call linalg_error_handling(err0, err)
9899
end block
99100

100-
! This loop should eventually be replaced by a fast matrix_power function.
101+
! Matrix squaring.
102+
block
103+
${rt}$ :: E_tmp(n, n)
101104
do k = 1, s
102-
E = matmul(E, E)
105+
E_tmp = E
106+
call gemm("N", "N", n, n, n, one_${ri}$, E_tmp, n, E_tmp, n, zero_${ri}$, E, n)
103107
enddo
108+
end block
104109
return
105110
contains
106111
elemental subroutine handle_gesv_info(info,lda,n,nrhs,err)

0 commit comments

Comments
 (0)