Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Classes | Macros | Typedefs | Functions | Variables
mdrAll.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
Include dependency graph for mdrAll.c:

Classes

struct  MDRDataSet
 
struct  MDRMultiIndex
 
struct  MDRModel
 
struct  MDRModelIterator
 
struct  MDRVector
 

Macros

#define MDR_dataset_get_row(_DATA_, _ROW_)   ((_DATA_)->data + (_ROW_) * (_DATA_)->cols)
 
#define MDR_dataset_get(_DATA_, _ROW_, _COL_)   (*(MDR_dataset_get_row(_DATA_,_ROW_) + (_COL_)))
 
#define MDR_dataset_get_col_n_levels(_DATA_, _COL_)   (*((_DATA_)->n_levels + (_COL_)))
 
#define MDR_dataset_get_row_status(_DATA_, _ROW_)   MDR_dataset_get(_DATA_,_ROW_,(_DATA_)->cols - 1)
 
#define MDR_vector_add(_VECTOR_, _ITEM_)   MDR_vector_add_array(_VECTOR_,_ITEM_,1)
 
#define MDR_vector_get(_VECTOR_, _INDEX_)   ((void*)((char*)(_VECTOR_)->data + ((_INDEX_) * (_VECTOR_)->elemsize)))
 
#define MDR_vector_is_empty(_VECTOR_)   ((_VECTOR_)->size == 0)
 
#define MDR_vector_clear(_VECTOR_)   MDR_vector_resize(_VECTOR_,0)
 

Typedefs

typedef unsigned char MDRDatum
 
typedef unsigned int MDRAttribute
 
typedef unsigned short MDRInstance
 
typedef float MDRRatio
 
typedef float MDRFitness
 

Functions

void MDR_dataset_init (MDRDataSet *d)
 
void MDR_dataset_release (MDRDataSet *d)
 
void MDR_dataset_read (MDRDataSet *d, char *dataPtr)
 
void MDR_model_init (MDRModel *m)
 
void MDR_model_release (MDRModel *m)
 
void MDR_model_set_attr (MDRModel *m, const MDRAttribute *attr, MDRAttribute n_attr)
 
void MDR_model_build_cell_counts (MDRModel *m, const MDRDataSet *d, const MDRInstance *rows, MDRInstance n_rows, int exclude, MDRInstance *skipped)
 
void MDR_model_build_cell_statuses (MDRModel *m, const MDRDataSet *d, const MDRInstance *skipped, const MDRDatum *tiePriority)
 
void MDR_model_compute_confusion_matrix (MDRModel *m, const MDRDataSet *d, MDRInstance *conf_matrix)
 
void MDR_model_construct_attribute (MDRModel *m, const MDRDataSet *d, const MDRInstance *rows, MDRInstance n_rows, int exclude, MDRDatum *attrib)
 
void MDR_model_assign (MDRModel *dest, MDRModel *src)
 
void MDR_model_clear_cells (MDRModel *m)
 
void MDR_model_clear_cell_counts (MDRModel *m)
 
void MDR_model_clear_cell_statuses (MDRModel *m)
 
void MDR_model_begin (const MDRModel *m, MDRModelIterator *i)
 
void MDR_model_get_key (const MDRModelIterator *i, size_t *key)
 
MDRInstanceMDR_model_get_cell_counts (const MDRModelIterator *i)
 
MDRDatum MDR_model_get_cell_status (const MDRModelIterator *i)
 
void MDR_model_next (MDRModelIterator *i)
 
int MDR_model_is_end (const MDRModelIterator *i)
 
void MDR_multiindex_init (MDRMultiIndex *m, const size_t *dims, size_t n_dims)
 
void MDR_multiindex_release (MDRMultiIndex *m)
 
void MDR_multiindex_assign (MDRMultiIndex *dest, MDRMultiIndex *src)
 
size_t MDR_multiindex_encode (const MDRMultiIndex *m, const size_t *indices)
 
void MDR_multiindex_decode (const MDRMultiIndex *m, size_t index, size_t *indices)
 
void MDR_vector_init (MDRVector *v, size_t elemsize, size_t init_cap)
 
void MDR_vector_release (MDRVector *v)
 
