Module_Utilities¶
Copyright 2024 IRD
This file is part of statpack.
statpack is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
statpack is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You can find a copy of the GNU Lesser General Public License in the statpack/doc directory.
Authors: Pascal Terray (LOCEAN/IPSL, Paris, France)
MODULE EXPORTING GENERAL AND COMPUTING UTILITIES.
MANY OF THESE ROUTINES ARE ADAPTED AND EXTENDED FROM PUBLIC DOMAIN ROUTINES FROM Numerical Recipes.
LATEST REVISION : 11/03/2024
function transpose2 ( mat )
¶
Purpose¶
Transpose the real matrix MAT.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
function transpose2 ( mat )
¶
Purpose¶
Transpose the complex matrix MAT.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
function transpose2 ( mat )
¶
Purpose¶
Transpose the integer matrix MAT.
Arguments¶
- MAT (INPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix MAT.
function transpose2 ( mat )
¶
Purpose¶
Transpose the logical matrix MAT.
Arguments¶
- MAT (INPUT) logical(lgl), dimension(:,:)
- On entry, the logical matrix MAT.
function dot_product2 ( vecx, vecy )
¶
Purpose¶
Forms the dot product of two real vectors.
Arguments¶
- VECX (INPUT) real(stnd), dimension(:)
- On entry, the first real vector VECX.
- VECY (INPUT) real(stnd), dimension(:)
- On entry, the second real vector VECY.
Further Details¶
The dot product is computed with the first min( size(VECX) , size(VECY) ) elements of the two input vectors.
function dot_product2 ( vecx, vecy )
¶
Purpose¶
Forms the dot product of two complex vectors, conjugating the first vector.
Arguments¶
- VECX (INPUT) complex(stnd), dimension(:)
- On entry, the first complex vector VECX.
- VECY (INPUT) complex(stnd), dimension(:)
- On entry, the second complex vector VECY.
Further Details¶
The dot product is computed with the first min( size(VECX) , size(VECY) ) elements of the two input vectors.
function dot_product2 ( vecx, vecy )
¶
Purpose¶
Forms the dot product of two integer vectors.
Arguments¶
- VECX (INPUT) integer(i4b), dimension(:)
- On entry, the first integer vector VECX.
- VECY (INPUT) integer(i4b), dimension(:)
- On entry, the second integer vector VECY.
Further Details¶
The dot product is computed with the first min( size(VECX) , size(VECY) ) elements of the two input vectors.
function dot_product2 ( vecx, vecy )
¶
Purpose¶
Forms the dot product of two logical vectors.
Arguments¶
- VECX (INPUT) logical(lgl), dimension(:)
- On entry, the first logical vector VECX.
- VECY (INPUT) logical(lgl), dimension(:)
- On entry, the second logical vector VECY.
Further Details¶
The dot product is computed with the first min( size(VECX) , size(VECY) ) elements of the two input vectors.
function mmproduct ( vec, mat )
¶
Purpose¶
Multiplies the real vector VEC by the real matrix MAT.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC.
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
Further Details¶
The size of VEC must be equal to the number of rows of MAT.
function mmproduct ( mat, vec2 )
¶
Purpose¶
Multiplies the real matrix MAT by the real vector VEC2.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- VEC2 (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC2.
Further Details¶
The size of VEC2 must be equal to the number of columns of MAT.
function mmproduct ( mat1, mat2 )
¶
Purpose¶
Multiplies the real matrix MAT1 by the real matrix MAT2.
Arguments¶
- MAT1 (INPUT) real(stnd), dimension(:,:)
- On entry, the first real matrix MAT1.
- MAT2 (INPUT) real(stnd), dimension(:,:)
- On entry, the second real matrix MAT2.
Further Details¶
The number of rows of MAT2 must be equal to the number of columns of MAT1, otherwise the matrix product is computed with the first min( size(MAT1,2) , size(MAT2,1) ) columns of MAT1 and rows of MAT2.
function mmproduct ( vec, mat )
¶
Purpose¶
Multiplies the complex vector VEC by the complex matrix MAT.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC.
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
Further Details¶
The size of VEC must be equal to the number of rows of MAT.
function mmproduct ( mat, vec2 )
¶
Purpose¶
Multiplies the complex matrix MAT by the complex vector VEC2.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- VEC2 (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC2.
Further Details¶
The size of VEC2 must be equal to the number of columns of MAT.
function mmproduct ( mat1, mat2 )
¶
Purpose¶
Multiplies the complex matrix MAT1 by the complex matrix MAT2
Arguments¶
- MAT1 (INPUT) complex(stnd), dimension(:,:)
- On entry, the first complex matrix MAT1.
- MAT2 (INPUT) complex(stnd), dimension(:,:)
- On entry, the second complex matrix MAT2.
Further Details¶
The number of rows of MAT2 must be equal to the number of columns of MAT1, otherwise the matrix product is computed with the first min( size(MAT1,2) , size(MAT2,1) ) columns of MAT1 and rows of MAT2.
function matmul2 ( vec, mat )
¶
Purpose¶
Multiplies the real vector VEC by the real matrix MAT.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC.
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
Further Details¶
The size of VEC must be equal to the number of rows of MAT.
This function will use the BLAS through the BLAS_interfaces module if the C processor macro _BLAS is activated during compilation. Alternatively, if the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat, vec2 )
¶
Purpose¶
Multiplies the real matrix MAT by the real vector VEC2.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- VEC2 (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC2.
Further Details¶
The size of VEC2 must be equal to the number of columns of MAT.
This function will use the BLAS through the BLAS_interfaces module if the C processor macro _BLAS is activated during compilation. Alternatively, if the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat1, mat2 )
¶
Purpose¶
Multiplies the real matrix MAT1 by the real matrix MAT2.
Arguments¶
- MAT1 (INPUT) real(stnd), dimension(:,:)
- On entry, the first real matrix MAT1.
- MAT2 (INPUT) real(stnd), dimension(:,:)
- On entry, the second real matrix MAT2.
Further Details¶
The number of rows of MAT2 must be equal to the number of columns of MAT1, otherwise the matrix product is computed with the first min( size(MAT1,2) , size(MAT2,1) ) columns of MAT1 and rows of MAT2.
This function will use the BLAS through the BLAS_interfaces module if the C processor macro _BLAS is activated during compilation. On the other hand, if the _BLAS macro is not activated and the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
function matmul2 ( vec, mat )
¶
Purpose¶
Multiplies the complex vector VEC by the complex matrix MAT.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC.
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
Further Details¶
The size of VEC must be equal to the number of rows of MAT.
This function will use the BLAS through the BLAS_interfaces module if the C processor macro _BLAS is activated during compilation. Alternatively, if the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat, vec2 )
¶
Purpose¶
Multiplies the complex matrix MAT by the complex vector VEC2.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- VEC2 (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC2.
Further Details¶
The size of VEC2 must be equal to the number of columns of MAT.
This function will use the BLAS through the BLAS_interfaces module if the C processor macro _BLAS is activated during compilation. Alternatively, if the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat1, mat2 )
¶
Purpose¶
Multiplies the complex matrix MAT1 by the complex matrix MAT2.
Arguments¶
- MAT1 (INPUT) complex(stnd), dimension(:,:)
- On entry, the first complex matrix MAT1.
- MAT2 (INPUT) complex(stnd), dimension(:,:)
- On entry, the second complex matrix MAT2.
Further Details¶
The number of rows of MAT2 must be equal to the number of columns of MAT1, otherwise the matrix product is computed with the first min( size(MAT1,2) , size(MAT2,1) ) columns of MAT1 and rows of MAT2.
This function will use the BLAS through the BLAS_interfaces module if the C processor macro _BLAS is activated during compilation. On the other hand, if the _BLAS macro is not activated and the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
function matmul2 ( vec, mat )
¶
Purpose¶
Multiplies the integer vector VEC by the integer matrix MAT.
Arguments¶
- VEC (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector VEC.
- MAT (INPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix MAT.
Further Details¶
The size of VEC must be equal to the number of rows of MAT.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat, vec2 )
¶
Purpose¶
Multiplies the integer matrix MAT by the integer vector VEC2.
Arguments¶
- MAT (INPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix MAT.
- VEC2 (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector VEC2.
Further Details¶
The size of VEC2 must be equal to the number of columns of MAT.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat1, mat2 )
¶
Purpose¶
Multiplies the integer matrix MAT1 by the integer matrix MAT2.
Arguments¶
- MAT1 (INPUT) integer(i4b), dimension(:,:)
- On entry, the first integer matrix MAT1.
- MAT2 (INPUT) integer(i4b), dimension(:,:)
- On entry, the second integer matrix MAT2.
Further Details¶
The number of rows of MAT2 must be equal to the number of columns of MAT1, otherwise the matrix product is computed with the first min( size(MAT1,2) , size(MAT2,1) ) columns of MAT1 and rows of MAT2.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
function matmul2 ( vec, mat )
¶
Purpose¶
Multiplies the logical vector VEC by the logical matrix MAT.
Arguments¶
- VEC (INPUT) logical(lgl), dimension(:)
- On entry, the logical vector VEC.
- MAT (INPUT) logical(lgl), dimension(:,:)
- On entry, the logical matrix MAT.
Further Details¶
The size of VEC must be equal to the number of rows of MAT.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat, vec2 )
¶
Purpose¶
Multiplies the logical matrix MAT by the logical vector VEC2.
Arguments¶
- MAT (INPUT) logical(lgl), dimension(:,:)
- On entry, the logical matrix MAT.
- VEC2 (INPUT) logical(lgl), dimension(:)
- On entry, the logical vector VEC2.
Further Details¶
The size of VEC2 must be equal to the number of columns of MAT.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP.
function matmul2 ( mat1, mat2 )
¶
Purpose¶
Multiplies the logical matrix MAT1 by the logical matrix MAT2.
Arguments¶
- MAT1 (INPUT) logical(lgl), dimension(:,:)
- On entry, the first logical matrix MAT1.
- MAT2 (INPUT) logical(lgl), dimension(:,:)
- On entry, the second logical matrix MAT2.
Further Details¶
The number of rows of MAT2 must be equal to the number of columns of MAT1, otherwise the matrix product is computed with the first min( size(MAT1,2) , size(MAT2,1) ) columns of MAT1 and rows of MAT2.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine array_copy ( src, dest, n_copied, n_not_copied )
¶
Purpose¶
Copies to a destination integer array DEST the one-dimensional integer array SRC, or as much of SRC as will fit in DEST.
Returns the number of components copied as N_COPIED, and the number of components not copied as N_NOT_COPIED.
Arguments¶
- SRC (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector SRC.
- DEST (OUTPUT) integer(i4b), dimension(:)
- On output, the integer vector DEST.
- N_COPIED (OUTPUT) integer(i4b)
- On output, the integer N_COPIED.
- N_NOT_COPIED (OUTPUT) integer(i4b)
- On output, the integer N_NOT_COPIED.
subroutine array_copy ( src, dest, n_copied, n_not_copied )
¶
Purpose¶
Copies to a destination real array DEST the one-dimensional real array SRC, or as much of SRC as will fit in DEST.
Returns the number of components copied as N_COPIED, and the number of components not copied as N_NOT_COPIED.
Arguments¶
- SRC (INPUT) real(stnd), dimension(:)
- On entry, the real vector SRC.
- DEST (OUTPUT) real(stnd), dimension(:)
- On output, the real vector DEST.
- N_COPIED (OUTPUT) real(stnd)
- On output, the real N_COPIED.
- N_NOT_COPIED (OUTPUT) real(stnd)
- On output, the real N_NOT_COPIED.
subroutine array_copy ( src, dest, n_copied, n_not_copied )
¶
Purpose¶
Copies to a destination complex array DEST the one-dimensional complex array SRC, or as much of SRC as will fit in DEST.
Returns the number of components copied as N_COPIED, and the number of components not copied as N_NOT_COPIED.
Arguments¶
- SRC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector SRC.
- DEST (OUTPUT) complex(stnd), dimension(:)
- On output, the complex vector DEST.
- N_COPIED (OUTPUT) complex(stnd)
- On output, the complex N_COPIED.
- N_NOT_COPIED (OUTPUT) complex(stnd)
- On output, the complex N_NOT_COPIED.
subroutine swap ( a, b )
¶
Purpose¶
Swap the integers A and B.
Arguments¶
- A (INPUT/OUTPUT) integer(i4b)
- On entry, the integer A.
- B (INPUT/OUTPUT) integer(i4b)
- On entry, the integer B.
subroutine swap ( a, b )
¶
Purpose¶
Swap the the real numbers A and B.
Arguments¶
- A (INPUT/OUTPUT) real(stnd)
- On entry, the real A.
- B (INPUT/OUTPUT) real(stnd)
- On entry, the real B.
subroutine swap ( a, b )
¶
Purpose¶
Swap the complex numbers A and B.
Arguments¶
- A (INPUT/OUTPUT) complex(stnd)
- On entry, the complex A.
- B (INPUT/OUTPUT) complex (stnd)
- On entry, the complex B.
subroutine swap ( a, b )
¶
Purpose¶
Swap the corresponding elements of the one-dimensional integer arrays A and B.
Arguments¶
- A (INPUT/OUTPUT) integer(i4b), dimension(:)
- On entry, the integer vector A.
- B (INPUT/OUTPUT) integer(i4b), dimension(:)
- On entry, the integer vector B.
Further Details¶
The sizes of vectors A and B must match.
subroutine swap ( a, b )
¶
Purpose¶
Swap the corresponding elements of the one-dimensional real arrays A and B.
Arguments¶
- A (INPUT/OUTPUT) real(stnd), dimension(:)
- On entry, the real vector A.
- B (INPUT/OUTPUT) real(stnd), dimension(:)
- On entry, the real vector B.
Further Details¶
The sizes of vectors A and B must match.
subroutine swap ( a, b )
¶
Purpose¶
Swap the corresponding elements of the one-dimensional complex arrays A and B.
Arguments¶
- A (INPUT/OUTPUT) complex(stnd), dimension(:)
- On entry, the complex vector A.
- B (INPUT/OUTPUT) complex(stnd), dimension(:)
- On entry, the complex vector B.
Further Details¶
The sizes of vectors A and B must match.
subroutine swap ( a, b )
¶
Purpose¶
Swap the corresponding elements of the two-dimensional integer arrays A and B.
Arguments¶
- A (INPUT/OUTPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix A.
- B (INPUT/OUTPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix B.
Further Details¶
The shapes of matrices A and B must match.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine swap ( a, b )
¶
Purpose¶
Swap the corresponding elements of the two-dimensional real arrays A and B.
Arguments¶
- A (INPUT/OUTPUT) real(stnd), dimension(:,:)
- On entry, the real matrix A.
- B (INPUT/OUTPUT) real(stnd), dimension(:,:)
- On entry, the real matrix B.
Further Details¶
The shapes of matrices A and B must match.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine swap ( a, b )
¶
Purpose¶
Swap the corresponding elements of the two-dimensional complex arrays A and B.
Arguments¶
- A (INPUT/OUTPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix A.
- B (INPUT/OUTPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix B.
Further Details¶
The shapes of matrices A and B must match.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the integers A and B if MASK=true.
Arguments¶
- A (INPUT/OUTPUT) integer(i4b)
- On entry, the integer A.
- B (INPUT/OUTPUT) integer(i4b)
- On entry, the integer B.
- MASK (INPUT) logical(lgl)
- On entry, the logical mask value.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the reals A and B if MASK=true.
Arguments¶
- A (INPUT/OUTPUT) real(stnd)
- On entry, the real A.
- B (INPUT/OUTPUT) real(stnd)
- On entry, the real B.
- MASK (INPUT) logical(lgl)
- On entry, the logical mask value.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the complex A and B if MASK=true.
Arguments¶
- A (INPUT/OUTPUT) complex(stnd)
- On entry, the complex A.
- B (INPUT/OUTPUT) real(stnd)
- On entry, the complex B.
- MASK (INPUT) logical(lgl)
- On entry, the logical mask value.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the corresponding elements of the one-dimensional integer arrays A and B, if the corresponding element of the one-dimensional logical array MASK is true.
Arguments¶
- A (INPUT/OUTPUT) integer(i4b), dimension(:)
- On entry, the integer vector A.
- B (INPUT/OUTPUT) integer(i4b), dimension(:)
- On entry, the integer vector B.
- MASK (INPUT) logical(lgl), dimension(:)
- On entry, the logical mask vector.
Further Details¶
The sizes of vectors A, B and MASK must match.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the corresponding elements of the one-dimensional real arrays A and B, if the corresponding element of the one-dimensional logical array MASK is true.
Arguments¶
- A (INPUT/OUTPUT) real(stnd), dimension(:)
- On entry, the real vector A.
- B (INPUT/OUTPUT) real(stnd), dimension(:)
- On entry, the real vector B.
- MASK (INPUT) logical(lgl), dimension(:)
- On entry, the logical mask vector.
Further Details¶
The sizes of vectors A, B and MASK must match.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the corresponding elements of the one-dimensional complex arrays A and B, if the corresponding element of the one-dimensional logical array MASK is true.
Arguments¶
- A (INPUT/OUTPUT) complex(stnd), dimension(:)
- On entry, the complex vector A.
- B (INPUT/OUTPUT) complex(stnd), dimension(:)
- On entry, the complex vector B.
- MASK (INPUT) logical(lgl), dimension(:)
- On entry, the logical mask vector.
Further Details¶
The sizes of vectors A, B and MASK must match.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the corresponding elements of the two-dimensional integer arrays A and B, if the corresponding element of the two-dimensional logical array MASK is true.
Arguments¶
- A (INPUT/OUTPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix A.
- B (INPUT/OUTPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix B.
- MASK (INPUT) logical(lgl), dimension(:,:)
- On entry, the logical mask matrix.
Further Details¶
The shapes of matrices A, B and MASK must match.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the corresponding elements of the two-dimensional real arrays A and B, if the corresponding element of the two-dimensional logical array MASK is true.
Arguments¶
- A (INPUT/OUTPUT) real(stnd), dimension(:,:)
- On entry, the real matrix A.
- B (INPUT/OUTPUT) real(stnd), dimension(:,:)
- On entry, the real matrix B.
- MASK (INPUT) logical(lgl), dimension(:,:)
- On entry, the logical mask matrix.
Further Details¶
The shapes of matrices A, B and MASK must match.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine swap ( a, b, mask )
¶
Purpose¶
Swap the corresponding elements of the two-dimensional complex arrays A and B, if the corresponding element of the two-dimensional logical array MASK is true.
Arguments¶
- A (INPUT/OUTPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix A.
- B (INPUT/OUTPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix B.
- MASK (INPUT) logical(lgl), dimension(:,:)
- On entry, the logical mask matrix.
Further Details¶
The shapes of matrices A, B and MASK must match.
If the _OPENMP3 macro is activated during compilation, this function will be parallelized with OPENMP if the matrices are big enough.
subroutine mvalloc ( p, n, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to an integer one-dimensional array with a new size N, while preserving its contents.
subroutine mvalloc ( p, n, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to a real one-dimensional array with a new size N, while preserving its contents.
subroutine mvalloc ( p, n, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to a complex one-dimensional array with a new size N, while preserving its contents.
subroutine mvalloc ( p, n, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to a character one-dimensional array with a new size N, while preserving its contents.
subroutine mvalloc ( p, n, m, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to an integer two dimensional array with a new shape (N,M) while preserving its contents.
subroutine mvalloc ( p, n, m, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to a real two dimensional array with a new shape (N,M) while preserving its contents.
subroutine mvalloc ( p, n, m, ialloc )
¶
Purpose¶
Reallocates an allocatable array P to a complex two dimensional array with a new shape (N,M) while preserving its contents.
function ifirstloc ( mask )
¶
Purpose¶
Returns the index of the first location, in a one-dimensional logical MASK, that has the value true, or returns size(MASK)+1 if all components of MASK are false .
function imaxloc ( arr )
¶
Purpose¶
Returns location of the one-dimensional integer array ARR maximum as an integer.
function imaxloc ( arr, mask )
¶
Purpose¶
Returns location as an integer of the maximum in the elements of the one-dimensional integer array ARR under the control of the one-dimensional logical array MASK. Returns size(MASK)+1 if all components of MASK are false .
function imaxloc ( arr )
¶
Purpose¶
Returns location of the one-dimensional real array ARR maximum as an integer.
function imaxloc ( arr, mask )
¶
Purpose¶
Returns location as an integer of the maximum in the elements of the one-dimensional real array ARR under the control of the one-dimensional logical array MASK. Returns size(MASK)+1 if all components of MASK are false .
function iminloc ( arr )
¶
Purpose¶
Returns location of the one-dimensional integer array ARR minimum as an integer.
function iminloc ( arr, mask )
¶
Purpose¶
Returns location as an integer of the minimum in the elements of the one-dimensional integer array ARR under the control of the one-dimensional logical array MASK. Returns size(MASK)+1 if all components of MASK are false .
function iminloc ( arr )
¶
Purpose¶
Returns location of the one-dimensional real array ARR minimum as an integer.
function iminloc ( arr, mask )
¶
Purpose¶
Returns location as an integer of the minimum in the elements of the one-dimensional real array ARR under the control of the one-dimensional logical array MASK. Returns size(MASK)+1 if all components of MASK are false .
subroutine assert ( n1, string )
¶
Purpose¶
Exit with error message STRING, if logical argument n1 is false .
subroutine assert ( n1, n2, string )
¶
Purpose¶
Exit with error message STRING, if any of the logical arguments n1, n2 are false .
subroutine assert ( n1, n2, n3, string )
¶
Purpose¶
Exit with error message STRING, if any of the logical arguments n1, n2, n3 are false .
subroutine assert ( n1, n2, n3, n4, string )
¶
Purpose¶
Exit with error message STRING, if any of the logical arguments n1, n2, n3, n4 are false .
subroutine assert ( n, string )
¶
Purpose¶
Exit with error message STRING, if any of the elements of the one-dimensional logical array N are false .
function assert_eq ( n1, n2, string )
¶
Purpose¶
Exit with error message STRING, if the integer arguments n1, n2 are not equal.
function assert_eq ( n1, n2, n3, string )
¶
Purpose¶
Exit with error message STRING, if the integer arguments n1, n2, n3 are not all equal.
function assert_eq ( n1, n2, n3, n4, string )
¶
Purpose¶
Exit with error message STRING, if the integer arguments n1, n2, n3, n4 are not all equal.
function assert_eq ( nn, string )
¶
Purpose¶
Exit with error message STRING, if the elements of the one-dimensional integer array NN are not all equal.
subroutine merror ( string, ierror )
¶
Purpose¶
Report error message STRING and optional error number IERROR and stop.
function arth ( first, increment, n )
¶
Purpose¶
Returns an one-dimensional integer array of length N containing an arithmetic progression whose first value is FIRST and whose increment is INCREMENT.
function arth ( first, increment, n )
¶
Purpose¶
Returns an one-dimensional real array of length N containing an arithmetic progression whose first value is FIRST and whose increment is INCREMENT.
function arth ( first, increment, n )
¶
Purpose¶
Returns an one-dimensional complex array of length N containing an arithmetic progression whose first value is FIRST and whose increment is INCREMENT.
function arth ( first, increment, n )
¶
Purpose¶
Returns a two-dimensional integer array containing size(FIRST) = size(INCREMENT) arithmetic progressions of length N whose first values are FIRST(:) and whose increments are INCREMENT(:).
It is assumed that the vector arguments FIRST and INCREMENT have the same length.
function arth ( first, increment, n )
¶
Purpose¶
Returns a two-dimensional real array containing size(FIRST) = size(INCREMENT) arithmetic progressions of length N whose first values are FIRST(:) and whose increments are INCREMENT(:).
It is assumed that the vector arguments FIRST and INCREMENT have the same length.
function arth ( first, increment, n )
¶
Purpose¶
Returns a two-dimensional complex array containing size(FIRST) = size(INCREMENT) arithmetic progressions of length N whose first values are FIRST(:) and whose increments are INCREMENT(:).
It is assumed that the vector arguments FIRST and INCREMENT have the same length.
function geop ( first, factor, n )
¶
Purpose¶
Returns an one-dimensional integer array of length N containing a geometric progression whose first value is FIRST and whose multiplier is FACTOR.
function geop ( first, factor, n )
¶
Purpose¶
Returns an one-dimensional real array of length N containing a geometric progression whose first value is FIRST and whose multiplier is FACTOR.
function geop ( first, factor, n )
¶
Purpose¶
Returns an one-dimensional complex array of length N containing a geometric progression whose first value is FIRST and whose multiplier is FACTOR.
function geop ( first, factor, n )
¶
Purpose¶
Returns a two-dimensional integer array containing size(FIRST) = size(FACTOR) geometric progressions of length N whose first values are FIRST(:) and whose multipliers are FACTOR(:).
It is assumed that the vector arguments FIRST and FACTOR have the same length.
function geop ( first, factor, n )
¶
Purpose¶
Returns a two-dimensional real array containing size(FIRST) = size(FACTOR) geometric progressions of length N whose first values are FIRST(:) and whose multipliers are FACTOR(:).
It is assumed that the vector arguments FIRST and FACTOR have the same length.
function geop ( first, factor, n )
¶
Purpose¶
Returns a two-dimensional complex array containing size(FIRST) = size(FACTOR) geometric progressions of length N whose first values are FIRST(:) and whose multipliers are FACTOR(:).
It is assumed that the vector arguments FIRST and FACTOR have the same length.
function cumsum ( arr, seed )
¶
Purpose¶
Returns a rank one integer array containing the cumulative sum of the rank one integer array ARR. If the optional argument SEED is present, it is added to all components of the result.
function cumsum ( arr, seed )
¶
Purpose¶
Returns a rank one real array containing the cumulative sum of the rank one real array ARR. If the optional argument SEED is present, it is added to all components of the result.
function cumsum ( arr, seed )
¶
Purpose¶
Returns a rank one complex array containing the cumulative sum of the rank one complex array ARR. If the optional argument SEED is present, it is added to all components of the result.
function cumprod ( arr, seed )
¶
Purpose¶
Returns a rank one integer array containing the cumulative product of the rank one integer array ARR. If the optional argument SEED is present, it is multiplied into all components of the result.
function cumprod ( arr, seed )
¶
Purpose¶
Returns a rank one real array containing the cumulative product of the rank one real array ARR. If the optional argument SEED is present, it is multiplied into all components of the result.
function cumprod ( arr, seed )
¶
Purpose¶
Returns a rank one complex array containing the cumulative product of the rank one complex array ARR. If the optional argument SEED is present, it is multiplied into all components of the result.
function poly ( x, coeffs )
¶
Purpose¶
Returns a real scalar containing the result of evaluating the polynomial P(X) for X real with one-dimensional real coefficient vector COEFFS
P(X) = COEFFS(1) + COEFFS(2) * X + COEFFS(3) * X**(2) + …
function poly ( x, coeffs )
¶
Purpose¶
Returns a complex scalar containing the result of evaluating the polynomial P(X) for X complex with one-dimensional real coefficient vector COEFFS
P(X) = COEFFS(1) + COEFFS(2) * X + COEFFS(3) * X**(2) + …
function poly ( x, coeffs )
¶
Purpose¶
Returns a complex scalar containing the result of evaluating the polynomial P(X) for X complex with one-dimensional complex coefficient vector COEFFS
P(X) = COEFFS(1) + COEFFS(2) * X + COEFFS(3) * X**(2) + …
function poly ( x, coeffs )
¶
Purpose¶
Returns a real vector containing the results of evaluating the polynomials P(X(:)) for X(:) real with one-dimensional real coefficient vector COEFFS
P(X(:)) = COEFFS(1) + COEFFS(2) * X(:) + COEFFS(3) * X(:)**(2) + …
function poly ( x, coeffs, mask )
¶
Purpose¶
Returns a real vector containing the results of evaluating the polynomials P(X(:)) for X(:) real with one-dimensional real coefficient vector COEFFS
P(X(:)) = COEFFS(1) + COEFFS(2) * X(:) + COEFFS(3) * X(:)**(2) + …under the control of the logical argument MASK. If MASK(i) = false, the polynomial is not evaluated at X(i).
function poly_term ( coeffs, x )
¶
Purpose¶
Returns a real array of size(COEFFS) containing the partial cumulants of the polynomial with real coefficients COEFFS evaluated at the real scalar X. On entry, the coefficients in COEFFS are arranged from highest order to lowest-order coefficients.
function poly_term ( coeffs, x )
¶
Purpose¶
Returns a complex array of size(COEFFS) containing the partial cumulants of the polynomial with complex coefficients COEFFS evaluated at the complex scalar X. On entry, the coefficients in COEFFS are arranged from highest order to lowest-order coefficients.
function zroots_unity ( n, nn )
¶
Purpose¶
Complex function returning a complex array containing nn consecutive powers of the nth complex root of unity.
subroutine update_rk1 ( mat, u, v )
¶
Purpose¶
Updates the integer matrix MAT with the outer sum of the two integer vectors U and V :
MAT = MAT + U * V’
Arguments¶
- MAT (INPUT/OUTPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix MAT.
- U (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector U.
- V (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector V.
subroutine update_rk1 ( mat, u, v )
¶
Purpose¶
Updates the real matrix MAT with the outer sum of the two reals vectors U and V :
MAT = MAT + U * V’
Arguments¶
- MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- U (INPUT) real(stnd), dimension(:)
- On entry, the real vector U.
- V (INPUT) real(stnd), dimension(:)
- On entry, the real vector V.
subroutine update_rk1 ( mat, u, v )
¶
Purpose¶
Updates the complex matrix MAT with the outer sum of the two complex vectors U and V :
MAT = MAT + U * V’
Arguments¶
- MAT (INPUT/OUTPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- U (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector U.
- V (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector V.
subroutine update_rk2 ( mat, u, v, u2, v2 )
¶
Purpose¶
Updates the integer matrix MAT with the outer sums of the integer vectors U, V, U2 and V2:
MAT = MAT + U * V’ + U2 * V2’
Arguments¶
- MAT (INPUT/OUTPUT) integer(i4b), dimension(:,:)
- On entry, the integer matrix MAT.
- U (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector U.
- V (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector V.
- U2 (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector U2.
- V2 (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector V2.
subroutine update_rk2 ( mat, u, v, u2, v2 )
¶
Purpose¶
Updates the real matrix MAT with the outer sums of the real vectors U, V, U2 and V2:
MAT = MAT + U * V’ + U2 * V2’
Arguments¶
- MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- U (INPUT) real(stnd), dimension(:)
- On entry, the real vector U.
- V (INPUT) real(stnd), dimension(:)
- On entry, the real vector V.
- U2 (INPUT) real(stnd), dimension(:)
- On entry, the real vector U2.
- V2 (INPUT) real(stnd), dimension(:)
- On entry, the real vector V2.
subroutine update_rk2 ( mat, u, v, u2, v2 )
¶
Purpose¶
Updates the complex matrix MAT with the outer sums of the complex vectors U, V, U2 and V2:
MAT = MAT + U * V’ + U2 * V2’
Arguments¶
- MAT (INPUT/OUTPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- U (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector U.
- V (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector V.
- U2 (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector U2.
- V2 (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector V2.
function outerprod ( a, b )
¶
Purpose¶
Returns a matrix that is the outer product of the two integer vectors A and B .
Arguments¶
- A (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector A.
- B (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector B.
function outerprod ( a, b )
¶
Purpose¶
Returns a matrix that is the outer product of the two real vectors A and B .
Arguments¶
- A (INPUT) real(stnd), dimension(:)
- On entry, the real vector A.
- B (INPUT) real(stnd), dimension(:)
- On entry, the real vector B.
function outerprod ( a, b )
¶
Purpose¶
Returns a matrix that is the outer product of the two complex vectors A and B .
Arguments¶
- A (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector A.
- B (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector B.
function outerdiv ( a, b )
¶
Purpose¶
Returns a matrix that is the outer quotient of the two real vectors A and B .
Arguments¶
- A (INPUT) real(stnd), dimension(:)
- On entry, the real vector A.
- B (INPUT) real(stnd), dimension(:)
- On entry, the real vector B.
Further Details¶
It is assumed that none of the elements of B is zero.
function outerdiv ( a, b )
¶
Purpose¶
Returns a matrix that is the outer quotient of the two complex vectors A and B .
Arguments¶
- A (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector A.
- B (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector B.
Further Details¶
It is assumed that none of the elements of B is zero.
function outersum ( a, b )
¶
Purpose¶
Returns a matrix that is the outer sum of the two integer vectors A and B .
Arguments¶
- A (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector A.
- B (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector B.
function outersum ( a, b )
¶
Purpose¶
Returns a matrix that is the outer sum of the two real vectors A and B .
Arguments¶
- A (INPUT) real(stnd), dimension(:)
- On entry, the real vector A.
- B (INPUT) real(stnd), dimension(:)
- On entry, the real vector B.
function outersum ( a, b )
¶
Purpose¶
Returns a matrix that is the outer sum of the two complex vectors A and B .
Arguments¶
- A (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector A.
- B (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector B.
function outerdiff ( a, b )
¶
Purpose¶
Returns a matrix that is the outer difference of the two integer vectors A and B .
Arguments¶
- A (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector A.
- B (INPUT) integer(i4b), dimension(:)
- On entry, the integer vector B.
function outerdiff ( a, b )
¶
Purpose¶
Returns a matrix that is the outer difference of the two real vectors A and B .
Arguments¶
- A (INPUT) real(stnd), dimension(:)
- On entry, the real vector A.
- B (INPUT) real(stnd), dimension(:)
- On entry, the real vector B.
function outerdiff ( a, b )
¶
Purpose¶
Returns a matrix that is the outer difference of the two complex vectors A and B .
Arguments¶
- A (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector A.
- B (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector B.
function outerand ( a, b )
¶
Purpose¶
Returns a matrix that is the outer logical AND of two logical vectors A and B .
Arguments¶
- A (INPUT) logical(lgl), dimension(:)
- On entry, the logical vector A.
- B (INPUT) logical(lgl), dimension(:)
- On entry, the logical vector B.
function outeror ( a, b )
¶
Purpose¶
Returns a matrix that is the outer logical OR of two logical vectors A and B .
Arguments¶
- A (INPUT) logical(lgl), dimension(:)
- On entry, the logical vector A.
- B (INPUT) logical(lgl), dimension(:)
- On entry, the logical vector B.
function triangle ( upper, j, k, extra )
¶
Purpose¶
Return an upper (if UPPER=true) or lower (if UPPER=false) triangular logical mask.
Arguments¶
- UPPER (INPUT) logical(lgl)
- On entry, the logical scalar UPPER.
- J (INPUT) integer(i4b)
- On entry, the number of rows of the logical matrix returned by the function.
- K (INPUT) integer(i4b)
- On entry, the number of columns of the logical matrix returned by the function.
- EXTRA (INPUT) integer(i4b)
- On entry, an integer value to set the values of the logical matrix returned by the function. By default, EXTRA is set to zero.
function abse ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the real vector VEC of length n.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC.
Further Details¶
The routine is based on methods from reference (1) and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function abse ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the complex vector VEC of length n.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC.
Further Details¶
The routine is based on methods from reference (1) and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function abse ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the real n-by-m matrix MAT.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
Further Details¶
The routine is based on methods from reference (1) and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function abse ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the complex n-by-m matrix MAT.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
Further Details¶
The routine is based on methods from reference (1) and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function abse ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a real matrix MAT via the function name, so that
norm := sqrt( sum(MAT * MAT,dim=3-dim) ) .
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from reference (1) and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function abse ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a complex matrix MAT via the function name, so that
norm := sqrt( sum(MAT * conjg(MAT),dim=3-dim) ) .
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from reference (1) and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the real vector VEC of length n, with due regard to avoiding overflow and underflow.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
function norm ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the complex vector VEC of length n, with due regard to avoiding overflow and underflow.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
function norm ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the real n-by-m matrix MAT, with due regard to avoiding overflow and underflow.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
function norm ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the complex n-by-m matrix MAT, with due regard to avoiding overflow and underflow.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
function norm ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a real matrix MAT via the function name, so that
norm := sqrt( sum(MAT * MAT,dim=3-dim) )This is done without destructive underflow or overflow.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
function norm ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a complex matrix MAT via the function name, so that
norm := sqrt( sum(MAT * conjg(MAT),dim=3-dim) )This is done without destructive underflow or overflow.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
subroutine lassq ( vec, scal, ssq )
¶
Purpose¶
LASSQ returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( VEC**(2) ) + ( scale**(2) )*ssqThe value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ, respectively.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- The real vector for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
subroutine lassq ( vec, scal, ssq )
¶
Purpose¶
LASSQ returns the values scl and smsq such that
( scl**(2) ) * smsq = dot_product( VEC, VEC ) + ( scale**(2) ) * ssqThe value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ, respectively.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- The complex vector for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
subroutine lassq ( mat, scal, ssq )
¶
Purpose¶
LASSQ returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( MAT**(2) ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- The matrix for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
subroutine lassq ( mat, scal, ssq )
¶
Purpose¶
LASSQ returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( MAT * conjg(MAT) ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- The complex matrix for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003 and is machine independent. The algorithm is also described more comprehensively in reference (2).
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
function norme ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the real vector VEC of length n, with due regard to avoiding overflow and underflow.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norme ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the complex vector VEC of length n, with due regard to avoiding overflow and underflow.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norme ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the real n-by-m matrix MAT, with due regard to avoiding overflow and underflow.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norme ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the complex n-by-m matrix MAT, with due regard to avoiding overflow and underflow.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norme ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a real matrix MAT via the function name, so that
norme := sqrt( sum(MAT * MAT,dim=3-dim) )This is done without destructive underflow or overflow.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norme ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a complex matrix MAT via the function name, so that
norme := sqrt( sum(MAT * conjg(MAT),dim=3-dim) )This is done without destructive underflow or overflow.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassqe ( vec, scal, ssq )
¶
Purpose¶
LASSQE returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( VEC**(2) ) + ( scale**(2) )*ssqThe value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ, respectively.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- The real vector for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassqe ( vec, scal, ssq )
¶
Purpose¶
LASSQE returns the values scl and smsq such that
( scl**(2) ) * smsq = dot_product( VEC, VEC ) + ( scale**(2) ) * ssqThe value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ, respectively.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- The complex vector for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassqe ( mat, scal, ssq )
¶
Purpose¶
LASSQE returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( MAT**(2) ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- The matrix for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassqe ( mat, scal, ssq )
¶
Purpose¶
LASSQE returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( MAT * conjg(MAT) ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- The complex matrix for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from reference (1), but this version is written in Fortran 95/2003 and is machine/precision independent. The algorithm is also described more comprehensively in reference (2) and also uses compensated summation to improve the accuracy of the final result as suggested in reference (3).
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm2e ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the real vector VEC of length n, with due regard to avoiding overflow and underflow.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- On entry, the real vector VEC.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm2e ( vec )
¶
Purpose¶
This function computes the 2-norm (i.e., the Euclidean norm) of the complex vector VEC of length n, with due regard to avoiding overflow and underflow.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- On entry, the complex vector VEC.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm2e ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the real n-by-m matrix MAT, with due regard to avoiding overflow and underflow.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm2e ( mat )
¶
Purpose¶
This function computes the 2-norm (i.e., the Frobenius norm) of the complex n-by-m matrix MAT, with due regard to avoiding overflow and underflow.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm2e ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a real matrix MAT via the function name, so that
norm := sqrt( sum(MAT * MAT,dim=3-dim) )This is done without destructive underflow or overflow.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- On entry, the real matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
function norm2e ( mat, dim )
¶
Purpose¶
Return the Euclidean norms of the columns (DIM=2) or the rows (DIM=1) of a complex matrix MAT via the function name, so that
norm := sqrt( sum(MAT * conjg(MAT),dim=3-dim) )This is done without destructive underflow or overflow.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- On entry, the complex matrix MAT.
- DIM (INPUT) integer(i4b)
On entry, if:
- DIM=1 the Euclidean norms of the rows of MAT are computed.
- DIM=2 the Euclidean norms of the columns of MAT are computed.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassq2e ( vec, scal, ssq )
¶
Purpose¶
LASSQ2E returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( VEC**(2) ) + ( scale**(2) )*ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- VEC (INPUT) real(stnd), dimension(:)
- The real vector for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassq2e ( vec, scal, ssq )
¶
Purpose¶
LASSQ2E returns the values scl and smsq such that
( scl**(2) ) * smsq = dot_product( VEC, VEC ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- VEC (INPUT) complex(stnd), dimension(:)
- The complex vector for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassq2e ( mat, scal, ssq )
¶
Purpose¶
LASSQ2E returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( MAT**(2) ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- MAT (INPUT) real(stnd), dimension(:,:)
- The matrix for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
The routine is also parallelized with OpenMP if the input real matrix is sufficiently big.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine lassq2e ( mat, scal, ssq )
¶
Purpose¶
LASSQ2E returns the values scl and smsq such that
( scl**(2) ) * smsq = sum( MAT * conjg(MAT) ) + ( scale**(2) ) * ssq,The value of ssq is assumed to be non-negative.
scale and ssq must be supplied in SCAL and SSQ and scl and smsq are overwritten on SCAL and SSQ respectively.
Arguments¶
- MAT (INPUT) complex(stnd), dimension(:,:)
- The complex matrix for which a scaled sum of squares is computed.
- SCAL (INPUT/OUTPUT) real(stnd)
- On entry, the value scale in the equation above. On exit, SCAL is overwritten with scl , the scaling factor for the sum of squares.
- SSQ (INPUT/OUTPUT) real(stnd)
- On entry, the value ssq in the equation above. On exit, SSQ is overwritten with smsq , the basic sum of squares from which scl has been factored out.
Further Details¶
The routine is based on methods from references (1) (2) and (3), but this version is written in Fortran 95/2003, is machine independent and uses compensated summation in order to minimize rounding errors.
The routine is also parallelized with OpenMP if the input complex matrix is sufficiently big.
For more details, see:
- Anderson, E., 2002:
- LAPACK3E - A Fortran 90-enhanced Version of LAPACK. UT-CS-02-497 (LAPACK Working Note 158). University of Tennessee, Knoxville.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS. ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
- Hanson, R.J., and Hopkins, T., 2018:
- Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.
subroutine scatter_add ( dest, source, dest_index )
¶
Purpose¶
Adds each component of the integer vector SOURCE into a component of the integer vector DEST specified by the index vector DEST_INDEX.
subroutine scatter_add ( dest, source, dest_index )
¶
Purpose¶
Adds each component of the real vector SOURCE into a component of the real vector DEST specified by the index vector DEST_INDEX.
subroutine scatter_add ( dest, source, dest_index )
¶
Purpose¶
Adds each component of the complex vector SOURCE into a component of the complex vector DEST specified by the index vector DEST_INDEX.
subroutine scatter_max ( dest, source, dest_index )
¶
Purpose¶
Takes the max operation between each component of the real vector SOURCE and a component of the real vector DEST specified by the index vector DEST_INDEX, replacing the component of DEST with the value obtained.
subroutine scatter_max ( dest, source, dest_index )
¶
Purpose¶
Takes the max operation between each component of the integer vector SOURCE and a component of the integer vector DEST specified by the index vector DEST_INDEX, replacing the component of DEST with the value obtained.
subroutine diagadd ( mat, diag )
¶
Purpose¶
Adds real vector DIAG to the diagonal of real matrix MAT.
subroutine diagadd ( mat, diag )
¶
Purpose¶
Adds complex vector DIAG to the diagonal of complex matrix MAT.
subroutine diagadd ( mat, diag )
¶
Purpose¶
Adds real scalar DIAG to the diagonal of real matrix MAT.
subroutine diagadd ( mat, diag )
¶
Purpose¶
Adds complex scalar DIAG to the diagonal of complex matrix MAT.
subroutine diagmult ( mat, diag )
¶
Purpose¶
Multiplies real vector DIAG into the diagonal of real matrix MAT.
subroutine diagmult ( mat, diag )
¶
Purpose¶
Multiplies complex vector DIAG into the diagonal of complex matrix MAT.
subroutine diagmult ( mat, diag )
¶
Purpose¶
Multiplies real scalar DIAG into the diagonal of real matrix MAT.
subroutine diagmult ( mat, diag )
¶
Purpose¶
Multiplies complex scalar DIAG into the diagonal of complex matrix MAT.
subroutine put_diag ( diag, mat )
¶
Purpose¶
Set the diagonal of real matrix MAT to the values of the real vector DIAG.
subroutine put_diag ( diag, mat )
¶
Purpose¶
Set the diagonal of complex matrix MAT to the values of the complex vector DIAG.
subroutine put_diag ( diag, mat )
¶
Purpose¶
Set the diagonal of real matrix MAT to the value of the real scalar DIAG.
subroutine put_diag ( diag, mat )
¶
Purpose¶
Set the diagonal of complex matrix MAT to the value of the complex scalar DIAG.
subroutine unit_matrix ( mat )
¶
Purpose¶
Set the real matrix MAT to be a unit real matrix (if it is square).
subroutine unit_matrix ( mat )
¶
Purpose¶
Set the complex matrix MAT to be a unit complex matrix (if it is square).
subroutine lascl ( x, cfrom, cto )
¶
Purpose¶
LASCL multiplies the real scalar X by the real scalar CTO/CFROM . This is done without over/underflow as long as the final result CTO * X/CFROM does not over/underflow.
CFROM must be nonzero.
Arguments¶
- X (INPUT/OUTPUT) real(stnd)
- The real to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real X is multiplied by CTO/CFROM.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested by E. Anderson. See:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
subroutine lascl ( x, cfrom, cto )
¶
Purpose¶
LASCL multiplies the real vector X by the real scalar CTO/CFROM . This is done without over/underflow as long as the final result CTO * X(i)/CFROM does not over/underflow for i = 1 to size( X).
CFROM must be nonzero.
Arguments¶
- X (INPUT/OUTPUT) real(stnd), dimension(:)
- The real vector to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real vector X is multiplied by CTO/CFROM.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested by E. Anderson. See:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
subroutine lascl ( x, cfrom, cto )
¶
Purpose¶
LASCL multiplies the real matrix X by the real scalar CTO/CFROM . This is done without over/underflow as long as the final result CTO * X(i,j)/CFROM does not over/underflow for i = 1 to size( X, 1) and j = 1 to size( X, 2).
CFROM must be nonzero.
Arguments¶
- X (INPUT/OUTPUT) real(stnd), dimension(:,:)
- The real matrix to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real matrix X is multiplied by CTO/CFROM.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested by E. Anderson. See:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
subroutine lascl ( x, cfrom, cto, type )
¶
Purpose¶
LASCL multiplies the real matrix X by the real scalar CTO/CFROM . This is done without over/underflow as long as the final result CTO * X(i,j)/CFROM does not over/underflow for i = 1 to size( X, 1) and j = 1 to size( X, 2).
CFROM must be nonzero.
TYPE specifies that X may be full, upper triangular, lower triangular or upper Hessenberg.
Arguments¶
- X (INPUT/OUTPUT) real(stnd), dimension(:,:)
- The real matrix to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real matrix X is multiplied by CTO/CFROM.
- TYPE (INPUT) character*1
- TYPE indices the storage type of the input matrix. = ‘L’ or ‘l’: X is a lower triangular matrix. = ‘U’ or ‘u’: X is a upper triangular matrix. = ‘H’ or ‘h’: X is a upper Hessenberg matrix. = ‘G’ or ‘g’: X is a full matrix. = any other character: X is assumed to be a full matrix.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested by E. Anderson. See:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
subroutine lascl ( x, cfrom, cto, mask )
¶
Purpose¶
LASCL multiplies the real scalar X by the real scalar CTO/CFROM under the control of the logical argument MASK . This is done without over/underflow as long as the final result CTO * X/CFROM does not over/underflow.
CFROM must be nonzero.
Arguments¶
- X (INPUT/OUTPUT) real(stnd)
- The real to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real X is multiplied by CTO/CFROM if MASK=true.
- MASK (INPUT) logical(lgl)
- The logical mask : if MASK=true the multiplication is done, otherwise X is left unchanged.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested by E. Anderson. See:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
subroutine lascl ( x, cfrom, cto, mask )
¶
Purpose¶
LASCL multiplies the real vector X by the real scalar CTO/CFROM under the control of the logical argument MASK . This is done without over/underflow as long as the final result CTO * X(i)/CFROM does not over/underflow for i = 1 to size( X).
CFROM must be nonzero.
Arguments¶
- X (INPUT/OUTPUT) real(stnd), dimension(:)
- The real vector to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real X(i) is multiplied by CTO/CFROM if MASK(i)=true.
- MASK (INPUT) logical(lgl), dimension(:)
- The logical mask : if MASK(i)=true the multiplication is done, otherwise X(i) is left unchanged.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested in reference (1).
The sizes of X and MASK must match.
For further details, see:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
subroutine lascl ( x, cfrom, cto, mask )
¶
Purpose¶
LASCL multiplies the real matrix X by the real scalar CTO/CFROM under the control of the logical argument MASK . This is done without over/underflow as long as the final result CTO * X(i,j)/CFROM does not over/underflow for i = 1 to size( X, 1) and j = 1 to size( X, 2).
CFROM must be nonzero.
Arguments¶
- X (INPUT/OUTPUT) real(stnd), dimension(:,:)
- The real matrix to be multiplied by CTO/CFROM.
- CFROM, CTO (INPUT) real(stnd)
- The real X(i,j) is multiplied by CTO/CFROM if MASK(i,j)=true.
- MASK (INPUT) logical(lgl), dimension(:,:)
- The logical mask : if MASK(i,j)=true the multiplication is done, otherwise X(i,j) is left unchanged.
Further Details¶
This subroutine is adapted from the routine DLASCL in LAPACK (version 3.10) with improvements suggested in reference (1).
The shapes of X and MASK must match.
For further details, see:
- Anderson, E., 2002:
- LAPACK3E – A Fortran90-enhanced version of LAPACK. Lapack Working Note 158, University of Tennessee.
function pythag ( a, b )
¶
Purpose¶
Computes sqrt( a * a + b * b ) without destructive underflow or overflow.
Arguments¶
- A (INPUT) real(stnd)
- On entry, the real scalar a.
- B (INPUT) real(stnd)
- On entry, the real scalar b.
function pythage ( a, b )
¶
Purpose¶
Computes sqrt( a * a + b * b ) without destructive underflow or overflow using the Blue’s scaling method.
Arguments¶
- A (INPUT) real(stnd)
- On entry, the real scalar a.
- B (INPUT) real(stnd)
- On entry, the real scalar b.
Further Details¶
The routine is based on methods from the reference (1), but this version is written in Fortran 95/2003. It is machine independent. The algorithm is also described more comprehensively in reference (2).
For more details, see:
- Blue, J.L., 1978:
- A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Soft., Vol. 4, No 1, 15-23.
- Anderson, E., 2018:
- Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.