-
Notifications
You must be signed in to change notification settings - Fork 22
add abstract types for views and permuted arrays #255
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
Changes from 7 commits
c900f07
15557d1
223bd72
be71674
5d7af26
dffe216
aa47a28
f1ee107
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module DiskArrays | ||
|
||
import ConstructionBase | ||
import Base.PermutedDimsArrays: genperm | ||
|
||
using LRUCache: LRUCache, LRU | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
""" | ||
PermutedDiskArray <: AbstractDiskArray | ||
AbstractPermutedDiskArray <: AbstractDiskArray | ||
|
||
Abstract supertype for diskarray with permuted dimensions. | ||
""" | ||
abstract type AbstractPermutedDiskArray{T,N} <: AbstractDiskArray{T,N} end | ||
|
||
""" | ||
PermutedDiskArray <: AbstractPermutedDiskArray | ||
|
||
A lazily permuted disk array returned by `permutedims(diskarray, permutation)`. | ||
""" | ||
struct PermutedDiskArray{T,N,perm,iperm,A<:AbstractArray{T,N}} <: AbstractDiskArray{T,N} | ||
struct PermutedDiskArray{T,N,perm,iperm,A<:AbstractArray{T,N}} <: AbstractPermutedDiskArray{T,N} | ||
parent::A | ||
end | ||
# We use PermutedDimsArray internals instead of duplicating them, | ||
|
@@ -41,15 +48,15 @@ function eachchunk(a::PermutedDiskArray) | |
# Return permuted GridChunks | ||
return GridChunks(genperm(gridchunks.chunks, perm)...) | ||
end | ||
function DiskArrays.readblock!(a::PermutedDiskArray, aout, i::OrdinalRange...) | ||
function DiskArrays.readblock!(a::AbstractPermutedDiskArray, aout, i::OrdinalRange...) | ||
iperm = _getiperm(a) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now an internal method in an Abstract typed function... Should we remove the underscore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove which underscore? You mean in |
||
# Permute the indices | ||
inew = genperm(i, iperm) | ||
# Permute the dest block and read from the true parent | ||
DiskArrays.readblock!(parent(a), PermutedDimsArray(aout, iperm), inew...) | ||
return nothing | ||
end | ||
function DiskArrays.writeblock!(a::PermutedDiskArray, v, i::OrdinalRange...) | ||
function DiskArrays.writeblock!(a::AbstractPermutedDiskArray, v, i::OrdinalRange...) | ||
iperm = _getiperm(a) | ||
inew = genperm(i, iperm) | ||
# Permute the dest block and write from the true parent | ||
|
Uh oh!
There was an error while loading. Please reload this page.