Git Product home page Git Product logo

Comments (2)

giaf avatar giaf commented on May 20, 2024

Thanks for the suggestion.
In general, I am against adding the const qualifier to the interfaces, for these reasons:

  • in the BLAS API, there are not, since this was coded 30 years ago or so in fortran
  • in the BLASFEO API, there is the possibility to alias arguments. For example dgemm_nn is defined as
    D <- alpha*A*B + beta*C
    and C and D can alias (i.e. be the same matrix), so there is not a clear distinction between inputs (A, B, C) and outputs (D). In such cases, in my opinion having no const qualifier at all is better than having something half-way (only in A and B) or 'wrong' (as it would be to add it to C in case of alias with D)

from blasfeo.

roversch avatar roversch commented on May 20, 2024

Not sure what you mean with the first point, Fortran doesn't have a notion of const and the C API definitely has const (see link in original post).

About the second point: having const in that case is a feature, not an error. const only means that you can not (and will not) alter the argument with that name. So even though C would be pointer to const and D would be a regular pointer, they can still point to the same object underneath. It provides a nice check that you are not changing the array through C but only through D. I did not think about this example before, but it is an additional argument for putting const everywhere.

from blasfeo.

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.