Skip to content

Commit ad4f0c0

Browse files
authored
simplify unsafe_resize in matrix resizedata (#433)
1 parent e77afea commit ad4f0c0

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/Caching/matrix.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ function resizedata!(B::CachedOperator{T,Matrix{T}},n::Integer,m::Integer) where
1111

1212
# this does nothing if already in dimensions
1313
N,M=size(B.data)
14-
if n > N && m > M
15-
B.data = unsafe_resize!(B.data,n,m)
16-
elseif n > N
17-
B.data = unsafe_resize!(B.data,n,:)
18-
elseif m > M
19-
B.data = unsafe_resize!(B.data,:,m)
14+
if !(n < N && m < M)
15+
B.data = unsafe_resize!(B.data,max(n,N),max(m,M))
2016
end
2117

2218
if n B.datasize[1] && m B.datasize[2]

src/LinearAlgebra/helper.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ function mindotu(a::AbstractVector,b::AbstractVector)
174174
end
175175

176176

177-
# efficiently resize a Matrix. Note it doesn't change the input ptr
178177
function unsafe_resize!(W::AbstractMatrix,::Colon,m::Integer)
179178
if m == size(W,2)
180179
W

0 commit comments

Comments
 (0)