[ITensors] [ENHANCEMENT] ITensors.contract!(a, b, c, 1, 1) promotion to the type of a #1175
Labels
enhancement
New feature or request
ITensors
Issues or pull requests related to the `ITensors` package.
Is your feature request related to a problem? Please describe.
ITensors.contract!(a, b, c, 1, 1)
throws an error if promoted tensor element type ofa
andb
("greater" type) does not match tensor element type ofa
. For example, the code belowdoes not work if a promoted type of
type_2
andtype_3
does not matchtype_1
. For example, it would not work iftype_1=Float64
andtype_2=Float32
,type_3=Float16
. It would also not work iftype_3=Float32
. It would only work if one or both oftype_2
andtype_3
is ofFloat64
type.Describe the solution you'd like
Rather than promoting the result of contraction of
b
andc
to the common type (I believe it is done natively by Julia under the hood), promote it to the type ofa
if possible (may not be possible, e.g., ifa
is real, whileb
andc
are complex).Describe alternatives you've considered
Keep types consistent with the signature of
ITensors.contract!(a, b, c, alpha, beta)
.The text was updated successfully, but these errors were encountered: