⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intrinsic.texi

📁 gcc-fortran,linux使用fortran的编译软件。很好用的。
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@item @emph{Syntax}:@code{C = CHAR(I[,KIND])}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{I} @tab The type shall be @code{INTEGER(*)}.@item @var{KIND} @tab Optional scaler integer initialization expression.@end multitable@item @emph{Return value}:The return value is of type @code{CHARACTER(1)}@item @emph{Example}:@smallexampleprogram test_char    integer :: i = 74    character(1) :: c    c = char(i)    print *, i, c ! returns 'J'end program test_char@end smallexample@end table@node CMPLX@section @code{CMPLX} --- Complex conversion function@findex @code{CMPLX} intrinsic@cindex CMPLX@table @asis@item @emph{Description}:@code{CMPLX(X,[Y,KIND])} returns a complex number where @var{X} is converted tothe real component.  If @var{Y} is present it is converted to the imaginarycomponent.  If @var{Y} is not present then the imaginary component is set to0.0.  If @var{X} is complex then @var{Y} must not be present.@item @emph{Option}:f95, gnu@item @emph{Class}:elemental function@item @emph{Syntax}:@code{C = CMPLX(X[,Y,KIND])}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.@item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}.  May be @code{INTEGER(*)} or @code{REAL(*)}. @item @var{KIND} @tab Optional scaler integer initialization expression.@end multitable@item @emph{Return value}:The return value is of type @code{COMPLEX(*)}@item @emph{Example}:@smallexampleprogram test_cmplx    integer :: i = 42    real :: x = 3.14    complex :: z    z = cmplx(i, x)    print *, z, cmplx(x)end program test_cmplx@end smallexample@end table@node COMMAND_ARGUMENT_COUNT@section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic@cindex command argument count@table @asis@item @emph{Description}:@code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on thecommand line when the containing program was invoked.@item @emph{Option}:f2003, gnu@item @emph{Class}:non-elemental function@item @emph{Syntax}:@code{I = COMMAND_ARGUMENT_COUNT()}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item None@end multitable@item @emph{Return value}:The return value is of type @code{INTEGER(4)}@item @emph{Example}:@smallexampleprogram test_command_argument_count    integer :: count    count = command_argument_count()    print *, countend program test_command_argument_count@end smallexample@end table@node CONJG@section @code{CONJG} --- Complex conjugate function @findex @code{CONJG} intrinsic@findex @code{DCONJG} intrinsic@cindex complex conjugate@table @asis@item @emph{Description}:@code{CONJG(Z)} returns the conjugate of @var{Z}.  If @var{Z} is @code{(x, y)}then the result is @code{(x, -y)}@item @emph{Option}:f95, gnu@item @emph{Class}:elemental function@item @emph{Syntax}:@code{Z = CONJG(Z)}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{Z} @tab The type shall be @code{COMPLEX(*)}.@end multitable@item @emph{Return value}:The return value is of type @code{COMPLEX(*)}.@item @emph{Example}:@smallexampleprogram test_conjg    complex :: z = (2.0, 3.0)    complex(8) :: dz = (2.71_8, -3.14_8)    z= conjg(z)    print *, z    dz = dconjg(dz)    print *, dzend program test_conjg@end smallexample@item @emph{Specific names}:@multitable @columnfractions .24 .24 .24 .24@item Name             @tab Argument             @tab Return type          @tab Option@item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z}  @tab @code{COMPLEX(8)}    @tab gnu@end multitable@end table@node COS@section @code{COS} --- Cosine function @findex @code{COS} intrinsic@findex @code{DCOS} intrinsic@findex @code{ZCOS} intrinsic@findex @code{CDCOS} intrinsic@cindex cosine@table @asis@item @emph{Description}:@code{COS(X)} computes the cosine of @var{X}.@item @emph{Option}:f95, gnu@item @emph{Class}:elemental function@item @emph{Syntax}:@code{X = COS(X)}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{X} @tab The type shall be @code{REAL(*)} or@code{COMPLEX(*)}.@end multitable@item @emph{Return value}:The return value has the same type and kind as @var{X}.@item @emph{Example}:@smallexampleprogram test_cos  real :: x = 0.0  x = cos(x)end program test_cos@end smallexample@item @emph{Specific names}:@multitable @columnfractions .24 .24 .24 .24@item Name            @tab Argument          @tab Return type     @tab Option@item @code{DCOS(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}  @tab f95, gnu@item @code{CCOS(X)}@tab @code{COMPLEX(4) X}@tab @code{COMPLEX(4)}@tab f95, gnu@item @code{ZCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu@item @code{CDCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu@end multitable@end table@node COSH@section @code{COSH} --- Hyperbolic cosine function @findex @code{COSH} intrinsic@findex @code{DCOSH} intrinsic@cindex hyperbolic cosine@table @asis@item @emph{Description}:@code{COSH(X)} computes the hyperbolic cosine of @var{X}.@item @emph{Option}:f95, gnu@item @emph{Class}:elemental function@item @emph{Syntax}:@code{X = COSH(X)}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{X} @tab The type shall be @code{REAL(*)}.@end multitable@item @emph{Return value}:The return value is of type @code{REAL(*)} and it is positive(@math{ \cosh (x) \geq 0 }.@item @emph{Example}:@smallexampleprogram test_cosh  real(8) :: x = 1.0_8  x = cosh(x)end program test_cosh@end smallexample@item @emph{Specific names}:@multitable @columnfractions .24 .24 .24 .24@item Name            @tab Argument          @tab Return type       @tab Option@item @code{DCOSH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu@end multitable@end table@node COUNT@section @code{COUNT} --- Count function@findex @code{COUNT} intrinsic@cindex count@table @asis@item @emph{Description}:@code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of@var{MASK} along the dimension of @var{DIM}.  If @var{DIM} is omitted it istaken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in therange of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.@item @emph{Option}:f95, gnu@item @emph{Class}:transformational function@item @emph{Syntax}:@code{I = COUNT(MASK[,DIM])}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{MASK} @tab The type shall be @code{LOGICAL}.@item @var{DIM}  @tab The type shall be @code{INTEGER}.@end multitable@item @emph{Return value}:The return value is of type @code{INTEGER} with rank equal to that of@var{MASK}.@item @emph{Example}:@smallexampleprogram test_count    integer, dimension(2,3) :: a, b    logical, dimension(2,3) :: mask    a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))    b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))    print '(3i3)', a(1,:)    print '(3i3)', a(2,:)    print *    print '(3i3)', b(1,:)    print '(3i3)', b(2,:)    print *    mask = a.ne.b    print '(3l3)', mask(1,:)    print '(3l3)', mask(2,:)    print *    print '(3i3)', count(mask)    print *    print '(3i3)', count(mask, 1)    print *    print '(3i3)', count(mask, 2)end program test_count@end smallexample@end table@node CPU_TIME@section @code{CPU_TIME} --- CPU elapsed time in seconds@findex @code{CPU_TIME} intrinsic@cindex CPU_TIME@table @asis@item @emph{Description}:Returns a @code{REAL} value representing the elapsed CPU time in seconds.  Thisis useful for testing segments of code to determine execution time.@item @emph{Option}:f95, gnu@item @emph{Class}:subroutine@item @emph{Syntax}:@code{CPU_TIME(X)}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.@end multitable@item @emph{Return value}:None@item @emph{Example}:@smallexampleprogram test_cpu_time    real :: start, finish    call cpu_time(start)        ! put code to test here    call cpu_time(finish)    print '("Time = ",f6.3," seconds.")',finish-startend program test_cpu_time@end smallexample@end table@node CSHIFT@section @code{CSHIFT} --- Circular shift function@findex @code{CSHIFT} intrinsic@cindex cshift intrinsic@table @asis@item @emph{Description}:@code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of@var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is omitted it istaken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in therange of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shiftedby @var{SHIFT} places.  If rank is greater than one, then all complete rank onesections of @var{ARRAY} along the given dimension are shifted.  Elementsshifted out one end of each rank one section are shifted back in the other end.@item @emph{Option}:f95, gnu@item @emph{Class}:transformational function@item @emph{Syntax}:@code{A = CSHIFT(A, SHIFT[,DIM])}@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{ARRAY}  @tab May be any type, not scaler.@item @var{SHIFT}  @tab The type shall be @code{INTEGER}.@item @var{DIM}    @tab The type shall be @code{INTEGER}.@end multitable@item @emph{Return value}:Returns an array of same type and rank as the @var{ARRAY} argument.@item @emph{Example}:@smallexampleprogram test_cshift    integer, dimension(3,3) :: a    a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))    print '(3i3)', a(1,:)    print '(3i3)', a(2,:)    print '(3i3)', a(3,:)        a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)    print *    print '(3i3)', a(1,:)    print '(3i3)', a(2,:)    print '(3i3)', a(3,:)end program test_cshift@end smallexample@end table@node CTIME@section @code{CTIME} --- Convert a time into a string@findex @code{CTIME} intrinsic@cindex ctime subroutine @table @asis@item @emph{Description}:@code{CTIME(T,S)} converts @var{T}, a system time value, such as returnedby @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:141995}, and returns that string into @var{S}.If @code{CTIME} is invoked as a function, it can not be invoked as asubroutine, and vice versa.@var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.@var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.@item @emph{Option}:gnu@item @emph{Class}:subroutine@item @emph{Syntax}:@multitable @columnfractions .80@item @code{CALL CTIME(T,S)}.@item @code{S = CTIME(T)}, (not recommended).@end multitable@item @emph{Arguments}:@multitable @columnfractions .15 .80@item @var{S}@tab The type shall be of type @code{CHARACTER}.@item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.@end multitable@item @emph{Return value}:The converted date and time as a string.@item @emph{Example}:@smallexampleprogram test_ctime    integer(8) :: i    character(len=30) :: date    i = time8()    ! Do something, main part of the program        call ctime(i,date)    print *, 'Program was started on ', dateend program test_ctime@end smallexample@end table@node DATE_AND_TIME@section @code{DATE_AND_TIME} --- Date and time subroutine@findex @code{DATE_AND_TIME} intrinsic@cindex DATE_AND_TIME@table @asis@item @emph{Description}:@code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date andtime information from the real-time system clock.  @var{DATE} is@code{INTENT(OUT)} and has form ccyymmdd.  @var{TIME} is @code{INTENT(OUT)} andhas form hhmmss.sss.  @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,representing the difference with respect to Coordinated Universal Time (UTC).Unavailable time and date parameters return blanks.@var{VALUES} is @code{INTENT(OUT)} and provides the following:@multitable @columnfractions .15 .30 .60@item @tab @code{VALUE(1)}: @tab The year

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -