m_la Module

==mat_wpofa.f90 processed by SPAG 8.01RF 01:46 13 Dec 2024



Interfaces

public interface elementcopy

  • private subroutine elementcopy_real128(a1, a2)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: a1(..)
    real(kind=real128) :: a2(..)
  • private subroutine elementcopy_real64(a1, a2)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: a1(..)
    real(kind=real64) :: a2(..)
  • private subroutine elementcopy_real32(a1, a2)

    NAME

    elementcopy(3f) - [M_LA] copy elements from IN to OUT regardless
    of rank until hit end of one of them
    

    SYNOPSIS

     Subroutine elementcopy (IN, OUT)
    
      ${TYPE} (kind=${KIND}), Intent (In) :: IN(..)
      ${TYPE} (kind=${KIND})              :: OUT(..)
    
    Where ${TYPE}(kind=${KIND}) may be
    
       o Real(kind=real32)
       o Real(kind=real64)
       o Real(kind=real128)
       o Integer(kind=int8)
       o Integer(kind=int16)
       o Integer(kind=int32)
       o Integer(kind=int64)
    

    DESCRIPTION

    Copy the elements from scalar or array IN to array or scalar OUT
    until either the end of IN or OUT is reached, regardless of rank
    of the arguments.
    

    OPTIONS

     IN          input array or scalar
     OUT         output array or scalar
    

    EXAMPLES

    Sample program:

    program demo_elementcopy
    use m_la, only : elementcopy
    implicit none
    character(len=*),parameter :: g='(*(g0:,","))'
    real :: b, b1(3), b2(2,3), b3(2,2,2)
    real :: c8(8), c6(6), c3(3), c
    integer :: ib, ib1(3), ib2(2,3), ib3(2,2,2)
    integer :: ic8(8), ic6(6), ic3(3), ic
       ! default real
       call elementcopy(100.0,b)
       write(*,g)'b',b
       call elementcopy([1.0,2.0,3.0],b1)
       write(*,g)'b1',b1
       call elementcopy(reshape([1.0,2.0,3.0,4.0,5.0,6.0],[2,3]),b2)
       write(*,g)'b2',b2
       call elementcopy(reshape([1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0],[2,2,2]),b3)
       write(*,g)'b3',b3
       call elementcopy(b3,c8) ! pack
       write(*,g)'c8',c8
       call elementcopy(b3*10,c3) ! smaller
       write(*,g)'c3',c3
       call elementcopy(pack(b3*111.0,.true.),b) ! to scalar
       write(*,g)'b',b
       c6=-999.0
       call elementcopy(b1*10,c6) ! bigger
       write(*,g)'c6',c6
       call elementcopy(b3(2:,2,2),c) !  to scalar from vector
       write(*,g)'c',c
       call elementcopy(b3(2,1,1),c) !  to scalar from element
       write(*,g)'c',c
       call elementcopy(b3,c) !  to scalar
       write(*,g)'c',c
       ! default integer
       call elementcopy(100,ib)
       write(*,g)'ib',ib
       call elementcopy([1,2,3],ib1)
       write(*,g)'ib1',ib1
       call elementcopy(reshape([1,2,3,4,5,6],[2,3]),ib2)
       write(*,g)'ib2',ib2
       call elementcopy(reshape([1,2,3,4,5,6,7,8],[2,2,2]),ib3)
       write(*,g)'ib3',ib3
       call elementcopy(ib3,ic8) ! pack
       write(*,g)'ic8',ic8
       call elementcopy(ib3*10,ic3) ! smaller
       write(*,g)'ic3',ic3
       call elementcopy(pack(ib3*111,.true.),ib) ! to scalar
       write(*,g)'ib',ib
       ic6=-999
       call elementcopy(ib1*10,ic6) ! bigger
       write(*,g)'ic6',ic6
       call elementcopy(ib3(2:,2,2),ic) !  to scalar from vector
       write(*,g)'ic',ic
       call elementcopy(ib3(2,1,1),ic) !  to scalar from element
       write(*,g)'ic',ic
       call elementcopy(ib3,ic) !  to scalar
       write(*,g)'ic',ic
       !
       tesseract: block
       integer :: box(2,3,4,5)
       integer :: i
          call elementcopy([(i,i=1,size(box))],box)
          write(*,g)'box',box
       endblock tesseract
    end program demo_elementcopy
    

    Results:

    b,100.0000
    b1,1.00000,2.00000,3.00000
    b2,1.00000,2.00000,3.00000,4.00000,5.00000,6.00000
    b3,1.00000,2.00000,3.00000,4.00000,5.00000,6.00000,7.00000,8.00000
    c8,1.00000,2.00000,3.00000,4.00000,5.00000,6.00000,7.00000,8.00000
    c3,10.0000,20.0000,30.0000
    b,111.0000
    c6,10.00000,20.00000,30.00000,-999.0000,-999.0000,-999.0000
    c,8.000000
    c,2.000000
    c,1.000000
    ib,100
    ib1,1,2,3
    ib2,1,2,3,4,5,6
    ib3,1,2,3,4,5,6,7,8
    ic8,1,2,3,4,5,6,7,8
    ic3,10,20,30
    ib,111
    ic6,10,20,30,-999,-999,-999
    ic,8
    ic,2
    ic,1
    box,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
    19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,
    36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,
    53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,
    70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,
    87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,
    103,104,105,106,107,108,109,110,111,112,113,114,115,116,
    117,118,119,120
    

    AUTHOR

    John S. Urban, 2022.05.07
    

    LICENSE

    CC0-1.0
    

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: a1(..)
    real(kind=real32) :: a2(..)
  • private subroutine elementcopy_int64(a1, a2)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: a1(..)
    integer(kind=int64) :: a2(..)
  • private subroutine elementcopy_int32(a1, a2)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: a1(..)
    integer(kind=int32) :: a2(..)
  • private subroutine elementcopy_int16(a1, a2)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int16), intent(in) :: a1(..)
    integer(kind=int16) :: a2(..)
  • private subroutine elementcopy_int8(a1, a2)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int8), intent(in) :: a1(..)
    integer(kind=int8) :: a2(..)

