Giter Site home page Giter Site logo

stridedviews.jl's Introduction

StridedViews

Build Status Coverage Quality assurance
CI Codecov Aqua QA

StridedViews.jl exports a single struct type StridedView for representing a strided view over a contiguous parrent array, as represented by the abstract type DenseArray.

See Strided.jl for more functionality.


The type StridedView provides a view into a parent array of type DenseArray such that the resulting view is strided, i.e. any dimension has an associated stride, such that e.g.

getindex(A, i₁, i₂, i₃, ...) = A.op(A.parent[offset + 1 + (i₁-1)*s₁ + (i₂-1)*s₂ + (i₃-1)*s₃ + ...])

with sⱼ = stride(A, iⱼ). There are no further assumptions on the strides, e.g. they are not assumed to be monotonously increasing or have s₁ == 1. Furthermore, A.op can be any of the operations identity, conj, transpose or adjoint (the latter two are equivalent to the former two if eltype(A) <: Number). Since these operations are their own inverse, they are also used in the corresponding setindex!.

This definition enables a StridedView to be lazy (i.e. returns just another StridedView over the same parent data) under application of conj, transpose, adjoint, permutedims and indexing (getindex) with Union{Integer, Colon, AbstractRange{<:Integer}} (a.k.a slicing). The function sview is exported to directly create a sliced (and thus strided) view over a given parent array.

Furthermore, the strided structure can be retained under certain reshape operations, but not all of them. Any dimension can always be split into smaller dimensions, but two subsequent dimensions i and i+1 can only be joined if stride(A,i+1) == size(A,i)*stride(A,i). Instead of overloading reshape, Strided.jl provides a separate function sreshape which returns a StridedView over the same parent data, or throws a runtime error if this is impossible.

stridedviews.jl's People

Contributors

jutho avatar lkdvos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.