Calculus rules
Concatenation
AbstractOperators.VCAT
— Type.VCAT(A::AbstractOperator...)
Shorthand constructors:
[A1; A2 ...]
vcat(A...)
Vertically concatenate AbstractOperator
s. Notice that all the operators must share the same domain dimensions and type, e.g. size(A1,2) == size(A2,2)
and domainType(A1) == domainType(A2)
.
julia> VCAT(DFT(4,4),Variation((4,4)))
[ℱ;Ʋ] ℝ^(4, 4) -> ℂ^(4, 4) ℝ^(16, 2)
julia> V = [Eye(3); DiagOp(2*ones(3))]
[I;╲] ℝ^3 -> ℝ^3 ℝ^3
julia> vcat(V,FiniteDiff((3,)))
VCAT ℝ^3 -> ℝ^3 ℝ^3 ℝ^2
When multiplying a VCAT
with an array of the proper size, the result will be a Tuple
containing arrays with the VCAT
's codomain type and size.
julia> V*ones(3)
([1.0, 1.0, 1.0], [2.0, 2.0, 2.0])
AbstractOperators.HCAT
— Type.HCAT(A::AbstractOperator...)
Shorthand constructors:
[A1 A2 ...]
hcat(A...)
Horizontally concatenate AbstractOperator
s. Notice that all the operators must share the same codomain dimensions and type, e.g. size(A1,1) == size(A2,1)
and codomainType(A1) == codomainType(A2)
.
julia> HCAT(DFT(10),DCT(Complex{Float64},20)[1:10])
[ℱ,↓*ℱc] ℝ^10 ℂ^20 -> ℂ^10
julia> H = [Eye(10) DiagOp(2*ones(10))]
[I,╲] ℝ^10 ℝ^10 -> ℝ^10
julia> hcat(H,DCT(10))
HCAT ℝ^10 ℝ^10 ℝ^10 -> ℝ^10
To evaluate HCAT
operators multiply them with a Tuple
of AbstractArray
of the correct dimensions and type.
julia> H*ArrayPartition(ones(10),ones(10))
3-element Array{Float64,1}:
3.0
3.0
3.0
...
AbstractOperators.DCAT
— Type.DCAT(A::AbstractOperator...)
Block-diagonally concatenate AbstractOperator
s.
julia> D = DCAT(HCAT(Eye(2),Eye(2)),DFT(3))
[[I,I],0;0,ℱ] ℝ^2 ℝ^2 ℝ^4 -> ℝ^2 ℂ^3
julia> DCAT(Eye(10),Eye(10),FiniteDiff((4,4)))
DCAT ℝ^10 ℝ^10 ℝ^(4, 4) -> ℝ^10 ℝ^10 ℝ^(3, 4)
To evaluate DCAT
operators multiply them with a Tuple
of AbstractArray
of the correct domain size and type. The output will consist as well of a Tuple
with the codomain type and size of the DCAT
.
julia> D*ArrayPartition(ones(2),ones(2),ones(3))
([2.0, 2.0], Complex{Float64}[3.0+0.0im, 0.0+0.0im, 0.0+0.0im])
Composition
AbstractOperators.Compose
— Type.Compose(A::AbstractOperator,B::AbstractOperator)
Shorthand constructor:
A*B
Compose different AbstractOperator
s. Notice that the domain and codomain of the operators A
and B
must match, i.e. size(A,2) == size(B,1)
and domainType(A) == codomainType(B)
.
julia> Compose(DFT(16,2),Variation((4,4)))
ℱc*Ʋ ℝ^(4, 4) -> ℝ^(16, 2)
julia> MatrixOp(randn(20,10))*DCT(10)
▒*ℱc ℝ^10 -> ℝ^20
AbstractOperators.HadamardProd
— Type.HadamardProd(A::AbstractOperator,B::AbstractOperator)
Create an operator P
such that:
P*x == (Ax).*(Bx)
Example
julia> A,B = Sin(3), Cos(3);
julia> P = HadamardProd(A,B)
sin.*cos ℝ^3 -> ℝ^3
julia> x = randn(3);
julia> P*x == (sin.(x).*cos.(x))
true
AbstractOperators.Ax_mul_Bx
— Type.Ax_mul_Bx(A::AbstractOperator,B::AbstractOperator)
Create an operator P
such that:
P*x == (Ax)*(Bx)
Example
julia> A,B = randn(4,4),randn(4,4);
julia> P = Ax_mul_Bx(MatrixOp(A,4),MatrixOp(B,4))
▒*▒ ℝ^4 -> ℝ^(4, 4)
julia> X = randn(4,4);
julia> P*X == (A*X)*(B*X)
true
AbstractOperators.Axt_mul_Bx
— Type.Axt_mul_Bx(A::AbstractOperator,B::AbstractOperator)
Create an operator P
such that:
P*x == (Ax)'*(Bx)
Example
julia> A,B = randn(4,4),randn(4,4);
julia> P = Axt_mul_Bx(MatrixOp(A),MatrixOp(B))
▒*▒ ℝ^4 -> ℝ^1
julia> x = randn(4);
julia> P*x == [(A*x)'*(B*x)]
true
AbstractOperators.Ax_mul_Bxt
— Type.Ax_mul_Bxt(A::AbstractOperator,B::AbstractOperator)
Create an operator P
such that:
P == (Ax)*(Bx)'
Example: Matrix multiplication
julia> A,B = randn(4,4),randn(4,4);
julia> P = Ax_mul_Bxt(MatrixOp(A),MatrixOp(B))
▒*▒ ℝ^4 -> ℝ^(4, 4)
julia> x = randn(4);
julia> P*x == (A*x)*(B*x)'
true
Transformations
AbstractOperators.Scale
— Type.Scale(α::Number,A::AbstractOperator)
Shorthand constructor:
*(α::Number,A::AbstractOperator)
Scale an AbstractOperator
by a factor of α
.
julia> A = FiniteDiff((10,2))
δx ℝ^(10, 2) -> ℝ^(9, 2)
julia> S = Scale(10,A)
αδx ℝ^(10, 2) -> ℝ^(9, 2)
julia> 10*A #shorthand
αℱc ℝ^10 -> ℝ^10
AdjointOperator(A::AbstractOperator)
Shorthand constructor:
'(A::AbstractOperator)
Returns the adjoint operator of A
.
julia> AdjointOperator(DFT(10))
ℱᵃ ℂ^10 -> ℝ^10
julia> [DFT(10); DCT(10)]'
[ℱ;ℱc]ᵃ ℂ^10 ℝ^10 -> ℝ^10
AbstractOperators.AffineAdd
— Type.AffineAdd(A::AbstractOperator, d, [sign = true])
Affine addition to AbstractOperator
with an array or scalar d
.
Use sign = false
to perform subtraction.
julia> A = AffineAdd(Sin(3),[1.;2.;3.])
sin+d ℝ^3 -> ℝ^3
julia> A*[3.;4.;5.] == sin.([3.;4.;5.]).+[1.;2.;3.]
true
julia> A = AffineAdd(Exp(3),[1.;2.;3.],false)
e-d ℝ^3 -> ℝ^3
julia> A*[3.;4.;5.] == exp.([3.;4.;5.]).-[1.;2.;3.]
true
AbstractOperators.BroadCast
— Type.BroadCast(A::AbstractOperator, dim_out...)
BroadCast the codomain dimensions of an AbstractOperator
.
julia> A = Eye(2)
I ℝ^2 -> ℝ^2
julia> B = BroadCast(A,(2,3))
.I ℝ^2 -> ℝ^(2, 3)
julia> B*[1.;2.]
2×3 Array{Float64,2}:
1.0 1.0 1.0
2.0 2.0 2.0
AbstractOperators.Reshape
— Type.Reshape(A::AbstractOperator, dim_out...)
Shorthand constructor:
reshape(A, idx...)
Reshape the codomain dimensions of an AbstractOperator
.
julia> A = Reshape(DFT(10),2,5)
¶ℱ ℝ^10 -> ℂ^(2, 5)
julia> R = reshape(Conv((19,),randn(10)),7,2,2)
¶★ ℝ^19 -> ℝ^(7, 2, 2)
AbstractOperators.Jacobian
— Type.Jacobian(A::AbstractOperator,x)
Shorthand constructor:
jacobian(A::AbstractOperator,x)
Returns the jacobian of A
evaluated at x
(which in the case of a LinearOperator
is A
itself).
julia> Jacobian(DFT(10),randn(10))
ℱ ℝ^10 -> ^ℂ10
julia> Jacobian(Sigmoid((10,)),randn(10))
J(σ) ℝ^10 -> ℝ^10