public interface linspace

  • private function linspace_real128(x1, x2, n)

    NAME

     linspace(3f) - [M_LA] return a vector of linearly spaced values
    

    SYNOPSIS

    function linspace(x1,x2,n)
    
     integer,intent(in)               :: n
     ${TYPE}(kind=${KIND}),intent(in) :: x1,x2
     ${TYPE}(kind=${KIND})            :: linspace
    
    Where ${TYPE} may be real or integer and ${KIND} may be any
    supported kind for the corresponding type.
    

    USAGE

    Common usage:
    
     y = linspace(x1,x2)
     y = linspace(x1,x2,n)
    

    DESCRIPTION

    linspace returns a vector of linearly spaced values from x1 to
    x2 inclusive. It gives direct control over the number of points
    and always includes the endpoints, the results being the same as
    [(x1+i*(x2-x1)/(n-1),i=0,n-1)] if n>1 and [x1,x2] if n<=1.
    

    OPTIONS

    X1,X2     X1 and X2 are the upper and lower bound of the values
              returned. The options can be of type REAL or INTEGER,
              but must be of the same type.
    
    N         number of values to return
    

    RETURNS

    LINSPACE  The returned row vector starts with X1 and ends with X2,
              returning N evenly spaced values.
    

    EXAMPLES

    Sample program:

    program demo_linspace
    use M_LA,  only : linspace
    implicit none
    character(len=*), parameter :: gen='(*(g0, 1x))'
       write( *, gen ) linspace(  0,      9,    10 )
       write( *, gen ) linspace( 10.0,   20.0,  11 )
       write( *, gen ) linspace( 11.1d0, 12.1d0, 5 )
       write( *, gen ) linspace( 11.1,   12.1,   5 )
    end program demo_linspace
    

    Results: 0 1 2 3 4 5 6 7 8 9 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 11.1000000000 11.3500000000 11.6000000000 11.8500000000 12.100000000 11.1000004 11.3500004 11.6000004 11.8500004 12.1000004

    Results:

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: x1
    real(kind=real128), intent(in) :: x2
    integer, intent(in) :: n

    Return Value real(kind=real128), (n)

  • private function linspace_real64(x1, x2, n)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: x1
    real(kind=real64), intent(in) :: x2
    integer, intent(in) :: n

    Return Value real(kind=real64), (n)

  • private function linspace_real32(x1, x2, n)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: x1
    real(kind=real32), intent(in) :: x2
    integer, intent(in) :: n

    Return Value real(kind=real32), (n)

  • private function linspace_int64(x1, x2, n)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: x1
    integer(kind=int64), intent(in) :: x2
    integer, intent(in) :: n

    Return Value integer(kind=int64), (n)

  • private function linspace_int32(x1, x2, n)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: x1
    integer(kind=int32), intent(in) :: x2
    integer, intent(in) :: n

    Return Value integer(kind=int32), (n)

  • private function linspace_int16(x1, x2, n)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int16), intent(in) :: x1
    integer(kind=int16), intent(in) :: x2
    integer, intent(in) :: n

    Return Value integer(kind=int16), (n)

  • private function linspace_int8(x1, x2, n)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int8), intent(in) :: x1
    integer(kind=int8), intent(in) :: x2
    integer, intent(in) :: n

    Return Value integer(kind=int8), (n)


