conj#

ivy.conj(x, /, *, out=None)[source]#

Return the complex conjugate for each element x_i of the input array x.

For complex number of the form

\[a + bj\]

the complex conjugate is defined as

\[a - bj\]

Hence, the returned conjugates must be computed by negating the imaginary component of each element x_i

This method conforms to the Array API Standard. This docstring is an extension of the docstring in the standard.

Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts ivy.Container instances in place of any of the arguments.

Parameters:
  • x (Union[Array, NativeArray]) – input array.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

  • ret – an array of the same dtype as the input array with the complex conjugates of the complex values present in the input array. If x is a scalar then a scalar will be returned.

  • The descriptions above assume an array input for simplicity, but

  • the method also accepts ivy.Container instances

  • in place of (class:ivy.Array or ivy.NativeArray)

  • instances, as shown in the type hints and also the examples below.

Examples

With ivy.Array inputs: >>> x = ivy.array([4.2-0j, 3j, 7+5j]) >>> z = ivy.conj(x) >>> print(z) ivy.array([4.2-0.j, 0. -3.j, 7. -5.j])

With ivy.Container input: >>> x = ivy.Container(a=ivy.array([-6.7-7j, 0.314+0.355j, 1.23]), … b=ivy.array([5j, 5.32-6.55j, 3.001])) >>> z = ivy.conj(x) >>> print(z) {

a: ivy.array([-6.7+7.j, 0.314-0.355j, 1.23-0.j]), b: ivy.array([0.-5.j, 5.32+6.55j, 3.001-0.j])

}

Array.conj(self, /, *, out=None)[source]#

ivy.Array instance method variant of ivy.conj. This method simply wraps the function, and so the docstring for ivy.conj also applies to this method with minimal changes.

Parameters:
  • self (Array) – input array.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an array containing the complex conjugates of values in the input array, with the same dtype as the input array.

Examples

>>> x = ivy.array([4+3j, 6+2j, 1-6j])
>>> x.conj()
ivy.array([4-3j, 6-2j, 1+6j])
Container.conj(self, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.conj. This method simply wraps the function, and so the docstring for ivy.conj also applies to this method with minimal changes.

Parameters:
  • self (Container) – input container.

  • key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.

  • to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default is True.

  • prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied. Default is False.

  • map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples). Default is False.

  • out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Container

Returns:

ret – a container containing output array(s) of the same dtype as the input array(s) with the complex conjugates of the complex values present in the input array. If x is a container of scalar(s) then a container of scalar(s) will be returned.

Examples

>>> x = ivy.Container(a=ivy.array([-1j, 0.335+2.345j, 1.23+7j]),                          b=ivy.array([0.0, 1.2+3.3j, 1+0j]))
>>> x.conj()
{
    a: ivy.array([1j, 0.335-2345j, 1.23-7j]),
    b: ivy.array([0.0, 1.2-3.3j, 1-0j])
}