From de8c6398f269c9fa14842c170b5b21651e817f9b Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 26 Jul 2018 01:21:56 -0400 Subject: removed some files that are now unused --- lib/stack.c | 41 ---------------------------- lib/stack.h | 35 ------------------------ lib/tree.c | 81 ------------------------------------------------------- lib/tree.h | 22 --------------- lib/yule_walker.c | 41 ---------------------------- lib/yule_walker.h | 12 --------- 6 files changed, 232 deletions(-) delete mode 100644 lib/stack.c delete mode 100644 lib/stack.h delete mode 100644 lib/tree.c delete mode 100644 lib/tree.h delete mode 100644 lib/yule_walker.c delete mode 100644 lib/yule_walker.h (limited to 'lib') diff --git a/lib/stack.c b/lib/stack.c deleted file mode 100644 index 9fde1e6..0000000 --- a/lib/stack.c +++ /dev/null @@ -1,41 +0,0 @@ - -#include "stack.h" - -void stack_push(ll_t **q, v_t x) { - ll_t *nq = malloc(sizeof(ll_t)); - nq->x = x; - nq->next = *q; - - *q = nq; -} - -void stack_push_d(dll_t **q, double x) { - dll_t *nq = malloc(sizeof(dll_t)); - nq->x = x; - nq->next = *q; - - *q = nq; -} - -v_t stack_pop(ll_t **q) { - ll_t *old_q = *q; - - *q = old_q->next; - v_t x = old_q->x; - - free(old_q); - - return x; -} - -double stack_pop_d(dll_t **q) { - dll_t *old_q = *q; - - *q = old_q->next; - double x = old_q->x; - - free(old_q); - - return x; -} - diff --git a/lib/stack.h b/lib/stack.h deleted file mode 100644 index 8d25aff..0000000 --- a/lib/stack.h +++ /dev/null @@ -1,35 +0,0 @@ - -#pragma once - -#include -#include -#include -#include - -#include "types.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct ll_tag { - v_t x; - struct ll_tag *next; -} ll_t; - -typedef struct dll_tag { - double x; - struct dll_tag *next; -} dll_t; - -void stack_push(ll_t **q, v_t x); -void stack_push_d(dll_t **q, double x); - -v_t stack_pop(ll_t **q); -double stack_pop_d(dll_t **q); - -#ifdef __cplusplus -} -#endif - diff --git a/lib/tree.c b/lib/tree.c deleted file mode 100644 index 081f1d1..0000000 --- a/lib/tree.c +++ /dev/null @@ -1,81 +0,0 @@ - -#include "tree.h" - -node_t *tree_createNode(v_t value, v_t level, node_t *left, node_t *right) { - node_t *node = (node_t *)malloc(sizeof(node_t)); - - node->value = value; - node->level = level; - node->left = left; - node->right = right; - - return node; -} - -void tree_freeNode(node_t *node) { - if (node != NULL) { - tree_freeNode(node->left); - tree_freeNode(node->right); - free(node); - } -} - -void tree_skew(node_t **T) { - if (*T != NULL) { - if ((*T)->left != NULL) { - if ((*T)->left->level == (*T)->level) { - node_t *L = (*T)->left; - (*T)->left = L->right; - L->right = (*T); - - *T = L; - } - } - } -} - -void tree_split(node_t **T) { - if (*T != NULL) { - if ((*T)->right != NULL) { - if ((*T)->right->right != NULL) { - if ((*T)->level == (*T)->right->right->level) { - node_t *R = (*T)->right; - (*T)->right = R->left; - R->left = *T; - R->level = R->level + 1; - *T = R; - } - } - } - } -} - -void tree_insert(node_t **T, v_t x) { - if (*T == NULL) { - *T = tree_createNode(x, 1, NULL, NULL); - } else if (x < (*T)->value) { - node_t *L = (*T)->left; - tree_insert(&L, x); - (*T)->left = L; - } else if (x > (*T)->value) { - node_t *R = (*T)->right; - tree_insert(&R, x); - (*T)->right = R; - } - - tree_skew(T); - tree_split(T); -} - -bool tree_contains(node_t *T, v_t x) { - if (T == NULL) { - return false; - } else if (x < T->value) { - return tree_contains(T->left, x); - } else if (x > T->value) { - return tree_contains(T->right, x); - } else { - return true; - } -} - diff --git a/lib/tree.h b/lib/tree.h deleted file mode 100644 index dc22c2d..0000000 --- a/lib/tree.h +++ /dev/null @@ -1,22 +0,0 @@ - -#pragma once - -#include -#include -#include - -#include "types.h" - -typedef struct node_t { - v_t value; - v_t level; - struct node_t *left; - struct node_t *right; -} node_t; - -void tree_insert(node_t **T, v_t x); - -bool tree_contains(node_t *T, v_t x); - -void tree_freeNode(node_t *T); - diff --git a/lib/yule_walker.c b/lib/yule_walker.c deleted file mode 100644 index 77b3e96..0000000 --- a/lib/yule_walker.c +++ /dev/null @@ -1,41 +0,0 @@ - -#include "yule_walker.h" - -double yule_walker(const autocorr_t *a) { - gsl_vector *rhos = gsl_vector_alloc(a->W); - gsl_matrix *mat = gsl_matrix_alloc(a->W, a->W); - gsl_vector *phis = gsl_vector_alloc(a->W); - - for (count_t i = 0; i < a->W; i++) { - gsl_vector_set(rhos, i, rho(a, i)); - } - - for (count_t i = 0; i < a->W; i++) { - gsl_matrix_set(mat, i, i, 1.0); - - for (count_t j = 0; j < i; j++) { - gsl_matrix_set(mat, i, j, gsl_vector_get(rhos, i - 1 - j)); - } - - for (count_t j = 0; j < a->W - 1 - i; j++) { - gsl_matrix_set(mat, i, i + 1 + j, gsl_vector_get(rhos, j)); - } - } - - int out = gsl_linalg_cholesky_solve(mat, rhos, phis); - - double rhophi = 0; - double onephi = 0; - - for (count_t i = 0; i < a->W; i++) { - rhophi += gsl_vector_get(rhos, i) * gsl_vector_get(phis, i); - onephi += gsl_vector_get(phis, i); - } - - gsl_vector_free(rhos); - gsl_matrix_free(mat); - gsl_vector_free(phis); - - return (1 - rhophi) / pow(1 - onephi, 2); -} - diff --git a/lib/yule_walker.h b/lib/yule_walker.h deleted file mode 100644 index 883ea03..0000000 --- a/lib/yule_walker.h +++ /dev/null @@ -1,12 +0,0 @@ - -#pragma once - -#include -#include -#include - -#include "types.h" -#include "measurement.h" - -double yule_walker(const autocorr_t *a); - -- cgit v1.2.3-70-g09d2