void * MDR_vector_detach (MDRVector *v)
 
void MDR_vector_assign (MDRVector *dest, MDRVector *src)
 
void * MDR_vector_add_array (MDRVector *v, const void *array, size_t n)
 
void MDR_vector_ensure_capacity (MDRVector *v, size_t capacity)
 
void MDR_vector_resize (MDRVector *v, size_t size)
 
void MDR_vector_trim (MDRVector *v)
 
void MDR_PRIVATE_dataset_finish_row (MDRDataSet *d, MDRVector *data, MDRVector *sc)
 
void MDR_PRIVATE_model_init_cells (MDRModel *m, const MDRDataSet *d)
 
int MDR_PRIVATE_model_build_cells_instance (MDRModel *m, const MDRDataSet *d, MDRInstance row, MDRInstance *skipped, size_t *values)
 
int MDR_PRIVATE_model_construct_attribute_instance (MDRModel *m, const MDRDataSet *d, MDRInstance row, MDRDatum *attrib, size_t *values)
 
void print_combo (FILE *out, const MDRAttribute *attr, MDRAttribute n_attr)
 
void print_model (FILE *out, MDRModel *m)
 
void print_attribute (FILE *out, const MDRDatum *attribute, MDRInstance n_rows)
 
void print_conf_matrix (FILE *out, MDRInstance *conf_matrix, MDRDatum n_status)
 
float balanced_accuracy (MDRInstance *conf_matrix, MDRDatum n_status)
 
int main (int argc, char *argv[])
 

Variables

char exampleData []
 
MDRDatum MDR_UNKNOWN = (MDRDatum)-1
 
const char MDR_LIBRARY_VERSION [] = "0.3.3"
 

Macro Definition Documentation

#define MDR_dataset_get (   _DATA_,
  _ROW_,
  _COL_ 
)    (*(MDR_dataset_get_row(_DATA_,_ROW_) + (_COL_)))
#define MDR_dataset_get_col_n_levels (   _DATA_,
  _COL_ 
)    (*((_DATA_)->n_levels + (_COL_)))
#define MDR_dataset_get_row (   _DATA_,
  _ROW_ 
)    ((_DATA_)->data + (_ROW_) * (_DATA_)->cols)
#define MDR_dataset_get_row_status (   _DATA_,
  _ROW_ 
)    MDR_dataset_get(_DATA_,_ROW_,(_DATA_)->cols - 1)
#define MDR_vector_add (   _VECTOR_,
  _ITEM_ 
)    MDR_vector_add_array(_VECTOR_,_ITEM_,1)

Referenced by MDR_dataset_read().

#define MDR_vector_clear (   _VECTOR_)    MDR_vector_resize(_VECTOR_,0)

Referenced by MDR_dataset_read().

#define MDR_vector_get (   _VECTOR_,
  _INDEX_ 
)    ((void*)((char*)(_VECTOR_)->data + ((_INDEX_) * (_VECTOR_)->elemsize)))
#define MDR_vector_is_empty (   _VECTOR_)    ((_VECTOR_)->size == 0)

Typedef Documentation

typedef unsigned int MDRAttribute
typedef unsigned char MDRDatum
typedef float MDRFitness
typedef unsigned short MDRInstance
typedef float MDRRatio

Function Documentation

float balanced_accuracy ( MDRInstance conf_matrix,
MDRDatum  n_status 
)

References i.

Referenced by main().

int main ( int  argc,
char argv[] 
)
void MDR_dataset_init ( MDRDataSet d)
void MDR_dataset_read ( MDRDataSet d,
char dataPtr 
)

References MDRDataSet::data, MDRVector::data, i, MDR_dataset_release(), MDR_PRIVATE_dataset_finish_row(), MDR_vector_add, MDR_vector_clear, MDR_vector_detach(), MDR_vector_init(), MDR_vector_release(), MDRDataSet::n_status, and MDRVector::size.

Referenced by main().

Here is the call graph for this function:

void MDR_dataset_release ( MDRDataSet d)
void MDR_model_assign ( MDRModel dest,
MDRModel src 
)

References MDRModel::attr, MDRModel::cell_counts, MDRModel::cell_status, MDRModel::index, MDR_model_release(), MDR_multiindex_assign(), MDRModel::n_attr, and MDRModel::n_status.

