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

Generalize pointmasses for abstractarray #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

wouterwln
Copy link
Member

Basically what the PR title says. I'm not sure about Base.ndims for vectors now. I implemented it separately now for backwards compatibility but it seems that it is only used in std and var and can therefore also just work with the generic implementation.

@wouterwln wouterwln linked an issue Aug 12, 2024 that may be closed by this pull request
function Base.precision(distribution::PointMass{V}) where {T<:Real,V<:AbstractVector{T}}
return one(T) ./ cov(distribution)
function BayesBase.cov(distribution::PointMass{M}) where {T<:Real,N,M<:AbstractArray{T,N}}
return error("cov(::PointMass{ <: AbstractMatrix }) is not defined")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error mentions AbstractMatrix, but accepts arbitrary AbstractArray

function BayesBase.probvec(
distribution::PointMass{M}
) where {T<:Real,N,M<:AbstractArray{T,N}}
return error("probvec(::PointMass{ <: AbstractMatrix }) is not defined")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Member

@bvdmitri bvdmitri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments, otherwise seems legit

@bvdmitri
Copy link
Member

Just as a side note, perhaps we should somehow rewrite PointMass to allow literally any object, but some may or may not support all operations, which can be determined by a trait-based system. This way we could close the #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StackOverFlow error with Tensor distributed PointMass
2 participants