blob: 14278f93636c9bf261fd659b3a50e739ea7276d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/**
* @file msvmmaj_init.c
* @author Gertjan van den Burg
* @date January 7, 2014
* @brief Functions for initializing model and data structures
*
* @details
* This file contains functions for initializing a MajModel instance
* and a MajData instance. In addition, default values for these
* structures are defined here (and only here).
*
*/
#include <math.h>
#include "msvmmaj.h"
#include "msvmmaj_init.h"
/**
* @brief Initialize a MajModel structure
*
* @details
* A MajModel structure is initialized and the default value for the
* parameters are set. A pointer to the initialized model is returned.
*
* @returns initialized MajModel
*/
struct MajModel *msvmmaj_init_model()
{
struct MajModel *model = Malloc(struct MajModel, 1);
// set default values
model->p = 1.0;
model->lambda = pow(2, -8.0);
model->epsilon = 1e-6;
model->kappa = 0.0;
model->weight_idx = 1;
model->kerneltype = K_LINEAR;
model->use_cholesky = false;
return model;
}
/**
* @brief Initialize a MajData structure
*
* @details
* A MajData structure is initialized and default values are set.
* A pointer to the initialized data is returned.
*
* @returns initialized MajData
*
*/
struct MajData *msvmmaj_init_data()
{
struct MajData *data = Malloc(struct MajData, 1);
// set default values
data->kerneltype = K_LINEAR;
data->use_cholesky = false;
return data;
}
|