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

Automatic flattening on outer array structures #14

Open
zxm403089989 opened this issue Sep 13, 2024 · 1 comment
Open

Automatic flattening on outer array structures #14

zxm403089989 opened this issue Sep 13, 2024 · 1 comment

Comments

@zxm403089989
Copy link

Similar as the example StackViews.jl example on repeated array. Suppose we have a 2-dimensional nested array A:

julia> using StackViews
julia> A = rand(100, 100);
julia> n = 100;
julia> StackView([A for _ in 1:n,_ in 1:n])
(100, 100, 10000)

We can see that StackView ignores the for loop structure, and flatten outer layer into a vector automatically. In principal, it should be an array with size (100,100,100,100). Is there anyway that we can persevere array size in StackView?

@melonedo
Copy link

It seems that this packages is built on top of the assumption that the outer dimensions are only one dimensional, as the definition of StackView is

struct StackView{T, N, D, A} <: AbstractArray{T, N}

Where N is the total number of indices (1 + that of the inner array) and D indicates its position.

So it would require quite a bit of type parameter manipulation to allow for multiple outer dimensions.

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