File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ [deps ]
2
+ Reactant = " 3c362404-f566-11ee-1572-e11a4b42c853"
3
+
4
+ [sources ]
5
+ Reactant = {path = " ../.." }
Original file line number Diff line number Diff line change
1
+ # Lanczos benchmark
2
+
3
+ This benchmark implements the Lanczos algorithm for top-k eigenvalue decomposition of a Hermitian matrix.
4
+
5
+ > ** require** $A, b$
6
+ >
7
+ > $\beta_1 v_1 = b$ s.t. $||v_1|| = 1$
8
+ >
9
+ > ** for** $k = 1, 2, \dots$
10
+ >
11
+ > $\quad\alpha_k = v_k^\dagger A v_k$
12
+ >
13
+ > $\quad\beta_ {k+1} v_ {k+1} = A v_k - \alpha_k v_k - \beta_k^* v_ {k-1}$
14
+ >
15
+ > ** end**
16
+
17
+ $A V_k = V_k T_k + \beta_ {k+1,k} v_ {k+1}e_k^T = V_ {k+1}T_ {k+1,k}$
18
+
19
+ $V_k^\dagger V_k = \mathbb{I}_ k$
Original file line number Diff line number Diff line change
1
+ using Reactant
2
+ using LinearAlgebra
3
+ using Random
4
+
5
+ Random. seed! (0 )
6
+
7
+ A = rand (ComplexF64, 512 , 512 )
8
+ A = A' * A # make it hermitian
9
+ @assert ishermitian (A)
10
+
11
+ b = normalize! (rand (ComplexF64, 512 ))
12
+
13
+ Are = Reactant. to_rarray (A)
14
+ bre = Reactant. to_rarray (b)
You can’t perform that action at this time.
0 commit comments