Skip to content

Commit 31d4914

Browse files
committed
use isempty
1 parent a8892a0 commit 31d4914

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/host/linalg.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function LinearAlgebra.transpose!(B::AbstractGPUMatrix, A::AbstractGPUVector)
1414
end
1515
function LinearAlgebra.adjoint!(B::AbstractGPUVector, A::AbstractGPUMatrix)
1616
axes(B,1) == axes(A,2) && axes(A,1) == 1:1 || throw(DimensionMismatch("adjoint"))
17-
length(A) == 0 && return B
17+
isempty(A) && return B
1818
@kernel function adjoint_kernel!(B, A)
1919
idx = @index(Global, Linear)
2020
@inbounds B[idx] = adjoint(A[1, idx])
@@ -24,7 +24,7 @@ function LinearAlgebra.adjoint!(B::AbstractGPUVector, A::AbstractGPUMatrix)
2424
end
2525
function LinearAlgebra.adjoint!(B::AbstractGPUMatrix, A::AbstractGPUVector)
2626
axes(B,2) == axes(A,1) && axes(B,1) == 1:1 || throw(DimensionMismatch("adjoint"))
27-
length(A) == 0 && return B
27+
isempty(A) && return B
2828
@kernel function adjoint_kernel!(B, A)
2929
idx = @index(Global, Linear)
3030
@inbounds B[1, idx] = adjoint(A[idx])
@@ -38,7 +38,7 @@ LinearAlgebra.adjoint!(B::AnyGPUArray, A::AnyGPUArray) = transpose_f!(adjoint, B
3838
function transpose_f!(f, B::AnyGPUMatrix{T}, A::AnyGPUMatrix{T}) where T
3939
axes(B,1) == axes(A,2) && axes(B,2) == axes(A,1) || throw(DimensionMismatch(string(f)))
4040
# array with size zero dimension
41-
length(A) == 0 && return B
41+
isempty(A) && return B
4242
@kernel function transpose_kernel!(B, A)
4343
idx = @index(Global, Cartesian)
4444
@inbounds B[idx[2], idx[1]] = f(A[idx[1], idx[2]])

0 commit comments

Comments
 (0)