Little refactor allowing speed (#10)

This commit is contained in:
Patrick Stevens
2023-04-07 11:37:05 +01:00
committed by GitHub
parent 817775412b
commit 3c964bc132
3 changed files with 7 additions and 6 deletions

View File

@@ -17,10 +17,11 @@ fn iterate<A, F>(f: &F, start: A, n: u32) -> A
where
F: Fn(A) -> A,
{
if n == 0 {
return start;
let mut v = start;
for _ in 0..n {
v = f(v);
}
iterate(f, f(start), n - 1)
v
}
struct GradientDescentHyper<A, const RANK: usize> {