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

Matrix(sol) can return other types than Matrix #270

Open
danielwe opened this issue Jul 27, 2023 · 1 comment
Open

Matrix(sol) can return other types than Matrix #270

danielwe opened this issue Jul 27, 2023 · 1 comment

Comments

@danielwe
Copy link

Calling Matrix(sol) on an *DE solution returns a CuMatrix when the states are CuVectors.

This is because Matrix(sol) is implemented using a generic hcat (see snippet below). This is a very obvious and useful thing to do, but would it make more sense as an implementation of convert(AbstractMatrix, sol) rather than Matrix(sol)?

I know constructors are not guaranteed to return the invoked type, but it's confusing that you have to call Matrix(Matrix(sol)) to actually get a Matrix.

function Base.Matrix(VA::AbstractVectorOfArray{T, N, A}) where {T, N,
A <: AbstractVector{
<:AbstractVector
}}
reduce(hcat, VA.u)
end

@ChrisRackauckas
Copy link
Member

That would make more sense as a convert output, yes. This is a bit confusing and unintended.

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

No branches or pull requests

2 participants