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

Support having blocks with different eltypes #62

Open
nickrobinson251 opened this issue Feb 17, 2021 · 0 comments
Open

Support having blocks with different eltypes #62

nickrobinson251 opened this issue Feb 17, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@nickrobinson251
Copy link
Contributor

Currently, in BlockDiagonal{T,V}, T is the eltype of the blocks and we require all blocks to have the same eltype (i.e.all(eltype.(blocks) .=== T)).

However, we could allow blocks to have different eltypes, with T being the common eltype. (i.e.all(eltype.(blocks) .<: T)), with T = promote_type(map(eltype, blocks)...)`).

(suggested at https://github.com/invenia/BlockDiagonals.jl/pull/56/files#r576718519)

This is similar in spirit to #56 which generalises the V type parameters, but unlike #56, generalising T would be non-breaking as it'd only affects cases that are currently errors (and unlike #56 it doesn't change the meaning of T)

The main downside seems to be that this causes inference problems for rrules, which presumably has a performance cost for code using AD. See https://github.com/invenia/BlockDiagonals.jl/pull/56/files#r577136826

@nickrobinson251 nickrobinson251 added the enhancement New feature or request label Feb 17, 2021
@mzgubic mzgubic added this to the 1.0 milestone May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants