You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That way the functions accept any-dimensional vectors, e.g.
fnmain(){println!("Magnitude of a unit vector: {}",
magnitude(&[0.0,1.0,0.0]));letmut v = [1.0,2.0,9.0];println!("Magnitude of {v:?}: {}", magnitude(&v));normalize(&mut v);println!("Magnitude of {v:?} after normalization: {}", magnitude(&v));letmut v4 = [1.0,2.0,3.0,4.0];println!("4d vector: {v4:?}");normalize(&mut v4);println!("Normalized 4d vector: {v4:?}");}