meshgridrs 0.1.1

Partial implementation of numpy's meshgrid function for ndarray.
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 2 items with examples
  • Size
  • Source code size: 6.63 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.44 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jreniel/meshgridrs
    4 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jreniel

meshgridrs

Currently, ndarray doesn't have a built-in meshgrid method.

There exists a meshgrid crate, but it only works with i32 types.

This is a meshgrid function that should work over generic types and in n-dimensions.

My hope is that eventually ndarray incorporates this, or it's own particular version.

use ndarray::Array;
use meshgridrs::{meshgrid, Indexing};

fn main() {
    // Example with 3D.
    let x = Array::linspace(0.0, 1.0, 3);
    let y = Array::linspace(0.0, 1.0, 2);
    let z = Array::linspace(0.0, 1.0, 2);
    let xi = vec![x, y, z];
    let grids = meshgrid(&xi, Indexing::Xy).unwrap();
    for (i, grid) in grids.iter().enumerate() {
        println!("Grid {}:\n{:?}", i, grid);
    };
}

SPDX-License-Identifier: LicenseRef-MIT