Skip to content

Commit b2d2254

Browse files
committed
Removed ambiguous covar of matrix.
1 parent 40e627e commit b2d2254

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/ControlSystems.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ include("plotting.jl")
155155
@deprecate den denvec
156156
@deprecate norminf hinfnorm
157157

158+
function covar(D::Union{AbstractMatrix,UniformScaling}, R)
159+
error("This call is ambiguous, use `covar(ss(D), R)` or `covar(ss(D, Ts), R)`")
160+
end
161+
162+
158163
# The path has to be evaluated upon initial import
159164
const __CONTROLSYSTEMS_SOURCE_DIR__ = dirname(Base.source_path())
160165

src/matrix_comps.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,6 @@ end
186186

187187
covar(sys::TransferFunction, W) = covar(ss(sys), W)
188188

189-
"""
190-
covar(C,W)
191-
If `C` is a matrix, return CWC'
192-
"""
193-
covar(C::Union{AbstractMatrix,UniformScaling}, R) = C*R*C'
194-
195189

196190
# Note: the H∞ norm computation is probably not as accurate as with SLICOT,
197191
# but this seems to be still reasonably ok as a first step

test/test_matrix_comps.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ D2 = [1 0; 0 1]
3737
# Discrete system can have direct term
3838
@test covar(ss(A,B,C,D2,0.1),W) [1.00011010837831 -1.0098377309782909e-5; -1.0098377309782909e-5 1.00011010837831]
3939

40+
# Static systems
41+
R = fill(1.0,1,1)
42+
@test covar(ss(2.0), R) == fill(Inf, 1, 1)
43+
@test covar(ss(2.0, 0.2), R) == fill(4.0, 1, 1)
44+
45+
4046
# TODO test in Julia 0.7 to see if supported
4147
# # Test special matrices
4248
As = sparse(A)

0 commit comments

Comments
 (0)