Manual Reference Pages  - conjg (3fortran)

NAME

CONJG(3) - [NUMERIC] Complex conjugate of a complex value

SYNOPSIS

result = conjg(z)

         elemental complex(kind=KIND) function conjg(z)

complex(kind=**),intent(in) :: z

CHARACTERISTICS

o Z is a complex value of any valid kind.
o The returned value has the same complex type as the input.

DESCRIPTION

CONJG(3) returns the complex conjugate of the complex value Z.

That is, If Z is the complex value (X, Y) then the result is (X, -Y).

In mathematics, the complex conjugate of a complex number is a value whose real and imaginary part are equal parts are equal in magnitude to each other but the Y value has opposite sign.

For matrices of complex numbers, CONJG(ARRAY) represents the element-by-element conjugation of ARRAY; not the conjugate transpose of the ARRAY .

OPTIONS

o Z : The value to create the conjugate of.

RESULT

Returns a value equal to the input value except the sign of the imaginary component is the opposite of the input value.

That is, if Z has the value (X,Y), the result has the value (X, -Y).

EXAMPLES

Sample program:

    program demo_conjg
    use, intrinsic :: iso_fortran_env, only : real32, real64, real128
    implicit none
    complex :: z = (2.0, 3.0)
    complex(kind=real64) :: dz = (   &
       &  1.2345678901234567_real64, -1.2345678901234567_real64)
    complex :: arr(3,3)
    integer :: i
       ! basics
        ! notice the sine of the imaginary component changes
        print *, z, conjg(z)

! any complex kind is supported. z is of default kind but ! dz is kind=real64. print *, dz dz = conjg(dz) print *, dz print *

! the function is elemental so it can take arrays arr(1,:)=[(-1.0, 2.0),( 3.0, 4.0),( 5.0,-6.0)] arr(2,:)=[( 7.0,-8.0),( 8.0, 9.0),( 9.0, 9.0)] arr(3,:)=[( 1.0, 9.0),( 2.0, 0.0),(-3.0,-7.0)]

write(*,*)’original’ write(*,’(3("(",g8.2,",",g8.2,")",1x))’)(arr(i,:),i=1,3) arr = conjg(arr) write(*,*)’conjugate’ write(*,’(3("(",g8.2,",",g8.2,")",1x))’)(arr(i,:),i=1,3)

end program demo_conjg

Results:

     >  (2.000000,3.000000) (2.000000,-3.000000)
     >
     >  (1.23456789012346,-1.23456789012346)
     >  (1.23456789012346,1.23456789012346)
     >
     >  original
     > (-1.0    , 2.0    ) ( 3.0    , 4.0    ) ( 5.0    ,-6.0    )
     > ( 7.0    ,-8.0    ) ( 8.0    , 9.0    ) ( 9.0    , 9.0    )
     > ( 1.0    , 9.0    ) ( 2.0    , 0.0    ) (-3.0    ,-7.0    )
     >
     >  conjugate
     > (-1.0    ,-2.0    ) ( 3.0    ,-4.0    ) ( 5.0    , 6.0    )
     > ( 7.0    , 8.0    ) ( 8.0    ,-9.0    ) ( 9.0    ,-9.0    )
     > ( 1.0    ,-9.0    ) ( 2.0    , 0.0    ) (-3.0    , 7.0    )

STANDARD

FORTRAN 77

SEE ALSO

o AIMAG(3) - Imaginary part of complex number
o CMPLX(3) - Complex conversion function
o REAL(3) - Convert to real type
Fortran has strong support for complex values, including many intrinsics that take or produce complex values in addition to algebraic and logical expressions:

ABS(3), ACOSH(3), ACOS(3), ASINH(3), ASIN(3), ATAN2(3), ATANH(3), ATAN(3), COSH(3), COS(3), CO_SUM(3), DBLE(3), DOT_PRODUCT(3), EXP(3), INT(3), IS_CONTIGUOUS(3), KIND(3), LOG(3), MATMUL(3), PRECISION(3), PRODUCT(3), RANGE(3), RANK(3), SINH(3), SIN(3), SQRT(3), STORAGE_SIZE(3), SUM(3), TANH(3), TAN(3), UNPACK(3),

Fortran intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 conjg (3fortran) November 02, 2024
Generated by manServer 1.08 from e2e2019e-7bcc-4128-abb7-8117e6dcbdb4 using man macros.