void mlogit_init(struct mlogit *m, size_t ncat, size_t dim, struct mlogit_work *work) { assert(ncat == 0 || dim <= SIZE_MAX / sizeof(double) / ncat); assert(dim <= SIZE_MAX / sizeof(double) / (dim + 1)); size_t cov_dim = dim * (dim + 1) / 2; catdist_init(&m->dist_, ncat); m->x = xmalloc(ncat * dim * sizeof(*m->x)); m->beta = xmalloc(dim * sizeof(*m->beta)); m->offset = xmalloc(ncat * sizeof(*m->offset)); m->mean_ = xmalloc(dim * sizeof(*m->mean_)); m->cov_ = xmalloc(cov_dim * sizeof(*m->cov_)); m->log_cov_scale_ = 0; m->dim = dim; m->moments = 2; uintset_init(&m->ind); m->x0 = NULL; m->nzmax = 0; version_init(&m->version); if (work) { m->free_work = 0; } else { work = xmalloc(sizeof(*work)); mlogit_work_init(work, ncat, dim); m->free_work = 1; } m->work = work; clear(m); }
int main() { version v1, v2, v3; char c[64]; version_init(&v1, 1, 2, 6); version_parse(&v2, "2.1.6"); version_init(&v3, 1, 2, 5); int count = version_to_string(&c[0], &v1); printf("version: %s\n", c); printf("count: %i\n", count); int b; b = version_cmp(&v1, &v2); printf("b1: %i\n", b); b = version_cmp(&v1, &v3); printf("b2: %i\n", b); b = version_cmp(&v2, &v3); printf("b3: %i\n", b); }
void xep_init(void) { disco_init(); /* init sevice discovery first */ chatstates_init(); composing_init(); delay_init(); muc_init(); oob_init(); ping_init(); registration_init(); vcard_init(); version_init(); }
static int system_init(void) { version_init(); NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); return 0; }