Conj#
- class deeptrack.elementwise.Conj(feature: Feature | None = None, **kwargs: Any)#
Bases:
ElementwiseFeatureApply the complex conjugate function elementwise.
This feature applies xp.conj to each element in a NumPy array or a PyTorch tensor. It supports both direct input and pipeline composition.
For real-valued inputs, the result is unchanged. For complex-valued inputs, it returns the complex conjugate (i.e., a + bj → a - bj).
Parameters#
- feature: Feature | None, optional
The input feature to which the conjugate function will be applied. If None, the function is applied directly to the input array or tensor.
Examples#
>>> import deeptrack as dt >>> from deeptrack.elementwise import Conj
Use with NumPy directly:
>>> import numpy as np >>> result = Conj()(np.array([1+2j, 3+0j, -4.5])) >>> result array([ 1.-2.j, 3.-0.j, -4.5+0.j])
Use with PyTorch directly:
>>> import torch >>> result = Conj()(torch.tensor([1+2j, 3+0j, -4.5+0j])) >>> result tensor([ 1.-2.j, 3.-0.j, -4.5+0.j])
Use in a pipeline with a NumPy value:
>>> value = dt.Value(value=np.array([1+2j, 3+0j, -4.5])) >>> pipeline = value >> Conj() >>> result = pipeline() >>> result array([ 1.-2.j, 3.-0.j, -4.5+0.j])
Use in a pipeline with a PyTorch value:
>>> value = dt.Value(value=torch.tensor([1+2j, 3+0j, -4.5+0j])) >>> pipeline = value >> Conj() >>> result = pipeline() >>> result tensor([ 1.-2.j, 3.-0.j, -4.5+0.j])
These are equivalent to:
>>> pipeline = Conj(value)