diff --git a/docs/src/examples/automatic_differentiation.md b/docs/src/examples/automatic_differentiation.md index e1f9d3700..f34531a19 100644 --- a/docs/src/examples/automatic_differentiation.md +++ b/docs/src/examples/automatic_differentiation.md @@ -308,7 +308,7 @@ The following issues are currently known to exist when using AD through ControlS ### ForwardDiff [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) works for a lot of workflows without any intervention required from the user. The following known limitations exist: -- The function [`c2d`](@ref) with the default `:zoh` discretization method makes a call to `LinearAlgebra.exp!`, which is not defined for `ForwardDiff.Dual` numbers. A forward rule for this function exist in ChainRules, which can be enabled using ForwardDiffChainRules.jl, but [this PR](https://github.com/ThummeTo/ForwardDiffChainRules.jl/pull/16) must be merged and released before it will work as intended. A workaround is to use the `:tustin` method instead, or [manually defining this method](https://github.com/JuliaControl/ControlSystems.jl/blob/master/docs/src/examples/automatic_differentiation.md?plain=1#LL2C1-L25C4). +- The function [`c2d`](@ref) with the default `:zoh` discretization method makes a call to `LinearAlgebra.exp!`, which is not defined for `ForwardDiff.Dual` numbers. A forward rule for this function exist in ChainRules, which can be enabled using ForwardDiffChainRules.jl. One may also define `LinearAlgebra.exp!(A::AbstractMatrix{<:ForwardDiff.Dual}) = ExponentialUtilities.exponential!(A)`. - The function `svdvals` does not have a forward rule defined. This means that the functions [`sigma`](@ref) and `opnorm` will not work for MIMO systems with ForwardDiff. SISO, MISO and SIMO systems will, however, work. - [`hinfnorm`](@ref) requires ImplicitDifferentiation.jl and ComponentArrays.jl to be manually loaded by the user, after which there are implicit differentiation rules defined for [`hinfnorm`](@ref). The implicit rule calls `opnorm`, and is thus affected by the first limitation above for MIMO systems. [`hinfnorm`](@ref) has a reverse rule defined in RobustAndOptimalControl.jl, which is not affected by this limitation. - [`are`](@ref), [`lqr`](@ref) and [`kalman`](@ref) all require ImplicitDifferentiation.jl and ComponentArrays.jl to be manually loaded by the user, after which there are implicit differentiation rules defined. To invoke the correct method of these functions, it is important that the second matrix (corresponding to input or measurement) has the `Dual` number type, i.e., the `R` matrix in `lqr(P, Q, R)` or `lqr(Continuous, A, B, Q, R)` diff --git a/lib/ControlSystemsBase/src/ControlSystemsBase.jl b/lib/ControlSystemsBase/src/ControlSystemsBase.jl index eb3c19a0c..505e2f872 100644 --- a/lib/ControlSystemsBase/src/ControlSystemsBase.jl +++ b/lib/ControlSystemsBase/src/ControlSystemsBase.jl @@ -252,6 +252,10 @@ function __init__() print(io, " for automatic discretization (applicable to systems without delays or nonlinearities only).") elseif exc.f ∈ (eigvals!, ) && argtypes[1] <: AbstractMatrix{<:Number} printstyled(io, "\nComputing eigenvalues of a matrix with exotic element types may require `using GenericSchur`.", color=:green, bold=true) + elseif (exc.f === svdvals! || exc.f === svd!) && length(argtypes) >= 1 && argtypes[1] <: AbstractMatrix{<:Number} + printstyled(io, "\nComputing the SVD of a matrix with exotic element types may require `using GenericLinearAlgebra`.", color=:green, bold=true) + elseif exc.f === schur! && length(argtypes) >= 1 && argtypes[1] <: AbstractMatrix{<:Number} + printstyled(io, "\nComputing Schur decomposition of a matrix with exotic element types may require `using GenericSchur`.", color=:green, bold=true) end plots_id = Base.PkgId(UUID("91a5bcdd-55d7-5caf-9e0b-520d859cae80"), "Plots") if exc.f isa Function && nameof(exc.f) === :plot && parentmodule(argtypes[1]) == @__MODULE__() && !haskey(Base.loaded_modules, plots_id) diff --git a/lib/ControlSystemsBase/test/runtests.jl b/lib/ControlSystemsBase/test/runtests.jl index b34220383..a39dc8566 100644 --- a/lib/ControlSystemsBase/test/runtests.jl +++ b/lib/ControlSystemsBase/test/runtests.jl @@ -12,6 +12,11 @@ using Aqua ) end +BIGMAT = big(1.0)*randn(3,3) +@test_throws MethodError svd(BIGMAT) +@test_throws MethodError eigvals(BIGMAT) +@test_throws MethodError schur(BIGMAT) + include("framework.jl")