Skip to content

Commit

Permalink
Update src/stdlib_linalg_pinv.fypp
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz authored Dec 18, 2024
1 parent 3d10d39 commit 38bae4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stdlib_linalg_pinv.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ submodule(stdlib_linalg) stdlib_linalg_pseudoinverse
! Get pseudo-inverse: A_pinv = V * (diag(1/s) * U^H) = V * (U * diag(1/s))^H

! 1) compute (U * diag(1/s)) in-place
forall (i=1:m,j=1:k) u(i,j) = s(j)*u(i,j)
do concurrent (i=1:m,j=1:k); u(i,j) = s(j)*u(i,j); end do

! 2) commutate matmul: A_pinv = V^H * (U * diag(1/s))^H = ((U * diag(1/s)) * V^H)^H.
! This avoids one matrix transpose
Expand Down

0 comments on commit 38bae4d

Please sign in to comment.