@@ -25,24 +25,24 @@ begin
25
25
bsym = b' + b
26
26
bpd = b' * b
27
27
28
- (d,v) = eigs (a, nev= 3 )
29
- @test_approx_eq a* v[:,2 ] d[2 ]* v[:,2 ]
28
+ (d,v) = eigs (a, nev= 3 )
29
+ @test_approx_eq a* v[:,2 ] d[2 ]* v[:,2 ]
30
30
@test norm (v) > testtol # eigenvectors cannot be null vectors
31
31
# (d,v) = eigs(a, b, nev=3, tol=1e-8) # not handled yet
32
32
# @test_approx_eq_eps a*v[:,2] d[2]*b*v[:,2] testtol
33
33
# @test norm(v) > testtol # eigenvectors cannot be null vectors
34
34
35
- (d,v) = eigs (asym, nev= 3 )
36
- @test_approx_eq asym* v[:,1 ] d[1 ]* v[:,1 ]
35
+ (d,v) = eigs (asym, nev= 3 )
36
+ @test_approx_eq asym* v[:,1 ] d[1 ]* v[:,1 ]
37
37
@test_approx_eq eigs (asym; nev= 1 , sigma= d[3 ])[1 ][1 ] d[3 ]
38
38
@test norm (v) > testtol # eigenvectors cannot be null vectors
39
39
40
- (d,v) = eigs (apd, nev= 3 )
41
- @test_approx_eq apd* v[:,3 ] d[3 ]* v[:,3 ]
40
+ (d,v) = eigs (apd, nev= 3 )
41
+ @test_approx_eq apd* v[:,3 ] d[3 ]* v[:,3 ]
42
42
@test_approx_eq eigs (apd; nev= 1 , sigma= d[3 ])[1 ][1 ] d[3 ]
43
43
44
44
(d,v) = eigs (apd, bpd, nev= 3 , tol= 1e-8 )
45
- @test_approx_eq_eps apd* v[:,2 ] d[2 ]* bpd* v[:,2 ] testtol
45
+ @test_approx_eq_eps apd* v[:,2 ] d[2 ]* bpd* v[:,2 ] testtol
46
46
@test norm (v) > testtol # eigenvectors cannot be null vectors
47
47
48
48
# test (shift-and-)invert mode
@@ -85,21 +85,21 @@ d, = eigs(A6965,which=:SM,nev=2,ncv=4,tol=eps())
85
85
import Base: size, issym, ishermitian
86
86
87
87
type CPM{T<: Base.LinAlg.BlasFloat }<: AbstractMatrix{T} # completely positive map
88
- kraus:: Array{T,3} # kraus operator representation
88
+ kraus:: Array{T,3} # kraus operator representation
89
89
end
90
90
91
91
size (Phi:: CPM )= (size (Phi. kraus,1 )^ 2 ,size (Phi. kraus,3 )^ 2 )
92
92
issym (Phi:: CPM )= false
93
93
ishermitian (Phi:: CPM )= false
94
94
95
95
function * {T<: Base.LinAlg.BlasFloat }(Phi:: CPM{T} ,rho:: Vector{T} )
96
- rho= reshape (rho,(size (Phi. kraus,3 ),size (Phi. kraus,3 )))
97
- rho2= zeros (T,(size (Phi. kraus,1 ),size (Phi. kraus,1 )))
98
- for s= 1 : size (Phi. kraus,2 )
99
- As= slice (Phi. kraus,:,s,:)
100
- rho2+= As* rho* As'
101
- end
102
- return reshape (rho2,(size (Phi. kraus,1 )^ 2 ,))
96
+ rho= reshape (rho,(size (Phi. kraus,3 ),size (Phi. kraus,3 )))
97
+ rho2= zeros (T,(size (Phi. kraus,1 ),size (Phi. kraus,1 )))
98
+ for s= 1 : size (Phi. kraus,2 )
99
+ As= slice (Phi. kraus,:,s,:)
100
+ rho2+= As* rho* As'
101
+ end
102
+ return reshape (rho2,(size (Phi. kraus,1 )^ 2 ,))
103
103
end
104
104
# Generate random isometry
105
105
(Q,R)= qr (randn (100 ,50 ))
0 commit comments