MCPcopy Create free account
hub / github.com/daniel-e/rustml / linspace

Method linspace

src/vectors.rs:88–101  ·  view source on GitHub ↗
(&self, limit: f64, n: usize)

Source from the content-addressed store, hash-verified

86impl Linspace<f64> for f64 {
87
88 fn linspace(&self, limit: f64, n: usize) -> Vec<f64> {
89
90 if n <= 1 {
91 vec![limit]
92 } else {
93 let mut v = vec![];
94 let s = *self;
95 let d = (limit - *self) / (n - 1) as f64;
96 for i in (0..n) {
97 v.push(s + i as f64 * d);
98 }
99 v
100 }
101 }
102}
103
104// ------------------------------------------------------------------

Callers 2

mainFunction · 0.80
plot_nnFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected