linop.ComponentDiagonal

linop.ComponentDiagonal#

class bartorch.linop.ComponentDiagonal#

Bases: LinearOperator

A diagonal on the real part and another on the imaginary part.

BART’s linop_rdiag, which is md_zrmul: the real part of the input is scaled by the real part of diag and the imaginary part by the imaginary part, each on its own. It is the operator for treating a complex array as two real channels, not the real-valued diagonal its BART name suggests: that is Diagonal given a real diagonal, adjoint included, since conjugating a real number does nothing.

So ComponentDiagonal(w) with a real w scales the real part by w and annihilates the imaginary part; scaling both takes w + 1j * w, or Diagonal.

Scaling two components separately is linear over the reals and not over the complex numbers, as Conj and Real are: it is self-adjoint for a real inner product and does not pass a complex dot test on its own.

Parameters:
  • diag (tensor) – Its real part scales real parts and its imaginary part scales imaginary parts. Every axis is either the operator’s size along that axis or one, and the ones are broadcast.

  • shape (tuple of int) – The shape the operator works on, C order.

Also has the methods and properties of LinearOperator.