This module implements a maxheap structure, keeping track of the maximum value and its index.
Example:
program example_maxheap
use datastructs_fortran
use kinds_mod
implicit none
type ( maxheap_t ) :: my_heap
real ( kind = dp ), parameter :: list ( * ) = [ 4 0.0_dp , 2 5.5_dp , 3 0.1_dp , 10 0.4_dp , 2.0_dp ]
integer ( kind = i4 ) :: i
call my_heap % init ( 10 )
do i = 1 , size ( list )
call my_heap % add ( list ( i ), i )
end do
call my_heap % print ()
call my_heap % remove ( 4 )
call my_heap % print ()
end program example_maxheap
module~~datastructs_maxheap_mod~~UsesGraph
module~datastructs_maxheap_mod
datastructs_maxheap_mod
module~datastructs_kinds_mod
datastructs_kinds_mod
module~datastructs_maxheap_mod->module~datastructs_kinds_mod
iso_fortran_env
iso_fortran_env
module~datastructs_kinds_mod->iso_fortran_env
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
module~~datastructs_maxheap_mod~~UsedByGraph
module~datastructs_maxheap_mod
datastructs_maxheap_mod
module~datastructs_lists_mod
datastructs_lists_mod
module~datastructs_lists_mod->module~datastructs_maxheap_mod
module~datastructs_mod
datastructs_mod
module~datastructs_mod->module~datastructs_lists_mod
module~datastructs_samplers_rejection_maxheap_composition_mod
datastructs_samplers_rejection_maxheap_composition_mod
module~datastructs_samplers_rejection_maxheap_composition_mod->module~datastructs_lists_mod
module~datastructs_samplers_rejection_maxheap_mod
datastructs_samplers_rejection_maxheap_mod
module~datastructs_samplers_rejection_maxheap_composition_mod->module~datastructs_samplers_rejection_maxheap_mod
module~datastructs_samplers_rejection_maxheap_mod->module~datastructs_lists_mod
module~datastructs_samplers_rejection_maxheap_two_classes_mod
datastructs_samplers_rejection_maxheap_two_classes_mod
module~datastructs_samplers_rejection_maxheap_two_classes_mod->module~datastructs_lists_mod
module~datastructs_samplers_rejection_maxheap_two_classes_mod->module~datastructs_samplers_rejection_maxheap_mod
module~datastructs_samplers_rejection_mod
datastructs_samplers_rejection_mod
module~datastructs_samplers_rejection_mod->module~datastructs_lists_mod
module~datastructs_samplers_rejection_two_classes_mod
datastructs_samplers_rejection_two_classes_mod
module~datastructs_samplers_rejection_two_classes_mod->module~datastructs_lists_mod
module~datastructs_samplers_rejection_two_classes_mod->module~datastructs_samplers_rejection_mod
proc~choose_sampler
choose_sampler
proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_composition_mod
proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_mod
proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_two_classes_mod
proc~choose_sampler->module~datastructs_samplers_rejection_mod
proc~choose_sampler->module~datastructs_samplers_rejection_two_classes_mod
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Interfaces
Constructor for a maxheap
Derived Types
Type for a maxheap
Components
Type
Visibility Attributes
Name
Initial
real(kind=dp),
public,
allocatable
::
values (:)
integer(kind=i4),
public,
allocatable
::
indices (:)
integer(kind=i4),
public,
allocatable
::
pos_of (:)
integer(kind=i4),
public
::
n
=
0
integer(kind=i4),
public
::
max_n
Finalizations Procedures
final :: maxheap_finalize
Type-Bound Procedures
procedure, public ::
init => maxheap_init
procedure, public ::
add => maxheap_add
procedure, public ::
remove => maxheap_remove
procedure, public ::
add_weight => maxheap_add_weight
procedure, public ::
print => maxheap_print
procedure, public ::
max_value => maxheap_max_value
procedure, public ::
max_index => maxheap_max_index