Skip to content

Commit

Permalink
fix integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Dec 26, 2024
1 parent 38bd758 commit 01c6b52
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions ext/TenetKrylovKitExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ end

function eigsolve_prehook_tensor_reshape(A::Tensor, x₀::Tensor, left_inds, right_inds)
left_inds, right_inds = Tenet.factorinds(A, left_inds, right_inds)
left_inds, right_inds = Tuple(left_inds), Tuple(right_inds)

Amat, left_sizes, right_sizes = eigsolve_prehook_tensor_reshape(A, left_inds, right_inds)
prod_left_sizes = prod(left_sizes)
Expand Down Expand Up @@ -54,8 +55,8 @@ function KrylovKit.eigsolve(
howmany::Int=1,
which::KrylovKit.Selector=:LM,
T::Type=eltype(A);
left_inds=Symbol[],
right_inds=Symbol[],
left_inds=(),
right_inds=(),
kwargs...,
)
Amat, left_sizes, right_sizes = eigsolve_prehook_tensor_reshape(A, left_inds, right_inds)
Expand Down Expand Up @@ -85,8 +86,8 @@ function KrylovKit.eigsolve(
howmany::Int,
which::KrylovKit.Selector,
alg::Algorithm;
left_inds=Symbol[],
right_inds=Symbol[],
left_inds=(),
right_inds=(),
kwargs...,
) where {Algorithm<:KrylovKit.Lanczos} # KrylovKit.KrylovAlgorithm}
Amat, left_sizes, right_sizes = eigsolve_prehook_tensor_reshape(A, left_inds, right_inds)
Expand All @@ -107,7 +108,7 @@ function KrylovKit.eigsolve(
which::KrylovKit.Selector,
alg::Algorithm;
left_inds=inds(x₀),
right_inds=Symbol[],
right_inds=(),
kwargs...,
) where {Algorithm<:KrylovKit.Lanczos} # KrylovKit.KrylovAlgorithm}
Amat, left_sizes, right_sizes, x₀vec = eigsolve_prehook_tensor_reshape(A, x₀, left_inds, right_inds)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/Dagger_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using Distributed
contracted_block_tensor = contract(block_tensor1, block_tensor2)

@test parent(contracted_block_tensor) isa DArray
@test inds(contracted_block_tensor) == [:i, :k]
@test inds(contracted_block_tensor) == (:i, :k)
@test all(==((2, 2)) size, Dagger.domainchunks(parent(contracted_block_tensor)))
@test collect(parent(contracted_block_tensor)) parent(contracted_tensor)
end
Expand Down
3 changes: 2 additions & 1 deletion test/integration/KrylovKit_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@testset "KrylovKit.eigsolve" begin
using Tenet: Tensor
using KrylovKit
using LinearAlgebra

A = rand(ComplexF64, 4, 4)
data = (A + A') / 2 # Make it Hermitian
Expand All @@ -13,7 +14,7 @@
@test length(vecs) == 4

for vec in vecs
@test inds(vec) == [:i]
@test inds(vec) == (:i,)
@test size(vec) == (4,)
end

Expand Down

0 comments on commit 01c6b52

Please sign in to comment.