Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/douchuan/algorithm
/ magnitude
Function
magnitude
tests/test_sparse_vec.rs:13–19 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
11
12
#[test]
13
fn magnitude() {
14
let (a, _) = create();
15
assert_relative_eq!(
16
a.magnitude(),
17
(0.5_f64.powf(2.0) + 0.75_f64.powf(2.0)).sqrt()
18
);
19
}
20
21
#[test]
22
fn scale() {
Callers
nothing calls this directly
Calls
1
create
Function · 0.85
Tested by
no test coverage detected