Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dim(a) -> LinearAlgebra.checksquare(a) #171

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/scalmat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ LinearAlgebra.sqrt(a::ScalMat) = ScalMat(a.dim, sqrt(a.value))
### whiten and unwhiten

function whiten!(r::AbstractVecOrMat, a::ScalMat, x::AbstractVecOrMat)
@check_argdims dim(a) == size(x, 1)
@check_argdims LinearAlgebra.checksquare(a) == size(x, 1)
_ldiv!(r, sqrt(a.value), x)
end

function unwhiten!(r::AbstractVecOrMat, a::ScalMat, x::AbstractVecOrMat)
@check_argdims dim(a) == size(x, 1)
@check_argdims LinearAlgebra.checksquare(a) == size(x, 1)
mul!(r, x, sqrt(a.value))
end

Expand All @@ -93,21 +93,21 @@ invquad!(r::AbstractArray, a::ScalMat, x::AbstractMatrix) = colwise_sumsqinv!(r,
### tri products

function X_A_Xt(a::ScalMat, x::AbstractMatrix)
@check_argdims dim(a) == size(x, 2)
@check_argdims LinearAlgebra.checksquare(a) == size(x, 2)
lmul!(a.value, x * transpose(x))
end

function Xt_A_X(a::ScalMat, x::AbstractMatrix)
@check_argdims dim(a) == size(x, 1)
@check_argdims LinearAlgebra.checksquare(a) == size(x, 1)
lmul!(a.value, transpose(x) * x)
end

function X_invA_Xt(a::ScalMat, x::AbstractMatrix)
@check_argdims dim(a) == size(x, 2)
@check_argdims LinearAlgebra.checksquare(a) == size(x, 2)
_rdiv!(x * transpose(x), a.value)
end

function Xt_invA_X(a::ScalMat, x::AbstractMatrix)
@check_argdims dim(a) == size(x, 1)
@check_argdims LinearAlgebra.checksquare(a) == size(x, 1)
_rdiv!(transpose(x) * x, a.value)
end