Skip to content

Commit d3ad693

Browse files
authored
Fix Matrix constructors (#542)
1 parent cd5585f commit d3ad693

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/LinearAlgebra/lyap.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ end
1010
# where P,R,S and T are upper triangular
1111
function lyapuptriang(P,R,S,T,F::AbstractArray{N}) where N
1212
m=size(P,2); n = size(T,2)
13-
Y=Matrix{N}(m,n)
14-
PY = Matrix{N}(m,n); SY = Matrix{N}(m,n)
13+
Y=Matrix{N}(undef,m,n)
14+
PY = Matrix{N}(undef,m,n)
15+
SY = Matrix{N}(undef,m,n)
1516

1617
k=n
1718
while k > 1
@@ -24,7 +25,8 @@ function lyapuptriang(P,R,S,T,F::AbstractArray{N}) where N
2425
end
2526

2627
Y[:,k] = (R[k,k]*P + T[k,k]*S)\rhs
27-
PY[:,k] = P*Y[:,k];SY[:,k] = S*Y[:,k]
28+
PY[:,k] = P*Y[:,k]
29+
SY[:,k] = S*Y[:,k]
2830

2931
k -= 1
3032
else
@@ -34,7 +36,7 @@ function lyapuptriang(P,R,S,T,F::AbstractArray{N}) where N
3436
rhs2[l] -= R[k,j]*PY[l,j] + T[k,j]*SY[l,j]
3537
end
3638

37-
SM = Matrix{N}(2m,2m)
39+
SM = Matrix{N}(undef,2m,2m)
3840

3941
for i=1:m,j=1:m
4042
SM[i,j] = R[k-1,k-1]*P[i,j] + T[k-1,k-1]*S[i,j]

src/Multivariate/VectorFun.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ norm(A::VectorFun, p::Real) = norm(norm.(Array(A)),p)
147147

148148
function coefficientmatrix(::Type{N},f::AbstractVector{F},o...) where {N,F}
149149
if isempty(f)
150-
return Matrix{N}(0,0)
150+
return Matrix{N}(undef,0,0)
151151
end
152152

153153
n=mapreduce(ncoefficients,max,f)

0 commit comments

Comments
 (0)