Square¶

- class gob.benchmarks.square.Square¶
Bases:
Benchmark
The d-square function.
\(f(x) = x \cdot x^\top\).
Its minimum is \(0\) achieved at \(x = 0\).
- expr(x)¶
The expression of the function.
- Parameters:
x (array-like) – The point at which to evaluate the function.
- Returns:
The value of the function at x.
- Return type:
float
- gradient(x)¶
Estimate the gradient of a function at a given point using finite differences.
- Parameters:
f (callable) – The function to estimate the gradient of. It should take a single argument.
x (array-like) – The point at which to estimate the gradient of f.
eps (float, optional) – The perturbation used to estimate the gradient.
- Returns:
The estimated gradient of f at x and the value of f at x.
- Return type:
pair