gretl  2020e
About: gretl (Gnu Regression, Econometrics and Time-series Library) is a cross-platform statistical package mainly for econometric analysis.
  Fossies Dox: gretl-2020e.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gretl_btree.c File Reference
#include <glib.h>
#include <math.h>
#include "gretl_btree.h"
Include dependency graph for gretl_btree.c:

Go to the source code of this file.

Data Structures

struct  _BTree
 
struct  _BTreeNode
 

Macros

#define MAX_BTREE_HEIGHT   40
 

Typedefs

typedef struct _BTreeNode BTreeNode
 

Functions

static BTreeNodebtree_node_rotate_left (BTreeNode *node)
 
static BTreeNodebtree_node_rotate_right (BTreeNode *node)
 
static BTreeNodebtree_node_new (gdouble key, gdouble value)
 
static gint key_compare (gdouble a, gdouble b)
 
BTreegretl_btree_new (void)
 
static BTreeNodebtree_first_node (BTree *tree)
 
static BTreeNodebtree_node_previous (BTreeNode *node)
 
static BTreeNodebtree_node_next (BTreeNode *node)
 
static void btree_remove_all (BTree *tree)
 
void gretl_btree_destroy (BTree *tree)
 
static BTreeNodebtree_node_balance (BTreeNode *node)
 
void gretl_btree_insert (BTree *tree, gdouble key, gdouble value)
 
static BTreeNodebtree_find_node (BTree *tree, gdouble key)
 
gdouble gretl_btree_lookup (BTree *tree, gdouble key)
 
void gretl_btree_minmax (BTree *tree, gdouble *keymin, gdouble *keymax)
 

Macro Definition Documentation

◆ MAX_BTREE_HEIGHT

#define MAX_BTREE_HEIGHT   40

Definition at line 37 of file gretl_btree.c.

Typedef Documentation

◆ BTreeNode

typedef struct _BTreeNode BTreeNode

Definition at line 1 of file gretl_btree.c.

Function Documentation

◆ btree_find_node()

static BTreeNode* btree_find_node ( BTree tree,
gdouble  key 
)
static

Definition at line 279 of file gretl_btree.c.

References key_compare(), and _BTree::root.

Referenced by gretl_btree_lookup().

◆ btree_first_node()

static BTreeNode* btree_first_node ( BTree tree)
inlinestatic

Definition at line 100 of file gretl_btree.c.

References _BTreeNode::left, _BTreeNode::left_child, and _BTree::root.

Referenced by btree_remove_all().

◆ btree_node_balance()

static BTreeNode* btree_node_balance ( BTreeNode node)
static

Definition at line 169 of file gretl_btree.c.

References btree_node_rotate_left(), and btree_node_rotate_right().

Referenced by gretl_btree_insert().

◆ btree_node_new()

static BTreeNode* btree_node_new ( gdouble  key,
gdouble  value 
)
static

Definition at line 59 of file gretl_btree.c.

References FALSE.

Referenced by gretl_btree_insert().

◆ btree_node_next()

static BTreeNode* btree_node_next ( BTreeNode node)
inlinestatic

Definition at line 130 of file gretl_btree.c.

References _BTreeNode::left, and _BTreeNode::left_child.

Referenced by btree_remove_all().

◆ btree_node_previous()

static BTreeNode* btree_node_previous ( BTreeNode node)
inlinestatic

Definition at line 117 of file gretl_btree.c.

References _BTreeNode::right, and _BTreeNode::right_child.

◆ btree_node_rotate_left()

static BTreeNode * btree_node_rotate_left ( BTreeNode node)
static

Definition at line 340 of file gretl_btree.c.

References _BTreeNode::balance, FALSE, _BTreeNode::left, _BTreeNode::left_child, and TRUE.

Referenced by btree_node_balance().

◆ btree_node_rotate_right()

static BTreeNode * btree_node_rotate_right ( BTreeNode node)
static

Definition at line 377 of file gretl_btree.c.

References _BTreeNode::balance, FALSE, _BTreeNode::right, _BTreeNode::right_child, and TRUE.

Referenced by btree_node_balance().

◆ btree_remove_all()

static void btree_remove_all ( BTree tree)
static

Definition at line 143 of file gretl_btree.c.

References btree_first_node(), btree_node_next(), _BTree::nnodes, and _BTree::root.

Referenced by gretl_btree_destroy().

◆ gretl_btree_destroy()

void gretl_btree_destroy ( BTree tree)

Definition at line 161 of file gretl_btree.c.

References btree_remove_all().

Referenced by subst_val_via_tree().

◆ gretl_btree_insert()

void gretl_btree_insert ( BTree tree,
gdouble  key,
gdouble  value 
)

◆ gretl_btree_lookup()

gdouble gretl_btree_lookup ( BTree tree,
gdouble  key 
)

Definition at line 307 of file gretl_btree.c.

References btree_find_node().

Referenced by subst_val_via_tree().

◆ gretl_btree_minmax()

void gretl_btree_minmax ( BTree tree,
gdouble *  keymin,
gdouble *  keymax 
)

Definition at line 319 of file gretl_btree.c.

References _BTreeNode::key, _BTreeNode::left, R, and _BTree::root.

◆ gretl_btree_new()

BTree* gretl_btree_new ( void  )

Definition at line 90 of file gretl_btree.c.

References _BTree::nnodes, and _BTree::root.

Referenced by subst_val_via_tree().

◆ key_compare()

static gint key_compare ( gdouble  a,
gdouble  b 
)
static

Definition at line 75 of file gretl_btree.c.

References isnan.

Referenced by btree_find_node(), and gretl_btree_insert().