Skip to content

Commit 2bb4c2b

Browse files
committed
generalize MatrixAlgebra.one! implementation
1 parent 1df93b8 commit 2bb4c2b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/auxiliary/linalg.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,9 @@ else
7575
end
7676

7777
# TODO: define for CuMatrix if we support this
78-
function one!(A::DenseMatrix)
79-
Threads.@threads for j in 1:size(A, 2)
80-
@simd for i in 1:size(A, 1)
81-
@inbounds A[i, j] = i == j
82-
end
83-
end
78+
function one!(A::StridedMatrix)
79+
length(A) > 0 || return A
80+
copyto!(A, LinearAlgebra.I)
8481
return A
8582
end
8683

0 commit comments

Comments
 (0)