ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_container::cmc_type Type Reference

This is the derived type for generating a container of a matrix component of type complex of default kind CK.
More...

Public Attributes

complex(CK), dimension(:,:), allocatable val
 

Detailed Description

This is the derived type for generating a container of a matrix component of type complex of default kind CK.

The css_type container is widely known as varying string or string container within the Fortran language.
The constructor of this derived type takes the following arguments.

Parameters
[in]val: The input scalar or array of arbitrary rank of type character of default kind SK.
[in]trimmed: The input scalar or array of the same shape as the input val, of type logical of default kind LK.
If .true., the corresponding elements of the input val will not be trimmed.
Setting this argument to .true. will lead to better runtime performance.
(optional, default = .false., i.e., the trailing blanks in all input val will be trimmed).
Returns
container : The output object of type css_type of the same kind, rank, and shape as the input val, each element of which contains the corresponding element of the input val.


Possible calling interfaces

use pm_kind, only: SK
type(css_type), allocatable :: containers(:)
type(css_type) :: container
container = css_type(val, trimmed = trimmed)
! example
container = css_type(SK_"aaa")
containers = css_type([character(3, SK) :: "a", "aa", "aaa"])
containers = css_type([character(3, SK) :: "a", "aa", "aaa"], trimmed = .false._LK)
This module contains the derived types for generating allocatable containers of scalar,...
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
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 is the css_type type for generating instances of container of scalar of string objects.
Remarks
The procedures under discussion are pure.
The procedures under discussion are elemental.
The existence of this derived type is primarily motivated by the persistent bugs in the implementations of allocatable parameterized derived types in gfortran compilers < 12.
As such, this definition might be redundant once gfortran PDT bugs are resolved.
See also
css_pdt
cvs_pdt
cms_pdt
ccs_pdt
css_type
cvs_type
cms_type
ccs_type


Example usage

1program example
2 use pm_kind, only: SK, IK, LK
3 use pm_io, only: display_type
4 use pm_arrayRange, only: getRange
5 use pm_str, only: getCharVec
6
7 implicit none
8
9 type(display_type) :: disp
10 disp = display_type(file = "main.out.F90")
11
12 block
13
14 use pm_kind, only: SKG => SK
15 use pm_container, only: css_type
16 type(css_type), allocatable :: scalar, vector(:), matrix(:,:), cube(:,:,:)
17
18 call disp%skip()
19 call disp%show("scalar = css_type(SKG_'ParaMonte')")
20 scalar = css_type(SKG_'ParaMonte')
21 call disp%show("scalar")
22 call disp%show( scalar , deliml = SK_"""" )
23 call disp%skip()
24
25 call disp%skip()
26 call disp%show("vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'])")
27 vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'])
28 call disp%show("vector")
29 call disp%show( vector , deliml = SK_"""" )
30 call disp%skip()
31
32 call disp%skip()
33 call disp%show("vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'], trimmed = .false._LK)")
34 vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'], trimmed = .false._LK)
35 call disp%show("vector")
36 call disp%show( vector , deliml = SK_"""" )
37 call disp%skip()
38
39 call disp%skip()
40 call disp%show("vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'], trimmed = .true._LK) ! This will avoid the automatic application of `trim()` to the input string vector.")
41 vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'], trimmed = .true._LK)
42 call disp%show("vector")
43 call disp%show( vector , deliml = SK_"""" )
44 call disp%skip()
45
46 call disp%skip()
47 call disp%show("matrix = css_type( reshape(getCharVec(getRange(SKG_'A', SKG_'X')), shape = [3, 8]) )")
48 matrix = css_type( reshape(getCharVec(getRange(SKG_'A', SKG_'X')), shape = [3, 8]) )
49 call disp%show("matrix")
50 call disp%show( matrix , deliml = SK_"""" )
51 call disp%skip()
52
53 call disp%skip()
54 call disp%show("cube = css_type( reshape(getCharVec(getRange(SKG_'A', SKG_'X')), shape = [2, 3, 4]) )")
55 cube = css_type( reshape(getCharVec(getRange(SKG_'A', SKG_'X')), shape = [2, 3, 4]) )
56 call disp%show("cube")
57 call disp%show( cube , deliml = SK_"""" )
58 call disp%skip()
59
60 end block
61
62end program example
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
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 vector of single-characters each element of which corresponds to one character ...
Definition: pm_str.F90:1242
This module contains procedures and generic interfaces for generating ranges of discrete character,...
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
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
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
This module contains classes and procedures for various string manipulations and inquiries.
Definition: pm_str.F90:49
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
2scalar = css_type(SKG_'ParaMonte')
3scalar
4"ParaMonte"
5
6
7vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'])
8vector
9"a", "aa", "aaa"
10
11
12vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'], trimmed = .false._LK)
13vector
14"a", "aa", "aaa"
15
16
17vector = css_type([character(3,SKG) :: 'a', 'aa', 'aaa'], trimmed = .true._LK) ! This will avoid the automatic application of `trim()` to the input string vector.
18vector
19"a ", "aa ", "aaa"
20
21
22matrix = css_type( reshape(getCharVec(getRange(SKG_'A', SKG_'X')), shape = [3, 8]) )
23matrix
24"A", "D", "G", "J", "M", "P", "S", "V"
25"B", "E", "H", "K", "N", "Q", "T", "W"
26"C", "F", "I", "L", "O", "R", "U", "X"
27
28
29cube = css_type( reshape(getCharVec(getRange(SKG_'A', SKG_'X')), shape = [2, 3, 4]) )
30cube
31object(:,:,1)%val =
32"A", "C", "E"
33"B", "D", "F"
34object(:,:,2)%val =
35"G", "I", "K"
36"H", "J", "L"
37object(:,:,3)%val =
38"M", "O", "Q"
39"N", "P", "R"
40object(:,:,4)%val =
41"S", "U", "W"
42"T", "V", "X"
43
44
Test:
test_pm_container


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:
Fatemeh Bagheri, Tuesday, April 30, 2019, 12:58 PM, SEIR, UTA Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 637 of file pm_container.F90.

Member Data Documentation

◆ val

complex(CK), dimension(:,:), allocatable pm_container::cmc_type::val

Definition at line 638 of file pm_container.F90.


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