Here is the call graph for this function:

void MDR_model_begin ( const MDRModel m,
MDRModelIterator i 
)

References MDRModelIterator::i, and MDRModelIterator::m.

Referenced by print_model().

void MDR_model_build_cell_counts ( MDRModel m,
const MDRDataSet d,
const MDRInstance rows,
MDRInstance  n_rows,
int  exclude,
MDRInstance skipped 
)

References MDRModel::cell_counts, i, MDRModel::index, MDR_PRIVATE_model_build_cells_instance(), MDR_PRIVATE_model_init_cells(), MDRModel::n_attr, MDRModel::n_status, MDRDataSet::rows, and MDRMultiIndex::size.

Referenced by main().

Here is the call graph for this function:

void MDR_model_build_cell_statuses ( MDRModel m,
const MDRDataSet d,
const MDRInstance skipped,
const MDRDatum tiePriority 
)
void MDR_model_clear_cell_counts ( MDRModel m)

References MDRModel::cell_counts, MDRModel::cell_status, MDRModel::index, MDR_multiindex_release(), and MDRModel::n_status.

Here is the call graph for this function:

void MDR_model_clear_cell_statuses ( MDRModel m)

References MDRModel::cell_counts, MDRModel::cell_status, MDRModel::index, and MDR_multiindex_release().

Here is the call graph for this function:

void MDR_model_clear_cells ( MDRModel m)

References MDRModel::cell_counts, MDRModel::cell_status, MDRModel::index, MDR_multiindex_release(), and MDRModel::n_status.

Referenced by MDR_model_release(), MDR_model_set_attr(), and MDR_PRIVATE_model_init_cells().

Here is the call graph for this function:

void MDR_model_compute_confusion_matrix ( MDRModel m,
const MDRDataSet d,
MDRInstance conf_matrix 
)
void MDR_model_construct_attribute ( MDRModel m,
const MDRDataSet d,
const MDRInstance rows,
MDRInstance  n_rows,
int  exclude,
MDRDatum attrib 
)

References i, MDR_PRIVATE_model_construct_attribute_instance(), MDRModel::n_attr, and MDRDataSet::rows.

Referenced by main().

Here is the call graph for this function:

MDRInstance * MDR_model_get_cell_counts ( const MDRModelIterator i)
MDRDatum MDR_model_get_cell_status ( const MDRModelIterator i)
void MDR_model_get_key ( const MDRModelIterator i,
size_t *  key 
)

References MDRModelIterator::i, MDRModel::index, MDRModelIterator::m, and MDR_multiindex_decode().

Referenced by print_model().

Here is the call graph for this function:

void MDR_model_init ( MDRModel m)

References MDRModel::attr, MDRModel::cell_counts, MDRModel::cell_status, MDRModel::index, MDR_multiindex_init(), and MDRModel::n_attr.

Referenced by main().

Here is the call graph for this function:

int MDR_model_is_end ( const MDRModelIterator i)
void MDR_model_next ( MDRModelIterator i)

References MDRModelIterator::i.

Referenced by print_model().

void MDR_model_release ( MDRModel m)

References MDRModel::attr, MDR_model_clear_cells(), MDRModel::n_attr, and MDRModel::n_status.

Referenced by main(), and MDR_model_assign().

Here is the call graph for this function:

void MDR_model_set_attr ( MDRModel m,
const MDRAttribute attr,
MDRAttribute  n_attr 
)

References MDRModel::attr, MDR_model_clear_cells(), and MDRModel::n_attr.

Referenced by main().

Here is the call graph for this function:

void MDR_multiindex_assign ( MDRMultiIndex dest,
MDRMultiIndex src 
)

References MDRMultiIndex::dims, MDR_multiindex_release(), and src.

Referenced by MDR_model_assign().

Here is the call graph for this function:

void MDR_multiindex_decode ( const MDRMultiIndex m,
size_t  index,
size_t *  indices 
)
size_t MDR_multiindex_encode ( const MDRMultiIndex m,
const size_t *  indices 
)
void MDR_multiindex_init ( MDRMultiIndex m,
const size_t *  dims,
size_t  n_dims 
)
void MDR_multiindex_release ( MDRMultiIndex m)
void MDR_PRIVATE_dataset_finish_row ( MDRDataSet d,
MDRVector data,
MDRVector sc 
)

