MCPcopy Create free account
hub / github.com/douchuan/algorithm / put

Method put

src/math/sparse_vector.rs:28–34  ·  view source on GitHub ↗

Sets the ith coordinate of this vector to the specified value.

(&mut self, i: usize, v: f64)

Source from the content-addressed store, hash-verified

26
27 /// Sets the ith coordinate of this vector to the specified value.
28 pub fn put(&mut self, i: usize, v: f64) {
29 if v == 0.0 {
30 self.st.delete(&i);
31 } else {
32 self.st.insert(i, v);
33 }
34 }
35
36 /// Returns the ith coordinate of this vector
37 pub fn get(&self, i: usize) -> f64 {

Callers 4

scaleMethod · 0.45
addMethod · 0.45
subMethod · 0.45
cloneMethod · 0.45

Calls 2

deleteMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected