Open In App

Transform array to its complex conjugate in Julia – conj!() Method

Last Updated : 26 Mar, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The conj!() is an inbuilt function in julia which is used to transform the specified array to its complex conjugate in-place.

Syntax:
conj!(A)

Parameters:

  • A: Specified array.

Returns: It returns the transformed complex conjugate in-place.

Example 1:




# Julia program to illustrate 
# the use of Array conj!() method
   
# Getting complex conjugate of 1D array
A = [1+im, 2+im, 3+im, 4+im];
println(conj!(A))
   
# Getting complex conjugate of 2D array
B = [5+im 6+im; 7+im 8+im];
println(conj!(B))
   
# Getting complex conjugate of 3D array
C = cat([1+im 3+im; 5+im 7+im], 
        [2+im 4+im; 6+im 8+im],
        [5+im 10+im; 15+im 20+im], dims = 3);
println(conj!(C))


Output:

Example 2:




# Julia program to illustrate 
# the use of Array conj!() method
  
# Getting complex conjugate of 1D array
A = [1+2im, 3+4im];
println(conj!(A))
  
# Getting complex conjugate of 2D array
B = [5+2im 6+3im; 7+4im 8+5im];
println(conj!(B))
  
# Getting complex conjugate of 3D array
C = cat([1+2im 3+4im; 5+6im 7+8im], 
        [2+4im 4+6im; 6+8im 8+10im], 
        [5+6im 10+11im; 15+16im 20+17im], dims = 3);
println(conj!(C))


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads