Repository navigation
Fix tensor map subtype bounds - #593
Yue-Zhengyuan wants to merge 1 commit into
Conversation
|
Hmmm, this honestly looks like something that Julia itself might be fixing in the near future. I recall doing this more or less on purpose, such that the bounds are defined in a single place instead of for every type, which can be useful if we ever have to change them, and the weird thing is that I think you can never instantiate a TensorMap with a non-Number element type... Considering your usecase, that looks like a bit of a strange definition of the type alias to begin with, and I think for inference purposes it is probably better to immediately instantiate these as either |
|
In the PEPSKit case, sometimes an MPO with mixed scalar type can be constructed. A simple example is [real(S_x), S_y] with two sites connected by a trivial leg (suppose we keep this leg for test purposes). This thing fails to be recognized as |
|
I think the idea is to make that explicitly |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 15 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Fix missing type parameter bounds that caused
TensorMap <: AbstractTensorMapto returnfalse.Add
T <: Numberto all four concrete tensor map types, plus the missingS <: IndexSpacebounds onAdjointTensorMapandBraidingTensor. Add regression coverage for unparameterized types and types with real or complex scalar parameters.Background
I bumped into this in QuantumKitHub/PEPSKit.jl#425. There we define
However, if a vector of TensorMaps contains mixed scalar types (e.g. a Float64 tensor and a ComplexF64 tensor) as well as different in/out number of legs, then the vector fails to be recognized as an
MPOTerm, because the inferredTisAny: