conj!
conj!(A)
Convert an array to its complex conjugate in-place
Examples
-
Convert an array to its complex conjugate:
julia> A = [1+2im, 3-4im, 5+6im]; julia> conj!(A) 3-element Array{Complex{Int64},1}: 1 - 2im 3 + 4im 5 - 6imThis example converts the array
Ato its complex conjugate in-place. The imaginary parts of each element are multiplied by -1. - Modify a matrix of complex numbers:
julia> M = [1+2im 3-4im; 5+6im 7-8im]; julia> conj!(M) 2×2 Array{Complex{Int64},2}: 1 - 2im 3 + 4im 5 - 6im 7 + 8imIt converts each element of the matrix
Mto its complex conjugate.
Common mistake example:
julia> B = [1 2; 3 4];
julia> conj!(B)
ERROR: MethodError: no method matching conj!(::Array{Int64,2})
In this example, the function conj! is called on a non-complex array. The conj! function is specifically designed for complex arrays, so ensure that the input array contains complex numbers before using conj!.
See Also
Array, broadcast, cat, combinations, conj!, digits!, fieldnames, fill, fill!, last, length, maximum, minimum, ones, parent, parentindexes, partitions, permutations, pointer, pointer_to_array, promote_shape, rand!, reshape, scale, similar, sum, sum_kbn, takebuf_array, transpose!, vec, zeros,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.