datastructs_samplers_btree_mod Module

This modules implements a binary tree sampler It provides a way to sample elements based on their weights using a binary tree structure.


Uses

  • module~~datastructs_samplers_btree_mod~~UsesGraph module~datastructs_samplers_btree_mod datastructs_samplers_btree_mod module~datastructs_kinds_mod datastructs_kinds_mod module~datastructs_samplers_btree_mod->module~datastructs_kinds_mod module~datastructs_samplers_base_mod datastructs_samplers_base_mod module~datastructs_samplers_btree_mod->module~datastructs_samplers_base_mod iso_fortran_env iso_fortran_env module~datastructs_kinds_mod->iso_fortran_env module~datastructs_samplers_base_mod->module~datastructs_kinds_mod

Used by

  • module~~datastructs_samplers_btree_mod~~UsedByGraph module~datastructs_samplers_btree_mod datastructs_samplers_btree_mod module~datastructs_samplers_rejection_maxheap_composition_mod datastructs_samplers_rejection_maxheap_composition_mod module~datastructs_samplers_rejection_maxheap_composition_mod->module~datastructs_samplers_btree_mod proc~choose_sampler choose_sampler proc~choose_sampler->module~datastructs_samplers_btree_mod proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_composition_mod

Interfaces

public interface weighted_sampler

Constructor

  • private function weighted_sampler_new(n) result(this)

    Create a new binary tree sampler with N weights Input: n - number of weights

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=i4), intent(in) :: n

    Return Value type(weighted_sampler_t)


Derived Types

type, public, extends(sampler_base_t) ::  weighted_sampler_t

Derived type, extending from the base

Components

Type Visibility Attributes Name Initial
real(kind=dp), public, allocatable :: weights(:)
integer(kind=i4), public :: n = 0
real(kind=dp), public, allocatable :: tree(:)

Finalizations Procedures

final :: sampler_finalize

Type-Bound Procedures

generic, public :: init => init_n, init_w, init_w2
procedure, public :: init_n => sampler_init
procedure, public :: init_w => sampler_init_w
procedure, public :: init_w2 => sampler_init_w2
procedure, public :: reset => sampler_reset
procedure, public :: set_weight => sampler_set_weight
procedure, public :: set_weight_array => sampler_set_weight_array
procedure, public :: add_weight => sampler_add_weight
procedure, public :: sample => sampler_sample
procedure, public :: remove => sampler_remove
procedure, public :: sum => sampler_sum