Coder Social home page Coder Social logo

Comments (5)

ptillet avatar ptillet commented on June 24, 2024

In the process I introduce some "element_accessor" in addition of the index set... This allows for some memory-less patterns to be used, such as an "infinite" vector 1,2,3,..... , repmat, diag, etc...
Is there any additional cool feature that can be done using this mechanism, for cases where the elements of the vector don't come from an handle (or not only) ?

from viennacl-dev.

karlrupp avatar karlrupp commented on June 24, 2024

Please be more conservative with respect to features. Now as the generator is no longer super-experimental, we have a hard time removing features once they are introduced. ;-) Could you please elaborate more on what exactly 'element_accessor' is supposed to do (other than what is provided by range(), slide(), and finally index_set()?

from viennacl-dev.

ptillet avatar ptillet commented on June 24, 2024

element_accessor, is just a way to specify where the elements of a given vector is located, because it may not come necessarily from a handle, for example, a constant vector would implement something like

std::string constant_element::access(index){ return val_name_; }

where val_name_ is the argument name of the corresponding CPU scalar. Or a vector 1,2,.....,N would be like

std::string linear_element::access(index){ return index; }

We can play a bit with matrices to introduce "memory free" r-value symbolic expressions :P For example, eye(N) would map to something like:

std::string identity_element::access(index1, index2){ return "(" + index1 + ")==(" + index2 + ")";

The idea is just that diag() would dispatch the access to a diag_accessor, that would be for example implemented like

std::string diag_mat_element::access(index1, index2){ return vec_handle_name_+"["+index1+"]"; }

At first I wanted to incorporate this information in index_set, but it seemed like an orthogonal issue :) This is used internally only so I wouldn't describe this as a "feature"

from viennacl-dev.

ptillet avatar ptillet commented on June 24, 2024

I have reimplemented diag() and also repmat()... A "pitfall" of the "element_accessor" approach is that diag() and repmat accept only single elements and not expressions :P diag(x + y) is not legal (but can be replaced by diag(x) + diag(y) ).

from viennacl-dev.

karlrupp avatar karlrupp commented on June 24, 2024

Cool, thanks! What about still allowing the user to pass an expression, but internally immediately convert it to the expanded form.
Example: User writes diag(A + alpha * B), we transform this immediately to diag(A) + alpha * diag(B);

from viennacl-dev.

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.