Skip to content

Commit

Permalink
Update test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyang-ustc authored Dec 6, 2024
1 parent be036e9 commit 389a47c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jax
import jax.numpy as jnp
from jaxeigs import eigs
from jaxtn.solver.jaxeigs import eigs, eigsh
from jax import config
config.update("jax_enable_x64", True)

Expand All @@ -11,5 +11,16 @@
def mapA(x): return A@x
res = eigs(mapA, initial_state = b, numeig=1, num_krylov_vecs = 5)
print(res[0],res[1][0])

A @ res[1][0] / res[1][0]

A @ res[1][0] / res[1][0]


m = 10
A = jax.random.uniform(jax.random.PRNGKey(42),(m,m))
b = jax.random.uniform(jax.random.PRNGKey(41),(m,))
def mapA(x): return (A+A.T.conj())@x
res = eigsh(mapA, initial_state = b, numeig=1, num_krylov_vecs = 5)
print(res[0],res[1][0])

(A+A.T.conj()) @ res[1][0] / res[1][0]

0 comments on commit 389a47c

Please sign in to comment.