Skip to content

Should verify domain == codomain for project_(anti)hermitian #388

@Yue-Zhengyuan

Description

@Yue-Zhengyuan

Currently project_(anti)hermitian for TensorMaps does not verify that codomain == domain for the input, and continues when domain == codomain'. For example,

julia> using TensorKit, MatrixAlgebraKit

julia> a = randn(ℂ^3  (ℂ^3)')
33 TensorMap{Float64, ComplexSpace, 1, 1, Vector{Float64}}:
 codomain: ((ℂ^3)')
 domain: (ℂ^3)
 blocks: 
 * Trivial() => 3×3 reshape(view(::Vector{Float64}, 1:9), 3, 3) with eltype Float64:
 -1.1574    -0.507056   -1.3797
 -1.30112    0.316528   -0.687373
 -0.619306  -0.0116334   0.515426

julia> a2 = project_hermitian(a)
33 TensorMap{Float64, ComplexSpace, 1, 1, Vector{Float64}}:
 codomain: ((ℂ^3)')
 domain: (ℂ^3)
 blocks: 
 * Trivial() => 3×3 reshape(view(::Vector{Float64}, 1:9), 3, 3) with eltype Float64:
 -1.1574    -0.904089  -0.999501
 -0.904089   0.316528  -0.349503
 -0.999501  -0.349503   0.515426

julia> ishermitian(a2)
false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions