Operations on periodic matrices

Base.invFunction
inv(A)

Periodic matrix inversion. Computes the periodic matrix Ainv such that A * Ainv = Ainv*A = I, where I is the identity matrix.

source
Base.adjointFunction
adjoint(A) or A'

Adjoint of a periodic matrix (equivalent to transpose).

source
LinearAlgebra.opnormFunction
opnorm(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.

source
LinearAlgebra.trFunction
tr(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.

source
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.

source
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.

source
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.

source
PeriodicMatrices.horzcatFunction
horzcat(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.

source
PeriodicMatrices.vertcatFunction
vertcat(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.

source
PeriodicMatrices.blockdiagFunction
blockdiag(A, B)

Block diagonal appending of two periodic matrices. A and B may have different, but commensurate periods.

source
PeriodicMatrices.blockutFunction
blockut(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.

source
Base.iszeroFunction
iszero(A)

Exact equality check with a zero periodic matrix.

source
PeriodicMatrices.isconstantFunction
isconstant(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.

source
Base.isequalFunction
isequal(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.

source
Base.isapproxFunction
isapprox(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.

source

Operations on continuous-time periodic matrices

LinearAlgebra.normMethod
norm(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.

source
PeriodicMatrices.traceMethod
trace(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.

source
PeriodicMatrices.pmderivFunction
pmderiv(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.

source
pmderiv(A::HarmonicArray)

Compute the derivative of a continuous-time periodic matrix in harmonic represention.

source
PeriodicMatrices.pmrandMethod
pmrand(::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.

source

Operations on discrete-time periodic matrices

Base.reverseFunction
reverse(A)

Reverse the order of elements of a discrete-time periodic matrix.

source
LinearAlgebra.normMethod
norm(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.

source
PeriodicMatrices.traceMethod
trace(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.

source
PeriodicMatrices.pmshiftFunction
pmshift(A[,k = 1])

Circular shifting of the components of a discrete-time periodic matrix A with k positions.

source
PeriodicMatrices.pmataFunction
pmata(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.

source
PeriodicMatrices.pmaatFunction
pmaat(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.

source
PeriodicMatrices.pmrandMethod
pmrand(::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 typeTof matrix elements can be specified using, e.g.PeriodicMatrix{:d,T}insteadPeriodicMatrix, which assumes by defaultT = Float64`.

source
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.

source
PeriodicMatrices.pmrandMethod
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.

source

Operations with symmetric periodic matrices

PeriodicMatrices.pmmulsymFunction
pmmulsym(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.

source
PeriodicMatrices.pmtrmulsymFunction
pmtrmulsym(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.

source
PeriodicMatrices.pmmultrsymFunction
pmmultrsym(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.

source
PeriodicMatrices.pmmuladdsymFunction
pmmuladdsym(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.

source
PeriodicMatrices.pmmultraddsymFunction
pmmultraddsym(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.

source
PeriodicMatrices.pmmuladdtrsymFunction
pmmuladdtrsym(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.

source