ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_matrixTrace::getMatMulTraceLog Interface Reference

Generate and return the natural logarithm of the multiplicative trace of an input square matrix of type integer, complex, or real of arbitrary kind.
More...

Detailed Description

Generate and return the natural logarithm of the multiplicative trace of an input square matrix of type integer, complex, or real of arbitrary kind.

See the documentation of pm_matrixTrace for more details.

Parameters
[in]mat: The input non-zero-order matrix of shape (1 : ndim * (ndim - 1) / 2 or (1:ndim, 1:ndim) of,
  1. type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64),
  2. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  3. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the matrix whose natural logarithm of the multiplicative trace is to be computed.
It can be of rank 1 (of shape (1 : ndim * (ndim - 1) / 2) if and only if the input argument mat is present and set to lfpack.
[in]pack: The input scalar that can be,
  1. the constant lfpack signifying the linear full packing of the input matrix.
  2. the constant rdpack signifying the rectangular default packing of the input matrix.
  3. the constant rfpack signifying the rectangular full packing of the input matrix.
(optional, default = rdpack)
[in]subset: The input scalar that can be,
  1. the constant uppDia signifying the storage of the upper-diagonal subset of original matrix in the input matrix.
  2. the constant lowDia signifying the storage of the lower-diagonal subset of original matrix in the input matrix.
(optional. It must be present if and only if the input argument is present and set to either lfpack or rfpack.)
Returns
logMulTrace : The output scalar of the same type and kind as the input matrix mat, containing the natural logarithm of the multiplicative trace of the input square matrix.


Possible calling interfaces

use pm_matrixTrace, only: lfpack, rdpack, rfpack, uppDia, lowDia
logMulTrace = getMatMulTraceLog(mat)
logMulTrace = getMatMulTraceLog(mat, pack) ! pack = rdpack
logMulTrace = getMatMulTraceLog(mat, pack, subset) ! pack = rdpack/lfpack, subset = uppDia/lowDia
!
Generate and return the natural logarithm of the multiplicative trace of an input square matrix of ty...
This module contains procedures and generic interfaces for computing the additive or multiplicative t...
Warning
The input matrix must correspond to a square matrix or a triangular subset of a non-zero-order square matrix.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.
See also
getMatTrace
getMatMulTrace
getMatMulTraceLog
pm_matrixPack
pm_matrixSubset


Example usage

1program example
2
3 use iso_fortran_env, only: output_unit
4 use pm_kind, only: SK, IK, LK, CK, RK
6 use pm_matrixCopy, only: getMatCopy, rdpack, rfpack, lfpack
8 use pm_distUnif, only: getUnifRand
9 use pm_io, only: display_type
10
11 implicit none
12
13 integer(IK) :: ndim, itry, ntry = 5
14
15 type(display_type) :: disp
16 disp = display_type(file = "main.out.F90")
17
18 block
19 integer, allocatable :: mat(:,:), rfp(:,:), lfp(:) ! all integer kinds are supported.
20 do itry = 1, ntry
21 call disp%skip()
22 call disp%show("ndim = getUnifRand(1, 7)")
23 ndim = getUnifRand(1, 7)
24 call disp%show("mat = getUnifRand(1, 9, ndim, ndim)")
25 mat = getUnifRand(1, 9, ndim, ndim)
26 call disp%show("mat")
27 call disp%show( mat )
28 call disp%show("getMatMulTraceLog(mat)")
29 call disp%show( getMatMulTraceLog(mat) )
30 call disp%show("getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia))")
31 call disp%show( getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia)) )
32 call disp%show("getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia))")
33 call disp%show( getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia)) )
34 call disp%show("getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia)")
35 call disp%show( getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia) )
36 call disp%skip()
37 end do
38 end block
39
40end program example
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return a copy of a desired subset of the input source matrix of arbitrary shape (:) or (...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
Definition: pm_kind.F90:542
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
This module contains procedures and generic interfaces relevant to copying (diagonal or upper/lower t...
This module contains abstract and concrete derived types that are required for compile-time resolutio...
type(lowDia_type), parameter lowDia
This is a scalar parameter object of type lowDia_type that is exclusively used to request lower-diago...
type(uppLowDia_type), parameter uppLowDia
This is a scalar parameter object of type uppLowDia_type that is exclusively used to request full dia...
type(uppLow_type), parameter uppLow
This is a scalar parameter object of type uppLow_type that is exclusively used to request upper-lower...
type(uppDia_type), parameter uppDia
This is a scalar parameter object of type uppDia_type that is exclusively used to request upper-diago...
type(dia_type), parameter dia
This is a scalar parameter object of type dia_type that is exclusively used to request unit (or Ident...
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2ndim = getUnifRand(1, 7)
3mat = getUnifRand(1, 9, ndim, ndim)
4mat
5+1, +2, +6, +9
6+5, +3, +8, +5
7+3, +5, +7, +2
8+9, +6, +9, +6
10+4.8362819069514780
11getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia))
12+4.8362819069514780
13getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia))
14+4.8362819069514780
15getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia)
16+6.1862086239004945
17
18
19ndim = getUnifRand(1, 7)
20mat = getUnifRand(1, 9, ndim, ndim)
21mat
22+4, +5, +9
23+5, +1, +9
24+4, +9, +9
26+3.5835189384561099
27getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia))
28+3.5835189384561099
29getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia))
30+3.5835189384561099
31getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia)
32+4.9698132995760007
33
34
35ndim = getUnifRand(1, 7)
36mat = getUnifRand(1, 9, ndim, ndim)
37mat
38+2, +3, +6, +4, +7
39+3, +2, +9, +8, +6
40+2, +4, +8, +5, +3
41+3, +5, +8, +6, +3
42+8, +9, +8, +6, +8
44+7.3369369137076177
45getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia))
46+7.3369369137076177
47getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia))
48+7.3369369137076177
49getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia)
50+8.8410143104838905
51
52
53ndim = getUnifRand(1, 7)
54mat = getUnifRand(1, 9, ndim, ndim)
55mat
56+8, +9, +6, +1
57+9, +7, +2, +2
58+4, +2, +8, +5
59+1, +5, +3, +3
61+7.2034055210830941
62getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia))
63+7.2034055210830941
64getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia))
65+7.2034055210830941
66getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia)
67+4.7874917427820458
68
69
70ndim = getUnifRand(1, 7)
71mat = getUnifRand(1, 9, ndim, ndim)
72mat
73+5
75+1.6094379124341003
76getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = uppDia))
77+1.6094379124341003
78getMatMulTraceLog(getMatCopy(rdpack, mat, rdpack, subset = lowDia))
79+1.6094379124341003
80getMatMulTraceLog(getMatCopy(lfpack, mat, rdpack, lowDia), lfpack, lowDia)
81+1.6094379124341003
82
83
Test:
test_pm_matrixTrace


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, April 23, 2017, 1:36 AM, Institute for Computational Engineering and Sciences (ICES), University of Texas at Austin

Definition at line 2769 of file pm_matrixTrace.F90.


The documentation for this interface was generated from the following file: