3 releases (breaking)

0.3.0 Apr 17, 2022
0.2.0 Oct 28, 2021
0.1.0 Sep 28, 2021

#1227 in Data structures

Download history 133/week @ 2024-07-22 175/week @ 2024-07-29 220/week @ 2024-08-05 246/week @ 2024-08-12 125/week @ 2024-08-19 146/week @ 2024-08-26 100/week @ 2024-09-02 102/week @ 2024-09-09 141/week @ 2024-09-16 178/week @ 2024-09-23 115/week @ 2024-09-30 37/week @ 2024-10-07 145/week @ 2024-10-14 122/week @ 2024-10-21 104/week @ 2024-10-28 100/week @ 2024-11-04

479 downloads per month
Used in 6 crates (3 directly)

MIT/Apache

15KB
329 lines

ndcopy

Fast N-dimensional array memcpy.

Speed is achieved by copying slices row-by-row. Rust code is much faster at copying slices than trying to index N-dimensional coordinates for every value index.

Example Code

use ndcopy::ndshape::{ConstShape, ConstShape3u32};
use ndcopy::copy3;

type SrcShape = ConstShape3u32<50, 50, 50>;
type DstShape = ConstShape3u32<25, 25, 25>;
let src = [1u8; SrcShape::USIZE];
let mut dst = [0u8; DstShape::USIZE];

let copy_shape = [20; 3];
let src_min = [1, 2, 3];
let dst_min = [2, 3, 4];
copy3(
    copy_shape,
    &src,
    &SrcShape {},
    src_min,
    &mut dst,
    &DstShape {},
    dst_min,
);

License: MIT OR Apache-2.0


lib.rs:

Fast N-dimensional array memcpy.

Speed is achieved by copying slices row-by-row. Rust code is much faster at copying slices than trying to index N-dimensional coordinates for every value index.

Example Code

use ndcopy::ndshape::{ConstShape, ConstShape3u32};
use ndcopy::copy3;

type SrcShape = ConstShape3u32<50, 50, 50>;
type DstShape = ConstShape3u32<25, 25, 25>;
let src = [1u8; SrcShape::USIZE];
let mut dst = [0u8; DstShape::USIZE];

let copy_shape = [20; 3];
let src_min = [1, 2, 3];
let dst_min = [2, 3, 4];
copy3(
    copy_shape,
    &src,
    &SrcShape {},
    src_min,
    &mut dst,
    &DstShape {},
    dst_min,
);

Dependencies

~74KB