Operations on periodic matrices
Base.:-
— Method-(A)
Unary minus operator.
Base.inv
— Functioninv(A)
Periodic matrix inversion. Computes the periodic matrix Ainv
such that A * Ainv = Ainv*A = I
, where I
is the identity matrix.
Base.transpose
— Functiontranspose(A)
Transpose of a periodic matrix.
Base.adjoint
— Functionadjoint(A) or A'
Adjoint of a periodic matrix (equivalent to transpose).
LinearAlgebra.opnorm
— Functionopnorm(A,p::Real=2) -> Anorm
Compute the point-wise time-dependent operator norm (or matrix norm) induced by the vector p
-norm, where valid values of p
are 1
, 2
, or Inf
. For a periodic matrix A(t)
, the resulting Anorm(t)
is a periodic vector of same type as A
, such that Anorm(t)
is the p
-norm of A(t)
for each t
.
LinearAlgebra.tr
— Functiontr(A) -> Atr
Compute the point-wise trace of periodic matrix. For a periodic matrix A(t)
, the resulting Atr(t)
is a periodic vector of same type as A
, such that Atr(t)
is the trace of A(t)
for each t
.
Base.:+
— Function+(A, B)
Periodic matrix addition. One of arguments may be a constant matrix or a uniform scaling. A
and B
may have different, but commensurate periods.
When adding continuous-time periodic mtrices, if one of arguments is of type PeriodicFunctionMatrix
, then the result is also of type PeriodicFunctionMatrix
.
Base.:-
— Method-(A, B)
Periodic matrix substraction. One of arguments may be a constant matrix or a uniform scaling. A
and B
may have different, but commensurate periods.
When substracting continuous-time periodic mtrices, if one of arguments is of type PeriodicFunctionMatrix
, then the result is also of type PeriodicFunctionMatrix
.
Base.:*
— Function*(A, B)
Periodic matrix multiplication. One of arguments may be a constant matrix, a scalar or a uniform scaling. A
and B
may have different, but commensurate periods.
Whenmultiplying continuous-time periodic mtrices, if one of arguments is of type PeriodicFunctionMatrix
, then the result is also of type PeriodicFunctionMatrix
.
PeriodicMatrices.pmcopy
— Functionpmcopy(A)
Create a copy of the periodic matrix A
.
PeriodicMatrices.horzcat
— Functionhorzcat(A, B)
hcat(A,B)
Horizontal concatenation of two periodic matrices. Equivalent to the syntax [A B]
. A
and B
may have different, but commensurate periods. One of arguments may be a constant matrix.
PeriodicMatrices.vertcat
— Functionvertcat(A, B)
vcat(A,B)
Vertical concatenation of two periodic matrices. Equivalent to the syntax [A; B]
. A
and B
may have different, but commensurate periods.
PeriodicMatrices.blockdiag
— Functionblockdiag(A, B)
Block diagonal appending of two periodic matrices. A
and B
may have different, but commensurate periods.
PeriodicMatrices.blockut
— Functionblockut(A, B, C) -> D
Block upper triangular appending of periodic matrices A
, B
and C
. The resulting D
is constructed as D = [A B; 0 C]
. A
, B
and C
may have different, but commensurate periods.
Base.iszero
— Functioniszero(A)
Exact equality check with a zero periodic matrix.
PeriodicMatrices.isconstant
— Functionisconstant(A)
isconstant(A::PeriodicFunctionMatrix; check_const = false, atol = 1000*eps(), rtol = sqrt(eps()) )
Constancy check of a periodic matrix. For a periodic function matrix A(t)
, an optional optimization-based constancy check can be performed using check_const = true
, with the absolute and relative tolerances atol
and rtol
, respectively.
Base.isequal
— Functionisequal(A, B)
Exact equality check of two periodic matries. isequal(A,B)
is equivalent to the syntax A == B
. A
and B
must have equal subperiods.
Base.isapprox
— Functionisapprox(A, B; rtol::Real = sqrt(eps(Float64)), atol::Real = 0)
Inexact equality comparison of two periodic matries. isaprox(A,B)
is equivalent to the syntax A ≈ B
. A
and B
must have equal subperiods. One of arguments may be an uniform scaling.
atol
and rtol
are the absolute tolerance and relative tolerance, respectively, to be used for comparison.
LinearAlgebra.issymmetric
— Functionissymmetric(A)
Symmetry check of a periodic matrix.
Operations on continuous-time periodic matrices
LinearAlgebra.norm
— Methodnorm(A, p::Real=2)
norm(A::PeriodicFunctionMatrix, p::Real=2; rtol=sqrt(eps()), atol = 1000*eps())
Compute the p
-norm of the time-dependent Frobenius-norm of a continuous-time periodic matrix over one period. For a continuous-time periodic matrix A(t)
, the resulting Anorm
is the p
-norm of the time-varying Frobenius norm of A(t)
. The involved time integrals are evaluated using the adaptive Gauss-Kronrod quadrature with a relative error tolerance rtol
and an absolute tolerance atol
. For p = Inf
, the computation involves the minimization of the Frobenius norm of A(t)
using Brent's method.
Note: For periodic matrices of PeriodicTimeSeriesMatrix
and PeriodicSwitchingMatrix
types, the existing implicit time griding is employed to evaluate the involved time integrals using the rectangle method.
PeriodicMatrices.trace
— Methodtrace(A; rtol=sqrt(eps)) -> Atrace
Compute the trace of a continuous-time periodic matrix over one period. For a continuous-time periodic matrix A(t)
, the resulting Atrace
is the mean value of the integral of the point-wise trace over a complete period. The involved time integral are evaluated using the adaptive Gauss-Kronrod quadrature with a relative error tolerance rtol
.
PeriodicMatrices.pmderiv
— Functionpmderiv(A::PeriodicFunctionMatrix; h:Union{Real,Missing} = missing, method = "cd", discont = false)
pmderiv(A::PeriodicTimeSeriesMatrix; h:Union{Real,Missing} = missing, method = "cd", discont = false)
pmderiv(A::PeriodicSwitchingMatrix; h:Union{Real,Missing} = missing, method = "cd", discont = false)
Compute the derivative of a continuous-time periodic matrix using finite difference formulas. By default method = "cd"
, in which case the central difference formula is used for approximating the derivative. If method = "4d"
, a fourth order finite difference formula is used for higher accuracy. If method = ""
, the forward difference formula is used if the time difference h
is missing or h > 0
, and a backward difference formula is used if h < 0
. If discont = true
, then initial discountinuities at t = 0
and terminal discountinuities at tsub := A.period/A.nperiod
(the subperiod) are avoided by using the forward or backward differentiation formulas at t = 0
and at t = tsub
, respectively. This approach generally leads to lower accuracy estimations at t = 0
and t = tsub
.
Note: To allow the application of the finite difference approximations to periodic matrices of types PeriodicTimeSeriesMatrix
and PeriodicSwitchingMatrix
, these are converted to PeriodicFunctionMatrix
type. Due to inherent discountinuities of these representations, the accuracy of derivate estimations is usualy poor. To increase the accuracy, it is recommended to perform these conversions before calling the pmderiv
function, by employing splines based interpolation formulas, as provided by the function ts2pfm
.
pmderiv(A::HarmonicArray)
Compute the derivative of a continuous-time periodic matrix in harmonic represention.
PeriodicMatrices.pmrand
— Methodpmrand(::Type{PM}, n, m[, period = 2pi]; nh = 1)
pmrand(::Type{PM{:c,T}}, n, m[, period = 2pi]; nh = 1)
pmrand(n, m[, period = 2pi]; nh = 1)
pmrand(PeriodicTimeSeriesMatrix, n, m[, period = 2pi]; ns = 1)
pmrand(PeriodicTimeSeriesMatrix{:c,T}, n, m[, period = 2pi]; ns = 1)
pmrand(PeriodicSwitchingMatrix, n, m[, period = 2pi]; ts = [0])
pmrand(PeriodicSwitchingMatrix{:c,T}, n, m[, period = 2pi]; ts = [0])
Generate a random n×m
continuous-time periodic matrix of type PM
or PM{:c,T}
with period period
(default: period = 2pi
). PM
specifies the resulting type of the generated periodic matrix. For PM = HarmonicArray
, or PM = PeriodicFunctionMatrix
, or PM = PeriodicSymbolicMatrix
or PM = FourierFunctionMatrix
, the resulting periodic matrix corresponds to a random harmonic representation with nh
harmonic components (default: nh = 1
). The type T
of matrix elements can be specified using, e.g. HarmonicArray{:c,T}
instead HarmonicArray
, which assumes by default T = Float64
. If PM
is omitted, then by default PM = HarmonicArray
.
For PM = PeriodicTimeSeriesMatrix
, ns
specifies the number of component matrices.
For PM = PeriodicSwitchingMatrix
, the vector ts
specifies the switching times.
Operations on discrete-time periodic matrices
Base.reverse
— Functionreverse(A)
Reverse the order of elements of a discrete-time periodic matrix.
LinearAlgebra.norm
— Methodnorm(A,p::Real=2) -> Anorm
Compute the Frobenius-norm of a discrete-time periodic matrix. For a discrete-time periodic matrix A(t)
, the resulting Anorm
is the p
-norm of the vector of Frobenius norms of each component of A
.
PeriodicMatrices.trace
— Methodtrace(A) -> Atrace
Compute the trace of periodic matrix. For a periodic matrix A(t)
, the resulting Atrace
is the sum of point-wise traces over a complete period (see tr
.
PeriodicMatrices.pmshift
— Functionpmshift(A[,k = 1])
Circular shifting of the components of a discrete-time periodic matrix A
with k
positions.
PeriodicMatrices.pmsymadd!
— Functionpmsymadd!(A, α = 1)
Compute for a discrete-time periodic matrix A
the symmetric matrix α*(A+A')
in place.
PeriodicMatrices.pmata
— Functionpmata(A)
Compute for a discrete-time periodic matrix A
the symmetric matrix transpose(A)*A
.
Note: This function is available only for periodic matrices of types PeriodicArray
and PeriodicMatrix
.
PeriodicMatrices.pmaat
— Functionpmaat(A)
Compute for a discrete-time periodic matrix A
the symmetric matrix A*transpose(A)
.
Note: This function is available only for periodic matrices of types PeriodicArray
and PeriodicMatrix
.
PeriodicMatrices.pmrand
— Methodpmrand(::Type{PM}, n::Int, m::Int[, period = 10]; ns = 1)
pmrand(::Type{PM{:d,T}}, n::Int, m::Int[, period = 10]; ns = 1)
pmrand(::Type{PM}, n::Vector{Int}, m::Vector{Int}[, period = 1])
pmrand(SwitchingPeriodicMatrix, n, m[, period = 10]; ns = [period])
pmrand(SwitchingPeriodicArray, n, m[, period = 10]; ns = [period])
Generate a random n×m
discrete-time periodic matrix of type PM
or PM{:d,T}
with period period
(default: period = 10
) with ns
component matrices (default: ns = 1
). If PM = PeriodicMatrix
or PM = PeriodicArray
, ns
specifies the number of component matrices (default: ns = 10
). If PM = PeriodicMatrix
, then two integer vectors n
and m
containing the row and column dimensions of the the component matrices, respectively, can be used to specify periodic matrices with time-varying dimensions.
If PM = SwitchingPeriodicMatrix
or PM = SwitchingPeriodicArray
, the integer vector ns
specifies the switching moments (default: ns = [period]). The type
Tof matrix elements can be specified using, e.g.
PeriodicMatrix{:d,T}instead
PeriodicMatrix, which assumes by default
T = Float64`.
pmrand([::Type{T},] m::Vector{Int},n::Vector{Int}[, period = 10])
Generate a random discrete-time periodic matrix of type PeriodicMatrix
with period period
(default: period = 10
). The time-varying row and column dimensions of component matrices are specified by the integer vectors m
and n
, respectively. T
is the type of matrix elements, which assumes by default value T = Float64
if omitted.
PeriodicMatrices.pmrand
— Methodpmrand([::Type{T},] m::Vector{Int},n::Vector{Int}[, period = 10])
Generate a random discrete-time periodic matrix of type PeriodicMatrix
with period period
(default: period = 10
). The time-varying row and column dimensions of component matrices are specified by the integer vectors m
and n
, respectively. T
is the type of matrix elements, which assumes by default value T = Float64
if omitted.
Operations with symmetric periodic matrices
PeriodicMatrices.pmmulsym
— Functionpmmulsym(B, C, β)
Compute the symmetric periodic matrix β*B*C
, where β
is a real scalar and the product B*C
is known to be symmetric. All matrix arguments may be constant matrices as well.
Note: This function is available only for periodic matrices of types PeriodicArray
, PeriodicMatrix
, PeriodicFunctionMatrix
and HarmonicArray
.
PeriodicMatrices.pmtrmulsym
— Functionpmtrmulsym(B, C, β)
Compute the symmetric periodic matrix β*B'*C
, where β
is a real scalar and the product B'*C
is known to be symmetric. All matrix arguments may be constant matrices as well.
Note: This function is available only for periodic matrices of types PeriodicArray
, PeriodicMatrix
, PeriodicFunctionMatrix
and HarmonicArray
.
PeriodicMatrices.pmmultrsym
— Functionpmmultrsym(B, C, β)
Compute the symmetric periodic matrix β*B*C'
, where β
is a real scalar and the product B*C'
is known to be symmetric. All matrix arguments may be constant matrices as well.
Note: This function is available only for periodic matrices of types PeriodicArray
, PeriodicMatrix
, PeriodicFunctionMatrix
and HarmonicArray
.
PeriodicMatrices.pmmuladdsym
— Functionpmmuladdsym(A, B, C, α, β)
Compute the symmetric periodic matrix α*A + β*B*C
, where α
and β
are real scalars, A
is a symmetrix periodic matrix and the product B*C
is known to be symmetric. All matrix arguments may be constant matrices as well.
Note: This function is available only for periodic matrices of types PeriodicArray
, PeriodicMatrix
, PeriodicFunctionMatrix
and HarmonicArray
.
PeriodicMatrices.pmmultraddsym
— Functionpmmultraddsym(A, B, C, α, β)
Compute the symmetric periodic matrix α*A + β*B'*C
, where α
and β
are real scalars, A
is a symmetrix periodic matrix and the product B'*C
is known to be symmetric. All matrix arguments may be constant matrices as well.
Note: This function is available only for periodic matrices of types PeriodicArray
, PeriodicMatrix
, PeriodicFunctionMatrix
and HarmonicArray
.
PeriodicMatrices.pmmuladdtrsym
— Functionpmmuladdtrsym(A, B, C, α, β)
Compute the symmetric periodic matrix α*A + β*B*C'
, where α
and β
are real scalars, A
is a symmetrix periodic matrix and the product B*C'
is known to be symmetric. All matrix arguments may be constant matrices as well.
Note: This function is available only for periodic matrices of types PeriodicArray
, PeriodicMatrix
, PeriodicFunctionMatrix
and HarmonicArray
.