References MDRDataSet::cols, i, MDR_UNKNOWN, MDR_vector_get, MDR_vector_resize(), MDRDataSet::n_levels, MDRDataSet::rows, and MDRVector::size.

Referenced by MDR_dataset_read().

Here is the call graph for this function:

int MDR_PRIVATE_model_build_cells_instance ( MDRModel m,
const MDRDataSet d,
MDRInstance  row,
MDRInstance skipped,
size_t *  values 
)

References MDRModel::attr, MDRModel::cell_counts, MDRModel::index, MDR_dataset_get, MDR_dataset_get_row_status, MDR_multiindex_encode(), MDR_UNKNOWN, MDRModel::n_attr, and MDRModel::n_status.

Referenced by MDR_model_build_cell_counts().

Here is the call graph for this function:

int MDR_PRIVATE_model_construct_attribute_instance ( MDRModel m,
const MDRDataSet d,
MDRInstance  row,
MDRDatum attrib,
size_t *  values 
)

References MDRModel::attr, MDRModel::cell_status, MDRModel::index, MDR_dataset_get, MDR_multiindex_encode(), MDR_UNKNOWN, and MDRModel::n_attr.

Referenced by MDR_model_construct_attribute().

Here is the call graph for this function:

void MDR_PRIVATE_model_init_cells ( MDRModel m,
const MDRDataSet d 
)

References MDRModel::attr, MDRModel::cell_counts, MDRModel::cell_status, MDRDataSet::cols, i, MDRModel::index, MDR_model_clear_cells(), MDR_multiindex_init(), MDR_UNKNOWN, MDRModel::n_attr, MDRDataSet::n_levels, MDRModel::n_status, and MDRMultiIndex::size.

Referenced by MDR_model_build_cell_counts().

Here is the call graph for this function:

void * MDR_vector_add_array ( MDRVector v,
const void *  array,
size_t  n 
)

References MDRVector::data, MDRVector::elemsize, MDR_vector_ensure_capacity(), and MDRVector::size.

Here is the call graph for this function:

void MDR_vector_assign ( MDRVector dest,
MDRVector src 
)

References MDRVector::capacity, MDRVector::data, MDRVector::elemsize, MDR_vector_detach(), MDR_vector_release(), and MDRVector::size.

Here is the call graph for this function:

void * MDR_vector_detach ( MDRVector v)
void MDR_vector_ensure_capacity ( MDRVector v,
size_t  capacity 
)
void MDR_vector_init ( MDRVector v,
size_t  elemsize,
size_t  init_cap 
)
void MDR_vector_release ( MDRVector v)
void MDR_vector_resize ( MDRVector v,
size_t  size 
)

References MDRVector::data, MDRVector::elemsize, MDR_vector_ensure_capacity(), and MDRVector::size.

Referenced by MDR_PRIVATE_dataset_finish_row().

Here is the call graph for this function:

void MDR_vector_trim ( MDRVector v)
void print_attribute ( FILE *  out,
const MDRDatum attribute,
MDRInstance  n_rows 
)

References i, and MDR_UNKNOWN.

Referenced by main().

void print_combo ( FILE *  out,
const MDRAttribute attr,
MDRAttribute  n_attr 
)

References i.

Referenced by main().

void print_conf_matrix ( FILE *  out,
MDRInstance conf_matrix,
MDRDatum  n_status 
)

References i.

Referenced by main().

void print_model ( FILE *  out,
MDRModel m 
)

References i, MDR_model_begin(), MDR_model_get_cell_counts(), MDR_model_get_cell_status(), MDR_model_get_key(), MDR_model_is_end(), MDR_model_next(), MDR_UNKNOWN, MDRModel::n_attr, and MDRModel::n_status.

Referenced by main().

Here is the call graph for this function:

Variable Documentation

char exampleData[]
const char MDR_LIBRARY_VERSION[] = "0.3.3"
MDRDatum MDR_UNKNOWN = (MDRDatum)-1