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

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:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Previous
Next