Skip to content

Commit

Permalink
Split the whiten and unwhiten docs. (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Jan 30, 2024
1 parent b85c8ac commit 53bf0d0
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/generics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AbstractPDMat(A::AbstractPDMat) = A
AbstractPDMat(A::AbstractMatrix) = PDMat(A)

## convert
Base.convert(::Type{AbstractMatrix{T}}, a::AbstractPDMat) where {T<:Real} = convert(AbstractPDMat{T}, a)
Base.convert(::Type{AbstractMatrix{T}}, a::AbstractPDMat) where {T<:Real} = convert(AbstractPDMat{T}, a)
Base.convert(::Type{AbstractArray{T}}, a::AbstractPDMat) where {T<:Real} = convert(AbstractMatrix{T}, a)

## arithmetics
Expand Down Expand Up @@ -35,11 +35,10 @@ LinearAlgebra.checksquare(a::AbstractPDMat) = size(a, 1)

"""
whiten(a::AbstractMatrix, x::AbstractVecOrMat)
unwhiten(a::AbstractMatrix, x::AbstractVecOrMat)
unwhiten!(a::AbstractMatrix, x::AbstractVecOrMat)
unwhiten!(r::AbstractVecOrMat, a::AbstractPDMat, x::AbstractVecOrMat)
whiten!(a::AbstractMatrix, x::AbstractVecOrMat)
whiten!(r::AbstractVecOrMat, a::AbstractPDMat, x::AbstractVecOrMat)
Allocating and in-place versions of the `whiten`ing transform (or its inverse) defined by `a` applied to `x`
Allocating and in-place versions of the `whiten`ing transform defined by `a` applied to `x`
If the covariance of `x` is `a` then the covariance of the result will be `I`.
The name `whiten` indicates that this function transforms a correlated multivariate random
Expand All @@ -66,8 +65,24 @@ julia> W * W'
1.0 0.0
0.0 1.0
```
See also [`unwhiten`](@ref).
"""
whiten(a::AbstractMatrix{<:Real}, x::AbstractVecOrMat) = whiten(AbstractPDMat(a), x)

"""
unwhiten(a::AbstractMatrix, x::AbstractVecOrMat)
unwhiten!(a::AbstractMatrix, x::AbstractVecOrMat)
unwhiten!(r::AbstractVecOrMat, a::AbstractPDMat, x::AbstractVecOrMat)
Allocating and in-place versions of the `unwhiten`ing transform defined by `a` applied to `x`
If the covariance of `x` is `I` then the covariance of the result will be `a`.
The name `unwhiten` indicates that this function transforms an uncorrelated "white noise" signal
into a signal with the given covariance.
`unwhiten` is the inverse transformation of [`whiten`](@ref).
"""
unwhiten(a::AbstractMatrix{<:Real}, x::AbstractVecOrMat) = unwhiten(AbstractPDMat(a), x)

whiten!(a::AbstractMatrix{<:Real}, x::AbstractVecOrMat) = whiten!(x, a, x)
Expand Down

0 comments on commit 53bf0d0

Please sign in to comment.