ComplexOperations.complex_divide
— MethodDivision of two vectors Z1=a+im*b and Z2=c+im*d.
a, b, c, and d are all real numbers or arrays of real numbers. All shoud have the same size. Division algorithm for complex numbers can be found here: https://en.wikipedia.org/wiki/Multiplication_algorithm
ComplexOperations.complex_divide
— MethodDivision of two vectors Z1 and Z2.
We assume the first and second columns of each vector are the real and imaginary parts, respectively Each of Z1 and Z2 has two columns, and arbitrary number of rows. Division algorithm for complex numbers can be found here: https://en.wikipedia.org/wiki/Multiplication_algorithm
ComplexOperations.complex_matrix_inversion
— MethodCalculate the inverse of a complex matrix A+iB, where A and B are real matrices
There are two possible versions: Version #1: This one preallocate. Faster and use more memory for 1M evaluations: 1.771474 seconds (14.18 M allocations: 4.510 GiB, 4.52% gc time, 6.40% compilation time) function complex_matrix_inversion(A, B) inv_A_B = inv(A) * B C = inv(A + B * inv_A_B) D = -inv_A_B * C return C, D end
Version #2: No preallocation. Slower and use less memory for 1M evaluations: 2.330454 seconds (19.00 M allocations: 6.512 GiB, 2.71% gc time) function complex_matrix_inversion(A, B) C = inv(A + B * inv(A) * B) D = -1 .* inv(A) * B * C return C, D end
ComplexOperations.complex_matrix_multiplication
— MethodMultiply two matrices A+iB and C+iD, where A,B,C,D are real matrices
ComplexOperations.complex_multiply
— MethodMultiplication of two vectors Z1=a+im*b and Z2=c+im*d.
a, b, c, and d are all real numbers or arrays of real numbers. All shoud have the same size. Multiplication algorithm for complex numbers can be found here: https://en.wikipedia.org/wiki/Multiplication_algorithm
ComplexOperations.complex_multiply
— MethodMultiplication of two vectors Z1 and Z2.
We assume the first and second columns of each vector are the real and imaginary parts, respectively Each of Z1 and Z2 has two columns, and arbitrary number of rows. Multiplication algorithm for complex numbers can be found here: https://en.wikipedia.org/wiki/Multiplication_algorithm
ComplexOperations.complex_vector_cross_product
— MethodClaculate cross product of two vectors, inputs are real and imaginary parts of the two vectors
Each is represented as 3-element array.
ComplexOperations.complex_vector_cross_product
— MethodClaculate cross product of two vectors
Each is represented as 3x2 or 3x1 Array. The first and second columns represent the real and imag parts, respectively For real vectors, we can input them as 3x1 Array or 3-element Vector
ComplexOperations.complex_vector_dot_product
— MethodClaculate dot product of two vectors, inputs are real and imaginary parts of the two vectors
Each is represented as 3-element array.
ComplexOperations.complex_vector_dot_product
— MethodClaculate dot product of two vectors
Each is represented as 3x2 or 3x1 Array. The first and second columns represent the real and imag parts, respectively For real vectors, we can input them as 3x1 Array or 3-element Vector