Skip to content

JWSchaefer/lazy-nd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lazy-nd

A procedural macro for lazily defined state arrays using ndarray.

Note

This crate is a prototype. Functionality is not guaranteed and may change significantly.

🚀 Quickstart

cargo add --git https://github.com/JWSchaefer/lazy-nd

🔍 Example

use lazy_nd::lazy_nd;
use ndarray::ArrayView2;

#[lazy_nd(dim = 3)]
struct State {
  #[vector(velocity : f64)]
  #[scalar(id : usize)]
  #[scalar(live : bool)]
  name : &str
}

fn main(){
  let state = State::new(15);
  let velocity : ArrayView2<f64> = state.velocity(); // 3 x 15
  let mass : ArrayViewMut1<usize> = state.id_mut(); // 1 x 15
  let live : ArrayView1<bool> = state.live(); // 1 x 15
}

About

A procedural macro for lazily defined state arrays using ndarray.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages