Functions | |
| def | test_anderson () |
Variables | |
| int | n = 10 |
| int | ε = 1e-12 |
| rng = nprand.default_rng(seed=123) | |
| A = rng.random(size=(n, n)) | |
| Q | |
| D = np.diag(rng.normal(scale=4, size=(n, ))) | |
| q = rng.normal(scale=1, size=(n, )) | |
| x_ = cs.SX.sym('x', n) | |
| float | px = x_ + 0.2 * cs.sin(x_[::-1]) |
| float | f_ = 0.5 * (x_.T @ A @ px) + cs.dot(q, x_) |
| f = cs.Function("f", [x_], [f_]) | |
| grad_f_ = cs.gradient(f_, x_) | |
| grad_f = cs.Function("grad_f", [x_], [grad_f_]) | |
| hess_f_ = cs.jacobian(grad_f_, x_) | |
| hess_f = cs.Function("hess_f", [x_], [hess_f_]) | |
| int | L = la.norm(D)**2 |
| def test_anderson | ( | ) |
Definition at line 35 of file test_anderson.py.
| int n = 10 |
Definition at line 9 of file test_anderson.py.
| int ε = 1e-12 |
Definition at line 10 of file test_anderson.py.
| rng = nprand.default_rng(seed=123) |
Definition at line 13 of file test_anderson.py.
Definition at line 14 of file test_anderson.py.
| Q |
Definition at line 15 of file test_anderson.py.
| D = np.diag(rng.normal(scale=4, size=(n, ))) |
Definition at line 16 of file test_anderson.py.
| q = rng.normal(scale=1, size=(n, )) |
Definition at line 18 of file test_anderson.py.
| x_ = cs.SX.sym('x', n) |
Definition at line 20 of file test_anderson.py.
Definition at line 21 of file test_anderson.py.
Definition at line 23 of file test_anderson.py.
Definition at line 24 of file test_anderson.py.
Definition at line 25 of file test_anderson.py.
Definition at line 26 of file test_anderson.py.
Definition at line 27 of file test_anderson.py.
| int L = la.norm(D)**2 |
Definition at line 28 of file test_anderson.py.