104 mu_assert(model->
n == work->
n,
"n variable copied incorrectly");
105 mu_assert(model->
m == work->
m,
"m variable copied incorrectly");
106 mu_assert(model->
K == work->
K,
"K variable copied incorrectly");
108 mu_assert(work->
LZ != NULL,
"LZ variable is NULL");
109 mu_assert(work->
ZB != NULL,
"ZB variable is NULL");
112 mu_assert(work->
ZV != NULL,
"ZV variable is NULL");
124 for (i=0; i<elem; i++) {
125 ptr[i] = ((double) rand())/((
double) RAND_MAX);
132 for (i=0; i<elem; i++) {
163 "Not all elements of LZ are zero");
165 "Not all elements of ZB are zero");
167 "Not all elements of ZBc are zero");
169 "Not all elements of ZAZ are zero");
171 "Not all elements of ZV are zero");
173 "Not all elements of beta are zero");
Minimal unit testing framework for C.
#define Calloc(type, size)
char * test_allocate_free_model()
void fill_with_noise(double *ptr, int elem)
long K
number of classes for the workspace
double * LZ
n x (m+1) working matrix for the Z'*A*Z calculation
char * test_init_free_data_2()
long m
number of features for the workspace
char * test_init_free_data_1()
#define mu_assert(test, message)
double * ZV
n x (K-1) working matrix for the Z * V calculation
void gensvm_free_work(struct GenWork *work)
Free an allocated GenWork instance.
A structure to hold the GenSVM workspace.
void gensvm_free_model(struct GenModel *model)
Free allocated GenModel struct.
double * ZBc
(K-1) x (m+1) working matrix for the Z'*B calculation
struct GenWork * gensvm_init_work(struct GenModel *model)
Initialize the workspace structure.
char * test_init_free_work()
#define mu_run_test(test)
double * ZAZ
(m+1) x (m+1) working matrix for the Z'*A*Z calculation
char * test_init_free_model_2()
struct GenModel * gensvm_init_model(void)
Initialize a GenModel structure.
A structure to represent the data.
char * test_init_free_model_1()
A structure to represent a single GenSVM model.
void gensvm_reset_work(struct GenWork *work)
Reset all matrices of a GenWork instance.
double * ZB
(m+1) x (K-1) working matrix for the Z'*B calculation
long n
number of instances in the dataset
void gensvm_free_data(struct GenData *data)
Free allocated GenData struct.
void gensvm_allocate_model(struct GenModel *model)
Allocate memory for a GenModel.
char * test_reallocate_free_model()
long K
number of classes in the dataset
void gensvm_reallocate_model(struct GenModel *model, long n, long m)
Reallocate memory for GenModel.
Header file for gensvm_base.c.
struct GenData * gensvm_init_data(void)
Initialize a GenData structure.
long n
number of instances for the workspace
long m
number of predictor variables in the dataset
double * beta
K-1 working vector for a row of the B matrix.
bool all_elements_zero(double *ptr, int elem)
char * test_init_free_data_3()