@@ -246,30 +246,28 @@ end
246246
247247# === similar_operator ===
248248#
249- # Allocate an operator with the user-supplied side as the domain (input) and
250- # the codomain (output) derived by `conj`-ing the domain axes and either
251- # randomizing the codomain names or accepting them explicitly. The 5-arg form
252- # is canonical; the others fill in defaults.
249+ # Allocate an operator with the user-supplied axes as the domain (input). The
250+ # codomain (output) shares the domain direction and either takes
251+ # explicitly-supplied names or fresh `randname` outputs. The 5-arg form is
252+ # canonical, the others fill in defaults. The bra/ket flip on the storage side
253+ # is handled inside `TA.similar_map`.
253254
254255"""
255256 similar_operator(prototype, [T,] unnamed_domain_axes, [codomain_names,] domain_names) -> op
256257 similar_operator(prototype, [T,] named_domain_axes) -> op
257258
258259Allocate an operator-shaped named array with undefined data, with the
259- user-supplied side as the domain (input) and the codomain (output) derived by
260- `conj`-ing the domain axes. Element type defaults to `eltype(prototype)`;
261- codomain names default to fresh `randname`-generated names. The first form
262- takes unnamed (raw) axes and explicit names; the second takes already-named
263- axes and reuses their names as the domain.
264-
265- The codomain axes are taken to be `conj.(unnamed_domain_axes)` — for plain
266- axes this is a no-op, while graded axes flip their sector arrows.
260+ user-supplied side as the domain (input) and a matching codomain (output).
261+ Element type defaults to `eltype(prototype)`. Codomain names default to fresh
262+ `randname`-generated names. The first form takes unnamed (raw) axes and
263+ explicit names, the second takes already-named axes and reuses their names as
264+ the domain. Storage layout (including the bra/ket flip on the domain side for
265+ graded axes) is delegated to `TensorAlgebra.similar_map`.
267266"""
268267function similar_operator (
269268 prototype, :: Type{T} , unnamed_domain_axes, codomain_names, domain_names
270269 ) where {T}
271- unnamed_codomain_axes = conj .(unnamed_domain_axes)
272- codomain_axes = named .(unnamed_codomain_axes, codomain_names)
270+ codomain_axes = named .(unnamed_domain_axes, codomain_names)
273271 domain_axes = named .(unnamed_domain_axes, domain_names)
274272 raw = TA. similar_map (prototype, T, codomain_axes, domain_axes)
275273 return operator (raw, codomain_names, domain_names)
0 commit comments