Giter Site home page Giter Site logo

meshgrid about stdlib HOT 5 OPEN

fortran-lang avatar fortran-lang commented on May 25, 2024
meshgrid

from stdlib.

Comments (5)

Ivanou34 avatar Ivanou34 commented on May 25, 2024 1

Hi,
I wish to start contributing to stdlib so I am looking for a first issue to tackle. Is this issue still relevant?

If yes, should we aim for the level of genericity attained by NumPy, or is the Matlab version sufficient?

from stdlib.

Ivanou34 avatar Ivanou34 commented on May 25, 2024

If we seek to have only 2d and 3d versions, we could implement them separately under a generic interface:

interface meshgrid
  module procedure meshgrid_2d
  module procedure meshgrid_3d
end interface

where the 2d implementation for instance would be a pure subroutine with the following interface

  pure subroutine meshgrid_2d(x, y, xm, ym, indexing)
    implicit none
    real, intent(in) :: x(:)
    real, intent(in) :: y(:)
    real, intent(out) :: xm(:)
    real, intent(out) :: ym(:)
    character(len=*), intent(in), optional :: indexing
  end subroutine meshgrid_2d

The optional argument indexing would have the same influence on the result than in NumPy's meshgrid.

Of course there would also the possibility to implement meshgrid_2d / meshgrid_3d as functions rather than subroutines. In this case the output could either be encapsulated in a single array, or in a derived type.

What do you think?

from stdlib.

jvdp1 avatar jvdp1 commented on May 25, 2024

Hi @Ivanou34 , welcome and thank you for proposing to contribute to stdlib.

This issue is still relevant, and I think it is a good one to get familiar with stdlib

If yes, should we aim for the level of genericity attained by NumPy, or is the Matlab version sufficient?

Yes, it would be nice to reach the same level of genericity as NumPy. But as a first step I would suggest to first focus on 2d and 3d. See also e.g., stdlib_stats_mean.fypp, on how genericity could be achieved with the fypp preprocessor.

Your propposed API of the subroutine in your comment sounds good to me. A wrapper (e.g. function, derived type) could be added in the future, if needed.

from stdlib.

Ivanou34 avatar Ivanou34 commented on May 25, 2024

Thanks for your answer @jvdp1

Should I start working on it, or is it preferable to wait for feedback from other people?

from stdlib.

jvdp1 avatar jvdp1 commented on May 25, 2024

from stdlib.

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.