Mercurial > hg > CbC > CbC_gcc
comparison gcc/fortran/intrinsic.texi @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 @ignore | 1 @ignore |
2 Copyright (C) 2005-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2005-2018 Free Software Foundation, Inc. |
3 This is part of the GNU Fortran manual. | 3 This is part of the GNU Fortran manual. |
4 For copying conditions, see the file gfortran.texi. | 4 For copying conditions, see the file gfortran.texi. |
5 | 5 |
6 Permission is granted to copy, distribute and/or modify this document | 6 Permission is granted to copy, distribute and/or modify this document |
7 under the terms of the GNU Free Documentation License, Version 1.3 or | 7 under the terms of the GNU Free Documentation License, Version 1.3 or |
260 * @code{PRESENT}: PRESENT, Determine whether an optional dummy argument is specified | 260 * @code{PRESENT}: PRESENT, Determine whether an optional dummy argument is specified |
261 * @code{PRODUCT}: PRODUCT, Product of array elements | 261 * @code{PRODUCT}: PRODUCT, Product of array elements |
262 * @code{RADIX}: RADIX, Base of a data model | 262 * @code{RADIX}: RADIX, Base of a data model |
263 * @code{RAN}: RAN, Real pseudo-random number | 263 * @code{RAN}: RAN, Real pseudo-random number |
264 * @code{RAND}: RAND, Real pseudo-random number | 264 * @code{RAND}: RAND, Real pseudo-random number |
265 * @code{RANDOM_INIT}: RANDOM_INIT, Initialize pseudo-random number generator | |
265 * @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number | 266 * @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number |
266 * @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence | 267 * @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence |
267 * @code{RANGE}: RANGE, Decimal exponent range | 268 * @code{RANGE}: RANGE, Decimal exponent range |
268 * @code{RANK} : RANK, Rank of a data object | 269 * @code{RANK} : RANK, Rank of a data object |
269 * @code{REAL}: REAL, Convert to real type | 270 * @code{REAL}: REAL, Convert to real type |
8713 @fnindex KILL | 8714 @fnindex KILL |
8714 | 8715 |
8715 @table @asis | 8716 @table @asis |
8716 @item @emph{Description}: | 8717 @item @emph{Description}: |
8717 @item @emph{Standard}: | 8718 @item @emph{Standard}: |
8718 Sends the signal specified by @var{SIGNAL} to the process @var{PID}. | 8719 Sends the signal specified by @var{SIG} to the process @var{PID}. |
8719 See @code{kill(2)}. | 8720 See @code{kill(2)}. |
8720 | 8721 |
8721 This intrinsic is provided in both subroutine and function forms; however, | 8722 This intrinsic is provided in both subroutine and function forms; |
8722 only one form can be used in any given program unit. | 8723 however, only one form can be used in any given program unit. |
8723 | 8724 |
8724 @item @emph{Class}: | 8725 @item @emph{Class}: |
8725 Subroutine, function | 8726 Subroutine, function |
8726 | 8727 |
8727 @item @emph{Syntax}: | 8728 @item @emph{Syntax}: |
8728 @multitable @columnfractions .80 | 8729 @multitable @columnfractions .80 |
8729 @item @code{CALL KILL(C, VALUE [, STATUS])} | 8730 @item @code{CALL KILL(PID, SIG [, STATUS])} |
8730 @item @code{STATUS = KILL(C, VALUE)} | 8731 @item @code{STATUS = KILL(PID, SIG)} |
8731 @end multitable | 8732 @end multitable |
8732 | 8733 |
8733 @item @emph{Arguments}: | 8734 @item @emph{Arguments}: |
8734 @multitable @columnfractions .15 .70 | 8735 @multitable @columnfractions .15 .70 |
8735 @item @var{C} @tab Shall be a scalar @code{INTEGER}, with | 8736 @item @var{PID} @tab Shall be a scalar @code{INTEGER} with @code{INTENT(IN)}. |
8736 @code{INTENT(IN)} | 8737 @item @var{SIG} @tab Shall be a scalar @code{INTEGER} with @code{INTENT(IN)}. |
8737 @item @var{VALUE} @tab Shall be a scalar @code{INTEGER}, with | 8738 @item @var{STATUS} @tab [Subroutine](Optional) |
8738 @code{INTENT(IN)} | 8739 Shall be a scalar @code{INTEGER}. |
8739 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)} or | 8740 Returns 0 on success; otherwise a system-specific error code is returned. |
8740 @code{INTEGER(8)}. Returns 0 on success, or a system-specific error code | 8741 @item @var{STATUS} @tab [Function] The kind type parameter is that of |
8741 otherwise. | 8742 @code{pid}. |
8743 Returns 0 on success; otherwise a system-specific error code is returned. | |
8742 @end multitable | 8744 @end multitable |
8743 | 8745 |
8744 @item @emph{See also}: | 8746 @item @emph{See also}: |
8745 @ref{ABORT}, @ref{EXIT} | 8747 @ref{ABORT}, @ref{EXIT} |
8746 @end table | 8748 @end table |
8747 | |
8748 | 8749 |
8749 | 8750 |
8750 @node KIND | 8751 @node KIND |
8751 @section @code{KIND} --- Kind of an entity | 8752 @section @code{KIND} --- Kind of an entity |
8752 @fnindex KIND | 8753 @fnindex KIND |
9868 @item @var{MATRIX_B} @tab An array of @code{INTEGER}, | 9869 @item @var{MATRIX_B} @tab An array of @code{INTEGER}, |
9869 @code{REAL}, or @code{COMPLEX} type if @var{MATRIX_A} is of a numeric | 9870 @code{REAL}, or @code{COMPLEX} type if @var{MATRIX_A} is of a numeric |
9870 type; otherwise, an array of @code{LOGICAL} type. The rank shall be one | 9871 type; otherwise, an array of @code{LOGICAL} type. The rank shall be one |
9871 or two, and the first (or only) dimension of @var{MATRIX_B} shall be | 9872 or two, and the first (or only) dimension of @var{MATRIX_B} shall be |
9872 equal to the last (or only) dimension of @var{MATRIX_A}. | 9873 equal to the last (or only) dimension of @var{MATRIX_A}. |
9874 @var{MATRIX_A} and @var{MATRIX_B} shall not both be rank one arrays. | |
9873 @end multitable | 9875 @end multitable |
9874 | 9876 |
9875 @item @emph{Return value}: | 9877 @item @emph{Return value}: |
9876 The matrix product of @var{MATRIX_A} and @var{MATRIX_B}. The type and | 9878 The matrix product of @var{MATRIX_A} and @var{MATRIX_B}. The type and |
9877 kind of the result follow the usual type and kind promotion rules, as | 9879 kind of the result follow the usual type and kind promotion rules, as |
9988 value, or, if the @var{DIM} argument is supplied, determines the | 9990 value, or, if the @var{DIM} argument is supplied, determines the |
9989 locations of the maximum element along each row of the array in the | 9991 locations of the maximum element along each row of the array in the |
9990 @var{DIM} direction. If @var{MASK} is present, only the elements for | 9992 @var{DIM} direction. If @var{MASK} is present, only the elements for |
9991 which @var{MASK} is @code{.TRUE.} are considered. If more than one | 9993 which @var{MASK} is @code{.TRUE.} are considered. If more than one |
9992 element in the array has the maximum value, the location returned is | 9994 element in the array has the maximum value, the location returned is |
9993 that of the first such element in array element order. If the array has | 9995 that of the first such element in array element order if the |
9994 zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then | 9996 @var{BACK} is not present, or if it false; otherwise, the location |
9997 returned is that of the first such element. If the array has zero | |
9998 size, or all of the elements of @var{MASK} are @code{.FALSE.}, then | |
9995 the result is an array of zeroes. Similarly, if @var{DIM} is supplied | 9999 the result is an array of zeroes. Similarly, if @var{DIM} is supplied |
9996 and all of the elements of @var{MASK} along a given row are zero, the | 10000 and all of the elements of @var{MASK} along a given row are zero, the |
9997 result value for that row is zero. | 10001 result value for that row is zero. |
9998 | 10002 |
9999 @item @emph{Standard}: | 10003 @item @emph{Standard}: |
10000 Fortran 95 and later | 10004 Fortran 95 and later; @var{ARRAY} of @code{CHARACTER} and the |
10005 @var{KIND} argument are available in Fortran 2003 and later. | |
10006 The @var{BACK} argument is available in Fortran 2008 and later. | |
10001 | 10007 |
10002 @item @emph{Class}: | 10008 @item @emph{Class}: |
10003 Transformational function | 10009 Transformational function |
10004 | 10010 |
10005 @item @emph{Syntax}: | 10011 @item @emph{Syntax}: |
10006 @multitable @columnfractions .80 | 10012 @multitable @columnfractions .80 |
10007 @item @code{RESULT = MAXLOC(ARRAY, DIM [, MASK])} | 10013 @item @code{RESULT = MAXLOC(ARRAY, DIM [, MASK] [,KIND] [,BACK])} |
10008 @item @code{RESULT = MAXLOC(ARRAY [, MASK])} | 10014 @item @code{RESULT = MAXLOC(ARRAY [, MASK] [,KIND] [,BACK])} |
10009 @end multitable | 10015 @end multitable |
10010 | 10016 |
10011 @item @emph{Arguments}: | 10017 @item @emph{Arguments}: |
10012 @multitable @columnfractions .15 .70 | 10018 @multitable @columnfractions .15 .70 |
10013 @item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or | 10019 @item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or |
10015 @item @var{DIM} @tab (Optional) Shall be a scalar of type | 10021 @item @var{DIM} @tab (Optional) Shall be a scalar of type |
10016 @code{INTEGER}, with a value between one and the rank of @var{ARRAY}, | 10022 @code{INTEGER}, with a value between one and the rank of @var{ARRAY}, |
10017 inclusive. It may not be an optional dummy argument. | 10023 inclusive. It may not be an optional dummy argument. |
10018 @item @var{MASK} @tab Shall be an array of type @code{LOGICAL}, | 10024 @item @var{MASK} @tab Shall be an array of type @code{LOGICAL}, |
10019 and conformable with @var{ARRAY}. | 10025 and conformable with @var{ARRAY}. |
10026 @item @var{KIND} @tab (Optional) An @code{INTEGER} initialization | |
10027 expression indicating the kind parameter of the result. | |
10028 @item @var{BACK} @tab (Optional) A scalar of type @code{LOGICAL}. | |
10020 @end multitable | 10029 @end multitable |
10021 | 10030 |
10022 @item @emph{Return value}: | 10031 @item @emph{Return value}: |
10023 If @var{DIM} is absent, the result is a rank-one array with a length | 10032 If @var{DIM} is absent, the result is a rank-one array with a length |
10024 equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result | 10033 equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result |
10025 is an array with a rank one less than the rank of @var{ARRAY}, and a | 10034 is an array with a rank one less than the rank of @var{ARRAY}, and a |
10026 size corresponding to the size of @var{ARRAY} with the @var{DIM} | 10035 size corresponding to the size of @var{ARRAY} with the @var{DIM} |
10027 dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank | 10036 dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank |
10028 of one, the result is a scalar. In all cases, the result is of default | 10037 of one, the result is a scalar. If the optional argument @var{KIND} |
10029 @code{INTEGER} type. | 10038 is present, the result is an integer of kind @var{KIND}, otherwise it |
10039 is of default kind. | |
10030 | 10040 |
10031 @item @emph{See also}: | 10041 @item @emph{See also}: |
10032 @ref{MAX}, @ref{MAXVAL} | 10042 @ref{MAX}, @ref{MAXVAL} |
10033 | 10043 |
10034 @end table | 10044 @end table |
10336 value, or, if the @var{DIM} argument is supplied, determines the | 10346 value, or, if the @var{DIM} argument is supplied, determines the |
10337 locations of the minimum element along each row of the array in the | 10347 locations of the minimum element along each row of the array in the |
10338 @var{DIM} direction. If @var{MASK} is present, only the elements for | 10348 @var{DIM} direction. If @var{MASK} is present, only the elements for |
10339 which @var{MASK} is @code{.TRUE.} are considered. If more than one | 10349 which @var{MASK} is @code{.TRUE.} are considered. If more than one |
10340 element in the array has the minimum value, the location returned is | 10350 element in the array has the minimum value, the location returned is |
10341 that of the first such element in array element order. If the array has | 10351 that of the first such element in array element order if the |
10352 @var{BACK} is not present, or if it false; otherwise, the location | |
10353 returned is that of the first such element. If the array has | |
10342 zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then | 10354 zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then |
10343 the result is an array of zeroes. Similarly, if @var{DIM} is supplied | 10355 the result is an array of zeroes. Similarly, if @var{DIM} is supplied |
10344 and all of the elements of @var{MASK} along a given row are zero, the | 10356 and all of the elements of @var{MASK} along a given row are zero, the |
10345 result value for that row is zero. | 10357 result value for that row is zero. |
10346 | 10358 |
10347 @item @emph{Standard}: | 10359 @item @emph{Standard}: |
10348 Fortran 95 and later | 10360 Fortran 95 and later; @var{ARRAY} of @code{CHARACTER} and the |
10361 @var{KIND} argument are available in Fortran 2003 and later. | |
10362 The @var{BACK} argument is available in Fortran 2008 and later. | |
10349 | 10363 |
10350 @item @emph{Class}: | 10364 @item @emph{Class}: |
10351 Transformational function | 10365 Transformational function |
10352 | 10366 |
10353 @item @emph{Syntax}: | 10367 @item @emph{Syntax}: |
10354 @multitable @columnfractions .80 | 10368 @multitable @columnfractions .80 |
10355 @item @code{RESULT = MINLOC(ARRAY, DIM [, MASK])} | 10369 @item @code{RESULT = MINLOC(ARRAY, DIM [, MASK] [,KIND] [,BACK])} |
10356 @item @code{RESULT = MINLOC(ARRAY [, MASK])} | 10370 @item @code{RESULT = MINLOC(ARRAY [, MASK], [,KIND] [,BACK])} |
10357 @end multitable | 10371 @end multitable |
10358 | 10372 |
10359 @item @emph{Arguments}: | 10373 @item @emph{Arguments}: |
10360 @multitable @columnfractions .15 .70 | 10374 @multitable @columnfractions .15 .70 |
10361 @item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or | 10375 @item @var{ARRAY} @tab Shall be an array of type @code{INTEGER}, |
10362 @code{REAL}. | 10376 @code{REAL} or @code{CHARACTER}. |
10363 @item @var{DIM} @tab (Optional) Shall be a scalar of type | 10377 @item @var{DIM} @tab (Optional) Shall be a scalar of type |
10364 @code{INTEGER}, with a value between one and the rank of @var{ARRAY}, | 10378 @code{INTEGER}, with a value between one and the rank of @var{ARRAY}, |
10365 inclusive. It may not be an optional dummy argument. | 10379 inclusive. It may not be an optional dummy argument. |
10366 @item @var{MASK} @tab Shall be an array of type @code{LOGICAL}, | 10380 @item @var{MASK} @tab Shall be an array of type @code{LOGICAL}, |
10367 and conformable with @var{ARRAY}. | 10381 and conformable with @var{ARRAY}. |
10382 @item @var{KIND} @tab (Optional) An @code{INTEGER} initialization | |
10383 expression indicating the kind parameter of the result. | |
10384 @item @var{BACK} @tab (Optional) A scalar of type @code{LOGICAL}. | |
10368 @end multitable | 10385 @end multitable |
10369 | 10386 |
10370 @item @emph{Return value}: | 10387 @item @emph{Return value}: |
10371 If @var{DIM} is absent, the result is a rank-one array with a length | 10388 If @var{DIM} is absent, the result is a rank-one array with a length |
10372 equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result | 10389 equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result |
10373 is an array with a rank one less than the rank of @var{ARRAY}, and a | 10390 is an array with a rank one less than the rank of @var{ARRAY}, and a |
10374 size corresponding to the size of @var{ARRAY} with the @var{DIM} | 10391 size corresponding to the size of @var{ARRAY} with the @var{DIM} |
10375 dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank | 10392 dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank |
10376 of one, the result is a scalar. In all cases, the result is of default | 10393 of one, the result is a scalar. If the optional argument @var{KIND} |
10377 @code{INTEGER} type. | 10394 is present, the result is an integer of kind @var{KIND}, otherwise it |
10395 is of default kind. | |
10378 | 10396 |
10379 @item @emph{See also}: | 10397 @item @emph{See also}: |
10380 @ref{MIN}, @ref{MINVAL} | 10398 @ref{MIN}, @ref{MINVAL} |
10381 | 10399 |
10382 @end table | 10400 @end table |
11579 @ref{SRAND}, @ref{RANDOM_NUMBER} | 11597 @ref{SRAND}, @ref{RANDOM_NUMBER} |
11580 | 11598 |
11581 @end table | 11599 @end table |
11582 | 11600 |
11583 | 11601 |
11602 @node RANDOM_INIT | |
11603 @section @code{RANDOM_INIT} --- Initialize a pseudo-random number generator | |
11604 @fnindex RANDOM_INIT | |
11605 @cindex random number generation, initialization | |
11606 | |
11607 @table @asis | |
11608 @item @emph{Description}: | |
11609 Initializes the state of the pseudorandom number generator used by | |
11610 @code{RANDOM_NUMBER}. | |
11611 | |
11612 @item @emph{Standard}: | |
11613 Fortran 2018 | |
11614 | |
11615 @item @emph{Class}: | |
11616 Subroutine | |
11617 | |
11618 @item @emph{Syntax}: | |
11619 @code{CALL RANDOM_INIT(REPEATABLE, IMAGE_DISTINCT)} | |
11620 | |
11621 @item @emph{Arguments}: | |
11622 @multitable @columnfractions .20 .75 | |
11623 @item @var{REPEATABLE} @tab Shall be a scalar with a @code{LOGICAL} type, | |
11624 and it is @code{INTENT(IN)}. If it is @code{.true.}, the seed is set to | |
11625 a processor-dependent value that is the same each time @code{RANDOM_INIT} | |
11626 is called from the same image. The term ``same image'' means a single | |
11627 instance of program execution. The sequence of random numbers is different | |
11628 for repeated execution of the program. If it is @code{.false.}, the seed | |
11629 is set to a processor-dependent value. | |
11630 @item @var{IMAGE_DISTINCT} @tab Shall be a scalar with a | |
11631 @code{LOGICAL} type, and it is @code{INTENT(IN)}. If it is @code{.true.}, | |
11632 the seed is set to a processor-dependent value that is distinct from th | |
11633 seed set by a call to @code{RANDOM_INIT} in another image. If it is | |
11634 @code{.false.}, the seed is set value that does depend which image called | |
11635 @code{RANDOM_INIT}. | |
11636 @end multitable | |
11637 | |
11638 @item @emph{Example}: | |
11639 @smallexample | |
11640 program test_random_seed | |
11641 implicit none | |
11642 real x(3), y(3) | |
11643 call random_init(.true., .true.) | |
11644 call random_number(x) | |
11645 call random_init(.true., .true.) | |
11646 call random_number(y) | |
11647 ! x and y are the same sequence | |
11648 if (any(x /= y)) call abort | |
11649 end program test_random_seed | |
11650 @end smallexample | |
11651 | |
11652 @item @emph{See also}: | |
11653 @ref{RANDOM_NUMBER}, @ref{RANDOM_SEED} | |
11654 @end table | |
11655 | |
11584 | 11656 |
11585 @node RANDOM_NUMBER | 11657 @node RANDOM_NUMBER |
11586 @section @code{RANDOM_NUMBER} --- Pseudo-random number | 11658 @section @code{RANDOM_NUMBER} --- Pseudo-random number |
11587 @fnindex RANDOM_NUMBER | 11659 @fnindex RANDOM_NUMBER |
11588 @cindex random number generation | 11660 @cindex random number generation |
11624 CALL RANDOM_NUMBER(r) | 11696 CALL RANDOM_NUMBER(r) |
11625 end program | 11697 end program |
11626 @end smallexample | 11698 @end smallexample |
11627 | 11699 |
11628 @item @emph{See also}: | 11700 @item @emph{See also}: |
11629 @ref{RANDOM_SEED} | 11701 @ref{RANDOM_SEED}, @ref{RANDOM_INIT} |
11630 @end table | 11702 @end table |
11631 | 11703 |
11632 | 11704 |
11633 | 11705 |
11634 @node RANDOM_SEED | 11706 @node RANDOM_SEED |
11694 write (*, *) seed | 11766 write (*, *) seed |
11695 end program test_random_seed | 11767 end program test_random_seed |
11696 @end smallexample | 11768 @end smallexample |
11697 | 11769 |
11698 @item @emph{See also}: | 11770 @item @emph{See also}: |
11699 @ref{RANDOM_NUMBER} | 11771 @ref{RANDOM_NUMBER}, @ref{RANDOM_INIT} |
11700 @end table | 11772 @end table |
11701 | 11773 |
11702 | 11774 |
11703 | 11775 |
11704 @node RANGE | 11776 @node RANGE |