Functions

public function mat_flop(x)

!GFORTRAN BUG in 8.3 !real,save :: mas(2,14)=reshape([ & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z’fff0ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z’ff00ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z’f000ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000fff0’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000ff00’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000f000’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z’fff0ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z’ff00ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z’f000ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z‘0000ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z‘0000fff0’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z‘0000ff80’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0))],shape(mas))

Read more…

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(in) :: x Read more…

Return Value doubleprecision

public function mat_iwamax(n, xr, xi, incx)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx

Return Value integer

public function mat_pythag(a, b)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: a
doubleprecision :: b

Return Value doubleprecision

public function mat_round(x)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: x

Return Value doubleprecision

public function mat_urand(iy)

Arguments

Type IntentOptional Attributes Name
integer :: iy Read more…

Return Value doubleprecision

public function mat_wasum(n, xr, xi, incx)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx

Return Value doubleprecision

public function mat_wdotci(n, xr, xi, incx, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx
doubleprecision :: yr(*)
doubleprecision :: yi(*)
integer :: incy

Return Value doubleprecision

public function mat_wdotcr(n, xr, xi, incx, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx
doubleprecision :: yr(*)
doubleprecision :: yi(*)
integer :: incy

Return Value doubleprecision

public function mat_wdotui(n, xr, xi, incx, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx
doubleprecision :: yr(*)
doubleprecision :: yi(*)
integer :: incy

Return Value doubleprecision

public function mat_wdotur(n, xr, xi, incx, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx
doubleprecision :: yr(*)
doubleprecision :: yi(*)
integer :: incy

Return Value doubleprecision

public function mat_wnrm2(n, xr, xi, incx)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx

Return Value doubleprecision


Subroutines

public subroutine mat_inverse_hilbert(a, lda, n)

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(out) :: a(lda,n)
integer, intent(in) :: lda
integer, intent(in) :: n

public subroutine mat_magic(a, rows, n)

mat_magic(3f) - [M_LA] create an N x N magic square array, N>2

Read more…

Arguments

Type IntentOptional Attributes Name
doubleprecision :: a(rows,n)
integer, intent(in) :: rows
integer, intent(in) :: n

public subroutine mat_rat(x, len, maxd, a, b, d)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: x
integer :: len
integer :: maxd
doubleprecision :: a
doubleprecision :: b
doubleprecision :: d(len)

public subroutine mat_rref(ar, ai, lda, m, n, eps)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: ar(lda,*)
doubleprecision :: ai(lda,*)
integer, intent(in) :: lda
integer :: m
integer :: n
doubleprecision :: eps

public subroutine mat_rrot(n, dx, incx, dy, incy, c, s)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: dx(*)
integer :: incx
doubleprecision :: dy(*)
integer :: incy
doubleprecision :: c
doubleprecision :: s

public subroutine mat_rrotg(da, db, c, s)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: da
doubleprecision :: db
doubleprecision :: c
doubleprecision :: s

public subroutine mat_rset(n, dx, dy, incy)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: dx
doubleprecision :: dy(*)
integer :: incy

public subroutine mat_rswap(n, x, incx, y, incy)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: x(*)
integer :: incx
doubleprecision :: y(*)
integer :: incy

public subroutine mat_watan(xr, xi, yr, yi)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: xr
doubleprecision :: xi
doubleprecision :: yr
doubleprecision :: yi

public subroutine mat_wcopy(number_of_values, xr, xi, incx, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: number_of_values
doubleprecision, intent(in) :: xr(*)
doubleprecision, intent(in) :: xi(*)
integer, intent(in) :: incx
doubleprecision, intent(out) :: yr(*)
doubleprecision, intent(out) :: yi(*)
integer, intent(in) :: incy

public subroutine mat_wdiv(ar, ai, br, bi, cr, ci)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: ar
doubleprecision :: ai
doubleprecision :: br
doubleprecision :: bi
doubleprecision :: cr
doubleprecision :: ci

public subroutine mat_wlog(in_real, in_imag, out_real, out_imag)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: in_real
doubleprecision :: in_imag
doubleprecision :: out_real
doubleprecision :: out_imag

public subroutine mat_wmul(ar, ai, br, bi, cr, ci)

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(in) :: ar
doubleprecision, intent(in) :: ai
doubleprecision, intent(in) :: br
doubleprecision, intent(in) :: bi
doubleprecision, intent(out) :: cr
doubleprecision, intent(out) :: ci

public subroutine mat_wpofa(ar, ai, lda, n, info)

Arguments

Type IntentOptional Attributes Name
double precision :: ar(lda,*)
double precision :: ai(lda,*)
integer :: lda
integer :: n
integer :: info

public subroutine mat_wpow(in_real, in_imag, out_real, out_imag, power_real, power_imag)

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(in) :: in_real
doubleprecision, intent(in) :: in_imag
doubleprecision, intent(out) :: out_real
doubleprecision, intent(out) :: out_imag
doubleprecision, intent(in) :: power_real
doubleprecision, intent(in) :: power_imag

public subroutine mat_wrscal(n, s, xr, xi, incx)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: s
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx

public subroutine mat_wscal(n, sr, si, xr, xi, incx)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
doubleprecision, intent(in) :: sr
doubleprecision, intent(in) :: si
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx

public subroutine mat_wset(n, xr, xi, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
doubleprecision, intent(in) :: xr
doubleprecision, intent(in) :: xi
doubleprecision :: yr(*)
doubleprecision :: yi(*)
integer :: incy

public subroutine mat_wsign(xr, xi, yr, yi, zr, zi)

Arguments

Type IntentOptional Attributes Name
doubleprecision :: xr
doubleprecision :: xi
doubleprecision :: yr
doubleprecision :: yi
doubleprecision :: zr
doubleprecision :: zi

public subroutine mat_wsqrt(x_real, x_imag, y_real, y_imag)

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(in) :: x_real
doubleprecision, intent(in) :: x_imag
doubleprecision, intent(out) :: y_real
doubleprecision, intent(out) :: y_imag

public subroutine mat_wswap(n, xr, xi, incx, yr, yi, incy)

Arguments

Type IntentOptional Attributes Name
integer :: n
doubleprecision :: xr(*)
doubleprecision :: xi(*)
integer :: incx
doubleprecision :: yr(*)
doubleprecision :: yi(*)
integer :: incy