Skip to content

Commit

Permalink
Fix errors due to the enhanced DescriptorStateSpace object
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasvarga committed Jun 22, 2024
1 parent cb6fd45 commit db137e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DescriptorSystems"
uuid = "a81e2ce2-54d1-11eb-2c75-db236b00f339"
authors = ["Andreas Varga <varga.andreas@gmail.com>"]
version = "1.4.2"
version = "1.4.3"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## Version 1.4.3

Some fixes of errors originating from the enhanced definition of the `DescriptorStateSpace` object.

## Version 1.4.2

Enhanced definition of the `DescriptorStateSpace` object.
Expand Down
11 changes: 4 additions & 7 deletions src/connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ function hcat(SYS1::DescriptorStateSpace{T1, TE1}, SYS2::DescriptorStateSpace{T2
D = [ T.(SYS1.D) T.(SYS2.D)]
return DescriptorStateSpace{T}(A, E, B, C, D, Ts)
end
#hcat(SYS :: DescriptorStateSpace, MAT :: AbstractNumOrArray) = hcat(SYS,dss(MAT,Ts=SYS.Ts))
hcat(SYS :: DescriptorStateSpace{T} where T, MAT :: Union{Number, AbstractVecOrMat{<:Number}}) = hcat(SYS,dss(MAT,Ts=SYS.Ts))
#hcat(MAT :: AbstractNumOrArray, SYS :: DescriptorStateSpace) = hcat(dss(MAT,Ts=SYS.Ts),SYS)
hcat(MAT :: Union{Number, AbstractVecOrMat{<:Number}}, SYS :: DescriptorStateSpace) = hcat(dss(MAT,Ts=SYS.Ts),SYS)
hcat(SYS :: DescriptorStateSpace{T}, MAT :: Union{Number, AbstractVecOrMat{<:Number}}) where {T} = hcat(SYS,dss(promote_type(T,eltype(MAT)).(MAT),Ts=SYS.Ts))
hcat(MAT :: Union{Number, AbstractVecOrMat{<:Number}}, SYS :: DescriptorStateSpace{T}) where {T} = hcat(dss(promote_type(T,eltype(MAT)).(MAT),Ts=SYS.Ts),SYS)
hcat(SYS :: DescriptorStateSpace, MAT :: UniformScaling) = hcat(SYS,dss(Matrix{promote_type(eltype(SYS),eltype(MAT))}(MAT,SYS.ny,SYS.ny),Ts=SYS.Ts))
hcat(MAT :: UniformScaling, SYS :: DescriptorStateSpace) = hcat(dss(Matrix{promote_type(eltype(SYS),eltype(MAT))}(MAT,SYS.ny,SYS.ny),Ts=SYS.Ts),SYS)

Expand Down Expand Up @@ -209,9 +207,8 @@ function vcat(SYS1::DescriptorStateSpace{T1, TE1}, SYS2::DescriptorStateSpace{T2
return DescriptorStateSpace{T}(A, E, B, C, D, Ts)
end

vcat(SYS :: DescriptorStateSpace, MAT :: Union{Number, AbstractVecOrMat{<:Number}}) = vcat(SYS,dss(MAT,Ts=SYS.Ts))
#vcat(MAT :: AbstractNumOrArray, SYS :: DescriptorStateSpace) = vcat(dss(MAT,Ts=SYS.Ts),SYS)
vcat(MAT :: Union{Number, AbstractVecOrMat{<:Number}}, SYS :: DescriptorStateSpace) = vcat(dss(MAT,Ts=SYS.Ts),SYS)
vcat(SYS :: DescriptorStateSpace{T}, MAT :: Union{Number, AbstractVecOrMat{<:Number}}) where {T} = vcat(SYS,dss(promote_type(T,eltype(MAT)).(MAT),Ts=SYS.Ts))
vcat(MAT :: Union{Number, AbstractVecOrMat{<:Number}}, SYS :: DescriptorStateSpace{T}) where {T} = vcat(dss(promote_type(T,eltype(MAT)).(MAT),Ts=SYS.Ts),SYS)
vcat(SYS :: DescriptorStateSpace, MAT :: UniformScaling) = vcat(SYS,dss(Matrix{promote_type(eltype(SYS),eltype(MAT))}(MAT,SYS.nu,SYS.nu),Ts=SYS.Ts))
vcat(MAT :: UniformScaling, SYS :: DescriptorStateSpace) = vcat(dss(Matrix{promote_type(eltype(SYS),eltype(MAT))}(MAT,SYS.nu,SYS.nu),Ts=SYS.Ts),SYS)

Expand Down
3 changes: 2 additions & 1 deletion src/dsutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# covers the case when a vector represents the row of a matrix
to_matrix(T, A::AbstractVector, wide::Bool = false) = wide ? Matrix{T}(reshape(A, 1, length(A))) : Matrix{T}(reshape(A, length(A), 1))
#to_matrix(T, A::AbstractMatrix, wide::Bool = false) = Matrix{T}(A) # Fallback
to_matrix(T, A::AbstractMatrix, wide::Bool = false) = T.(A) # Fallback
#to_matrix(T, A::AbstractMatrix, wide::Bool = false) = T.(A) # Fallback
to_matrix(T, A::AbstractMatrix, wide::Bool = false) = AbstractMatrix{T}(A) # Fallback
# to_matrix(T, A::SparseMatrixCSC, wide::Bool = false) = T.(A) # Fallback for sparse matrices
to_matrix(T, A::Number, wide::Bool = true) = fill(T(A), 1, 1)
# Handle Adjoint Matrices
Expand Down

2 comments on commit db137e9

@andreasvarga
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/109569

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.4.3 -m "<description of version>" db137e9df1ae4fb3c7632a77d1a8aa3d3bfac395
git push origin v1.4.3

Please sign in to comment.