# Numpy MaskedArray.conjugate() function | Python

`numpy.MaskedArray.conjugate() ` function is used to return the complex conjugate, element-wise.The conjugate of a complex number is obtained by changing the sign of its imaginary part.

Syntax : `numpy.ma.conjugate(arr, out=None, where=True, casting='same_kind', order='K', dtype=None, subok=True)`

Parameters:

arr :[ array_like] Input masked array which we want to conjugate.
out : [ndarray, optional] A location into which the result is stored.
-> If provided, it must have a shape that the inputs broadcast to.
-> If not provided or None, a freshly-allocated array is returned.
where : [array_like, optional] Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone.
casting :[ ‘no’, ‘equiv’, ‘safe’, ‘same_kind’, or ‘unsafe’] Provides a policy for what kind of casting is permitted.
order : The elements of a are read using this index order.
dtype :[dtype, optional] Type of the returned array, as well as of the accumulator in which the elements are multiplied.
subok : Defaults to true. If set to false, the output will always be a strict array, not a subtype.

Return : [ ndarray] The complex conjugate of arr.

Code #1 :

 `# Python program explaining ` `# numpy.MaskedArray.conjugate() method  ` `   `  `# importing numpy as geek   ` `# and numpy.ma module as ma  ` `import` `numpy as geek  ` `import` `numpy.ma as ma  ` `   `  `# creating input array   ` `in_arr ``=` `geek.array([[``1` `+` `2j``, ``2` `+` `3j``], [ ``3``-``2j``, ``-``1` `+` `2j``], [ ``5``-``4j``, ``-``3``-``3j``]]) ` `print` `(``"Input array : "``, in_arr)  ` `   `  `# Now we are creating a masked array.  ` `# by making two entry as invalid.   ` `mask_arr ``=` `ma.masked_array(in_arr, mask ``=``[[``1``, ``0``], [ ``1``, ``0``], [ ``0``, ``0``]])  ` `print` `(``"Masked array : "``, mask_arr)  ` `   `  `# applying MaskedArray.conjugate     ` `# methods to masked array ` `out_arr ``=` `ma.conjugate(mask_arr)  ` `print` `(``"conjugate of masked array : "``, out_arr)  `

Output:

```Input array :  [[ 1.+2.j  2.+3.j]
[ 3.-2.j -1.+2.j]
[ 5.-4.j -3.-3.j]]
[-- (-1+2j)]
[(5-4j) (-3-3j)]]
conjugate of masked array :  [[-- (2-3j)]
[-- (-1-2j)]
[(5+4j) (-3+3j)]
```
My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.