Coder Social home page Coder Social logo

linear and index array accessors about gtensor HOT 2 CLOSED

wdmapp avatar wdmapp commented on June 15, 2024
linear and index array accessors

from gtensor.

Comments (2)

germasch avatar germasch commented on June 15, 2024

Fundamentally, I like a[{0, 7}]. I don't think it necessarily conflicts with a[100] since those can be disambiguated by the arg type, though one may have to be careful that there's no ambiguity with implicit conversions.

For now, I'd only support the sarray index to be of length == expr_dimension(E) that it's being passed to, so all it really does is unpack and pass things through to the multi-arg operator().

I'm not sure that linear indexing via something like a[100] is desirable to have (in the public interface). I'd say if one wants to have a flattened view, that'd better be supported by something like ravel or flatten. In terms of a cheap way to iterate over all values, one should probably provide iterators instead of some (seemingly) linear access.

On the data layout, I think it's another issue that will probably require some thought. Fundamentally, gtensor and gtensor_view use an array of strides, so the underlying data can be row-major or column-major or whatever, and access will work. I guess you can make a row-major gtensor right now using swapaxis. But I also think it's true that in some select places (other than the initial initialization of the strides) there is an assumption of col-major, ie., some expression stuff may break, and that should be handled properly, though I also think I remember some non-trivial obstacles to that...

from gtensor.

bd4 avatar bd4 commented on June 15, 2024

Closed by #62 and #56. Implements the simplest form, in particular operator[] only supports shape types, not literal arrays. Linear access is handled via the flatten view helper.

from gtensor.

Related Issues (20)

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.