58 matrix_set(model->
H, model->
K, 0, 0, 0.8465725800087526);
59 matrix_set(model->
H, model->
K, 0, 1, 1.2876921677680249);
60 matrix_set(model->
H, model->
K, 0, 2, 1.0338561593991831);
61 matrix_set(model->
H, model->
K, 1, 0, 1.1891038526621391);
62 matrix_set(model->
H, model->
K, 1, 1, 0.4034192031226095);
63 matrix_set(model->
H, model->
K, 1, 2, 1.5298894170910078);
64 matrix_set(model->
H, model->
K, 2, 0, 1.3505111116922732);
65 matrix_set(model->
H, model->
K, 2, 1, 1.4336863304586636);
66 matrix_set(model->
H, model->
K, 2, 2, 1.7847533480330757);
67 matrix_set(model->
H, model->
K, 3, 0, 1.7712504341475415);
68 matrix_set(model->
H, model->
K, 3, 1, 1.6905146737773038);
69 matrix_set(model->
H, model->
K, 3, 2, 0.8189336598535132);
70 matrix_set(model->
H, model->
K, 4, 0, 0.6164203008844277);
71 matrix_set(model->
H, model->
K, 4, 1, 0.2456444285093894);
72 matrix_set(model->
H, model->
K, 4, 2, 0.8184193969741095);
76 0.7394076262220608) < 1e-14,
77 "Incorrect omega at 0");
79 0.7294526264247443) < 1e-14,
80 "Incorrect omega at 1");
82 0.6802499471888741) < 1e-14,
83 "Incorrect omega at 2");
85 0.6886792032441273) < 1e-14,
86 "Incorrect omega at 3");
88 0.8695329737474283) < 1e-14,
89 "Incorrect omega at 4");
125 matrix_set(model->
H, model->
K, 0, 0, 0.8465725800087526);
126 matrix_set(model->
H, model->
K, 0, 1, 1.2876921677680249);
127 matrix_set(model->
H, model->
K, 0, 2, 1.0338561593991831);
128 matrix_set(model->
H, model->
K, 1, 0, 1.1891038526621391);
129 matrix_set(model->
H, model->
K, 1, 1, 0.4034192031226095);
136 matrix_set(model->
H, model->
K, 3, 2, 0.8189336598535132);
137 matrix_set(model->
H, model->
K, 4, 0, 0.6164203008844277);
138 matrix_set(model->
H, model->
K, 4, 1, 0.2456444285093894);
139 matrix_set(model->
H, model->
K, 4, 2, 0.8184193969741095);
143 "Incorrect simple at 0");
145 "Incorrect simple at 1");
147 "Incorrect simple at 2");
149 "Incorrect simple at 3");
151 "Incorrect simple at 4");
181 mu_assert(fabs(a - 1.5) < 1e-14,
"Incorrect value for a (1)");
182 mu_assert(fabs(b_aq - 1.25) < 1e-14,
"Incorrect value for b (1)");
186 mu_assert(fabs(a - 1.5) < 1e-14,
"Incorrect value for a (2)");
187 mu_assert(fabs(b_aq - 0.0277777777777778) < 1e-14,
188 "Incorrect value for b (2)");
192 mu_assert(fabs(a - 1.5) < 1e-14,
"Incorrect value for a (3)");
193 mu_assert(fabs(b_aq - 0.0) < 1e-14,
"Incorrect value for b (3)");
205 mu_assert(fabs(a - 0.312018860376691) < 1e-14,
206 "Incorrect value for a (4)");
207 mu_assert(fabs(b_aq - 1.35208172829900) < 1e-14,
208 "Incorrect value for b (4)");
212 mu_assert(fabs(a - 0.866025403784439) < 1e-14,
213 "Incorrect value for a (5)");
214 mu_assert(fabs(b_aq - 0.838525491562421) < 1e-14,
215 "Incorrect value for b (5)");
219 mu_assert(fabs(a - 0.866025403784439) < 1e-14,
220 "Incorrect value for a (6)");
221 mu_assert(fabs(b_aq - 0.0721687836487032) < 1e-14,
222 "Incorrect value for b (6)");
226 mu_assert(fabs(a - 0.245495126515491) < 1e-14,
227 "Incorrect value for a (7)");
229 "Incorrect value for b (7)");
256 mu_assert(fabs(a - 0.142857142857143) < 1e-14,
257 "Incorrect value for a (1)");
259 "Incorrect value for b (1)");
263 mu_assert(fabs(a - 0.333333333333333) < 1e-14,
264 "Incorrect value for a (2)");
265 mu_assert(fabs(b_aq - 0.0833333333333333) < 1e-14,
266 "Incorrect value for b (2)");
270 mu_assert(fabs(a - 0.142857142857143) < 1e-14,
271 "Incorrect value for a (3)");
273 "Incorrect value for b (3)");
310 matrix_set(data->
Z, data->
m+1, 0, 0, 1.0000000000000000);
311 matrix_set(data->
Z, data->
m+1, 0, 1, 0.6437306339619082);
312 matrix_set(data->
Z, data->
m+1, 0, 2, -0.3276778319121999);
313 matrix_set(data->
Z, data->
m+1, 0, 3, 0.1564053473463392);
314 matrix_set(data->
Z, data->
m+1, 1, 0, 1.0000000000000000);
315 matrix_set(data->
Z, data->
m+1, 1, 1, -0.8683091763200105);
316 matrix_set(data->
Z, data->
m+1, 1, 2, -0.6910830836015162);
317 matrix_set(data->
Z, data->
m+1, 1, 3, -0.9675430665130734);
318 matrix_set(data->
Z, data->
m+1, 2, 0, 1.0000000000000000);
319 matrix_set(data->
Z, data->
m+1, 2, 1, -0.5024888699077029);
320 matrix_set(data->
Z, data->
m+1, 2, 2, -0.9649738292750712);
321 matrix_set(data->
Z, data->
m+1, 2, 3, 0.0776560791351473);
322 matrix_set(data->
Z, data->
m+1, 3, 0, 1.0000000000000000);
323 matrix_set(data->
Z, data->
m+1, 3, 1, 0.8206429991392579);
324 matrix_set(data->
Z, data->
m+1, 3, 2, -0.7255681388968501);
325 matrix_set(data->
Z, data->
m+1, 3, 3, -0.9475952272877165);
326 matrix_set(data->
Z, data->
m+1, 4, 0, 1.0000000000000000);
327 matrix_set(data->
Z, data->
m+1, 4, 1, 0.3426050950418613);
328 matrix_set(data->
Z, data->
m+1, 4, 2, -0.5340602451864306);
329 matrix_set(data->
Z, data->
m+1, 4, 3, -0.7159704241662815);
330 matrix_set(data->
Z, data->
m+1, 5, 0, 1.0000000000000000);
331 matrix_set(data->
Z, data->
m+1, 5, 1, -0.3077314049206620);
332 matrix_set(data->
Z, data->
m+1, 5, 2, 0.1141288036288195);
333 matrix_set(data->
Z, data->
m+1, 5, 3, -0.7060114827535847);
334 matrix_set(data->
Z, data->
m+1, 6, 0, 1.0000000000000000);
335 matrix_set(data->
Z, data->
m+1, 6, 1, 0.6301294373610109);
336 matrix_set(data->
Z, data->
m+1, 6, 2, -0.9983027363627769);
337 matrix_set(data->
Z, data->
m+1, 6, 3, -0.9365684178444004);
338 matrix_set(data->
Z, data->
m+1, 7, 0, 1.0000000000000000);
339 matrix_set(data->
Z, data->
m+1, 7, 1, -0.0665379368401439);
340 matrix_set(data->
Z, data->
m+1, 7, 2, -0.1781385556871763);
341 matrix_set(data->
Z, data->
m+1, 7, 3, -0.7292593770500276);
356 matrix_set(model->
V, model->
K-1, 0, 0, -0.7593642121025029);
357 matrix_set(model->
V, model->
K-1, 0, 1, -0.5497320698504756);
358 matrix_set(model->
V, model->
K-1, 1, 0, 0.2982680646268177);
359 matrix_set(model->
V, model->
K-1, 1, 1, -0.2491408622891925);
360 matrix_set(model->
V, model->
K-1, 2, 0, -0.3118572761092807);
361 matrix_set(model->
V, model->
K-1, 2, 1, 0.5461219445756100);
362 matrix_set(model->
V, model->
K-1, 3, 0, -0.3198994238626641);
363 matrix_set(model->
V, model->
K-1, 3, 1, 0.7134997072555367);
376 -0.1323791019594062) < 1e-14,
377 "Incorrect value of model->V at 0, 0");
379 -0.3598407983154332) < 1e-14,
380 "Incorrect value of model->V at 0, 1");
382 0.3532993103400935) < 1e-14,
383 "Incorrect value of model->V at 1, 0");
385 -0.4094572388475382) < 1e-14,
386 "Incorrect value of model->V at 1, 1");
388 0.1313169839871234) < 1e-14,
389 "Incorrect value of model->V at 2, 0");
391 0.2423439972728328) < 1e-14,
392 "Incorrect value of model->V at 2, 1");
394 0.0458431025455224) < 1e-14,
395 "Incorrect value of model->V at 3, 0");
397 0.4390030236354089) < 1e-14,
398 "Incorrect value of model->V at 3, 1");
437 matrix_set(data->
Z, data->
m+1, 0, 0, 1.0000000000000000);
438 matrix_set(data->
Z, data->
m+1, 0, 1, 0.6437306339619082);
439 matrix_set(data->
Z, data->
m+1, 0, 2, -0.3276778319121999);
440 matrix_set(data->
Z, data->
m+1, 0, 3, 0.1564053473463392);
441 matrix_set(data->
Z, data->
m+1, 1, 0, 1.0000000000000000);
442 matrix_set(data->
Z, data->
m+1, 1, 1, -0.8683091763200105);
443 matrix_set(data->
Z, data->
m+1, 1, 2, -0.6910830836015162);
444 matrix_set(data->
Z, data->
m+1, 1, 3, -0.9675430665130734);
445 matrix_set(data->
Z, data->
m+1, 2, 0, 1.0000000000000000);
446 matrix_set(data->
Z, data->
m+1, 2, 1, -0.5024888699077029);
447 matrix_set(data->
Z, data->
m+1, 2, 2, -0.9649738292750712);
448 matrix_set(data->
Z, data->
m+1, 2, 3, 0.0776560791351473);
449 matrix_set(data->
Z, data->
m+1, 3, 0, 1.0000000000000000);
450 matrix_set(data->
Z, data->
m+1, 3, 1, 0.8206429991392579);
451 matrix_set(data->
Z, data->
m+1, 3, 2, -0.7255681388968501);
452 matrix_set(data->
Z, data->
m+1, 3, 3, -0.9475952272877165);
453 matrix_set(data->
Z, data->
m+1, 4, 0, 1.0000000000000000);
454 matrix_set(data->
Z, data->
m+1, 4, 1, 0.3426050950418613);
455 matrix_set(data->
Z, data->
m+1, 4, 2, -0.5340602451864306);
456 matrix_set(data->
Z, data->
m+1, 4, 3, -0.7159704241662815);
457 matrix_set(data->
Z, data->
m+1, 5, 0, 1.0000000000000000);
458 matrix_set(data->
Z, data->
m+1, 5, 1, -0.3077314049206620);
459 matrix_set(data->
Z, data->
m+1, 5, 2, 0.1141288036288195);
460 matrix_set(data->
Z, data->
m+1, 5, 3, -0.7060114827535847);
461 matrix_set(data->
Z, data->
m+1, 6, 0, 1.0000000000000000);
462 matrix_set(data->
Z, data->
m+1, 6, 1, 0.6301294373610109);
463 matrix_set(data->
Z, data->
m+1, 6, 2, -0.9983027363627769);
464 matrix_set(data->
Z, data->
m+1, 6, 3, -0.9365684178444004);
465 matrix_set(data->
Z, data->
m+1, 7, 0, 1.0000000000000000);
466 matrix_set(data->
Z, data->
m+1, 7, 1, -0.0665379368401439);
467 matrix_set(data->
Z, data->
m+1, 7, 2, -0.1781385556871763);
468 matrix_set(data->
Z, data->
m+1, 7, 3, -0.7292593770500276);
490 matrix_set(model->
V, model->
K-1, 0, 0, -0.7593642121025029);
491 matrix_set(model->
V, model->
K-1, 0, 1, -0.5497320698504756);
492 matrix_set(model->
V, model->
K-1, 1, 0, 0.2982680646268177);
493 matrix_set(model->
V, model->
K-1, 1, 1, -0.2491408622891925);
494 matrix_set(model->
V, model->
K-1, 2, 0, -0.3118572761092807);
495 matrix_set(model->
V, model->
K-1, 2, 1, 0.5461219445756100);
496 matrix_set(model->
V, model->
K-1, 3, 0, -0.3198994238626641);
497 matrix_set(model->
V, model->
K-1, 3, 1, 0.7134997072555367);
510 -0.1323791019594062) < 1e-14,
511 "Incorrect value of model->V at 0, 0");
513 -0.3598407983154332) < 1e-14,
514 "Incorrect value of model->V at 0, 1");
516 0.3532993103400935) < 1e-14,
517 "Incorrect value of model->V at 1, 0");
519 -0.4094572388475382) < 1e-14,
520 "Incorrect value of model->V at 1, 1");
522 0.1313169839871234) < 1e-14,
523 "Incorrect value of model->V at 2, 0");
525 0.2423439972728328) < 1e-14,
526 "Incorrect value of model->V at 2, 1");
528 0.0458431025455224) < 1e-14,
529 "Incorrect value of model->V at 3, 0");
531 0.4390030236354089) < 1e-14,
532 "Incorrect value of model->V at 3, 1");
549 double *A =
Calloc(
double, n*n);
550 double *B =
Calloc(
double, n*
m);
577 B[0] = 0.5759809004700531;
578 B[1] = 0.4643751885289473;
579 B[2] = 0.1914807543974765;
580 B[3] = 0.2875503245961965;
581 B[4] = 0.0493123646253395;
582 B[5] = 0.4333053066976881;
583 B[6] = 0.4738306027724854;
584 B[7] = 0.2460182087225041;
585 B[8] = 0.1620492662433550;
586 B[9] = 0.9596380576403235;
587 B[10] = 0.7244837218691289;
588 B[11] = 0.9437116578537014;
589 B[12] = 0.3320986772155025;
590 B[13] = 0.4717424581951766;
591 B[14] = 0.9206089360217588;
592 B[15] = 0.7059004575000609;
593 B[16] = 0.1696670763906902;
594 B[17] = 0.4896586269167711;
595 B[18] = 0.9539497766794410;
596 B[19] = 0.2269749103273779;
597 B[20] = 0.8832156948007016;
598 B[21] = 0.4682217970327739;
599 B[22] = 0.5293439096127632;
600 B[23] = 0.8699136677253214;
601 B[24] = 0.1622687366790325;
602 B[25] = 0.4511598310105013;
603 B[26] = 0.5587302139109592;
604 B[27] = 0.7456952498557438;
605 B[28] = 0.5923112589693547;
606 B[29] = 0.2243481938151050;
611 int status =
dposv(
'L', n, m, A, n, B, n);
612 mu_assert(status == 0,
"dposv didn't return status success");
617 mu_assert(fabs(B[0] - 0.0770250502756885) < 1e-14,
618 "Incorrect value of B at 0");
619 mu_assert(fabs(B[1] - 0.0449013611583528) < 1e-14,
620 "Incorrect value of B at 1");
621 mu_assert(fabs(B[2] - 0.0028421256926631) < 1e-14,
622 "Incorrect value of B at 2");
623 mu_assert(fabs(B[3] - 0.0238082780914757) < 1e-14,
624 "Incorrect value of B at 3");
625 mu_assert(fabs(B[4] - -0.0213884392480803) < 1e-14,
626 "Incorrect value of B at 4");
627 mu_assert(fabs(B[5] - 0.0432493445363141) < 1e-14,
628 "Incorrect value of B at 5");
629 mu_assert(fabs(B[6] - 0.0469188408250497) < 1e-14,
630 "Incorrect value of B at 6");
631 mu_assert(fabs(B[7] - -0.0188676544565197) < 1e-14,
632 "Incorrect value of B at 7");
633 mu_assert(fabs(B[8] - -0.0268693544126544) < 1e-14,
634 "Incorrect value of B at 8");
635 mu_assert(fabs(B[9] - 0.1139942447258460) < 1e-14,
636 "Incorrect value of B at 9");
637 mu_assert(fabs(B[10] - 0.0539483576192093) < 1e-14,
638 "Incorrect value of B at 10");
639 mu_assert(fabs(B[11] - 0.1098843745987866) < 1e-14,
640 "Incorrect value of B at 11");
641 mu_assert(fabs(B[12] - 0.0142822905211067) < 1e-14,
642 "Incorrect value of B at 12");
643 mu_assert(fabs(B[13] - 0.0425078586146396) < 1e-14,
644 "Incorrect value of B at 13");
645 mu_assert(fabs(B[14] - 0.1022650353097420) < 1e-14,
646 "Incorrect value of B at 14");
647 mu_assert(fabs(B[15] - 0.0700476338859921) < 1e-14,
648 "Incorrect value of B at 15");
649 mu_assert(fabs(B[16] - -0.0171546096353451) < 1e-14,
650 "Incorrect value of B at 16");
651 mu_assert(fabs(B[17] - 0.0389772844468578) < 1e-14,
652 "Incorrect value of B at 17");
653 mu_assert(fabs(B[18] - 0.1231757430810565) < 1e-14,
654 "Incorrect value of B at 18");
655 mu_assert(fabs(B[19] - -0.0246954324681607) < 1e-14,
656 "Incorrect value of B at 19");
657 mu_assert(fabs(B[20] - 0.0853098528328778) < 1e-14,
658 "Incorrect value of B at 20");
659 mu_assert(fabs(B[21] - 0.0155226252622933) < 1e-14,
660 "Incorrect value of B at 21");
661 mu_assert(fabs(B[22] - 0.0305321945431931) < 1e-14,
662 "Incorrect value of B at 22");
663 mu_assert(fabs(B[23] - 0.0965724559730953) < 1e-14,
664 "Incorrect value of B at 23");
665 mu_assert(fabs(B[24] - -0.0106596940426243) < 1e-14,
666 "Incorrect value of B at 24");
667 mu_assert(fabs(B[25] - 0.0446093337039209) < 1e-14,
668 "Incorrect value of B at 25");
669 mu_assert(fabs(B[26] - 0.0517721408799503) < 1e-14,
670 "Incorrect value of B at 26");
671 mu_assert(fabs(B[27] - 0.0807167333268751) < 1e-14,
672 "Incorrect value of B at 27");
673 mu_assert(fabs(B[28] - 0.0499219869343351) < 1e-14,
674 "Incorrect value of B at 28");
675 mu_assert(fabs(B[29] - -0.0023736192508975) < 1e-14,
676 "Incorrect value of B at 29");
692 double *A =
Calloc(
double, n*n);
693 double *B =
Calloc(
double, n*
m);
719 B[0] = 0.6037912122210694;
720 B[1] = 0.5464186020522516;
721 B[2] = 0.1810847918541411;
722 B[3] = 0.1418268895582175;
723 B[4] = 0.5459836535934901;
724 B[5] = 0.5890609930309275;
725 B[6] = 0.1128454279279324;
726 B[7] = 0.8930541056550655;
727 B[8] = 0.6946437745982983;
728 B[9] = 0.0955380494302154;
729 B[10] = 0.5750037200376288;
730 B[11] = 0.0326245221201559;
731 B[12] = 0.3336701777312929;
732 B[13] = 0.7648765739095678;
733 B[14] = 0.2662986413718805;
734 B[15] = 0.7850810368985298;
735 B[16] = 0.5432388739552745;
736 B[17] = 0.4387739258059151;
737 B[18] = 0.4257906469646436;
738 B[19] = 0.1272470768775465;
739 B[20] = 0.4276616397814972;
740 B[21] = 0.8137579718316245;
741 B[22] = 0.6849003723960281;
742 B[23] = 0.1768571691078990;
743 B[24] = 0.4183278358395650;
744 B[25] = 0.6517633972400351;
745 B[26] = 0.1154775550239331;
746 B[27] = 0.4217248849174023;
747 B[28] = 0.9179697263236190;
748 B[29] = 0.6532254399609347;
754 int *IPIV =
Calloc(
int, n);
755 double *WORK =
Calloc(
double, 1);
759 status =
dsysv(
'L', n, m, A, n, IPIV, B, n, WORK, -1);
760 mu_assert(status == 0,
"dsysv workspace query failed");
763 WORK =
Realloc(WORK,
double, LWORK);
764 status =
dsysv(
'L', n, m, A, n, IPIV, B, n, WORK, LWORK);
765 mu_assert(status == 0,
"dsysv didn't return status success");
770 mu_assert(fabs(B[0] - 3.0915448286548806) < 1e-14,
771 "Incorrect value of B at 0");
772 mu_assert(fabs(B[1] - -1.2114333666218096) < 1e-14,
773 "Incorrect value of B at 1");
774 mu_assert(fabs(B[2] - -0.1734297056577389) < 1e-14,
775 "Incorrect value of B at 2");
776 mu_assert(fabs(B[3] - -0.6989941801726605) < 1e-14,
777 "Incorrect value of B at 3");
778 mu_assert(fabs(B[4] - 1.2577948324106381) < 1e-14,
779 "Incorrect value of B at 4");
780 mu_assert(fabs(B[5] - -1.4956913279293909) < 1e-14,
781 "Incorrect value of B at 5");
782 mu_assert(fabs(B[6] - -0.2923881304345451) < 1e-14,
783 "Incorrect value of B at 6");
784 mu_assert(fabs(B[7] - 0.3467010144627596) < 1e-14,
785 "Incorrect value of B at 7");
786 mu_assert(fabs(B[8] - 0.4892730831569431) < 1e-14,
787 "Incorrect value of B at 8");
788 mu_assert(fabs(B[9] - 0.2811039364176572) < 1e-14,
789 "Incorrect value of B at 9");
790 mu_assert(fabs(B[10] - -0.7323586733947237) < 1e-14,
791 "Incorrect value of B at 10");
792 mu_assert(fabs(B[11] - 0.0214996365534143) < 1e-14,
793 "Incorrect value of B at 11");
794 mu_assert(fabs(B[12] - -0.9355264353773129) < 1e-14,
795 "Incorrect value of B at 12");
796 mu_assert(fabs(B[13] - 0.2709743256273919) < 1e-14,
797 "Incorrect value of B at 13");
798 mu_assert(fabs(B[14] - 0.2328234557913496) < 1e-14,
799 "Incorrect value of B at 14");
800 mu_assert(fabs(B[15] - 0.9367092697976086) < 1e-14,
801 "Incorrect value of B at 15");
802 mu_assert(fabs(B[16] - -0.4501075692310449) < 1e-14,
803 "Incorrect value of B at 16");
804 mu_assert(fabs(B[17] - 0.0416902255163366) < 1e-14,
805 "Incorrect value of B at 17");
806 mu_assert(fabs(B[18] - 2.2216982312706905) < 1e-14,
807 "Incorrect value of B at 18");
808 mu_assert(fabs(B[19] - -0.4820931673893176) < 1e-14,
809 "Incorrect value of B at 19");
810 mu_assert(fabs(B[20] - -0.8456462251088332) < 1e-14,
811 "Incorrect value of B at 20");
812 mu_assert(fabs(B[21] - -0.3761761825939751) < 1e-14,
813 "Incorrect value of B at 21");
814 mu_assert(fabs(B[22] - 1.1921920764994696) < 1e-14,
815 "Incorrect value of B at 22");
816 mu_assert(fabs(B[23] - -0.6897255145640184) < 1e-14,
817 "Incorrect value of B at 23");
818 mu_assert(fabs(B[24] - 2.0325624816957180) < 1e-14,
819 "Incorrect value of B at 24");
820 mu_assert(fabs(B[25] - -0.9900930297944344) < 1e-14,
821 "Incorrect value of B at 25");
822 mu_assert(fabs(B[26] - -0.0462533459389938) < 1e-14,
823 "Incorrect value of B at 26");
824 mu_assert(fabs(B[27] - 0.0960916931433909) < 1e-14,
825 "Incorrect value of B at 27");
826 mu_assert(fabs(B[28] - 0.5805302287627144) < 1e-14,
827 "Incorrect value of B at 28");
828 mu_assert(fabs(B[29] - -1.0897953557455400) < 1e-14,
829 "Incorrect value of B at 29");
Minimal unit testing framework for C.
#define Calloc(type, size)
long K
number of classes for the workspace
double * H
Huber weighted error matrix.
void gensvm_simplex(struct GenModel *model)
Generate matrix of simplex vertex coordinates.
void gensvm_get_update(struct GenModel *model, struct GenData *data, struct GenWork *work)
Perform a single step of the majorization algorithm to update V.
long m
number of features for the workspace
char * test_gensvm_calculate_ab_simple()
double p
parameter for the L-p norm in the loss function
bool gensvm_majorize_is_simple(struct GenModel *model, struct GenData *data, long i)
Check if we can do simple majorization for a given instance.
void gensvm_calculate_ab_non_simple(struct GenModel *model, long i, long j, double *a, double *b_aq)
Compute majorization coefficients for non-simple instance.
char * test_gensvm_get_update()
#define mu_assert(test, message)
#define matrix_get(M, cols, i, j)
double * ZV
n x (K-1) working matrix for the Z * V calculation
void gensvm_calculate_ab_simple(struct GenModel *model, long i, long j, double *a, double *b_aq)
Compute majorization coefficients for simple instances.
double gensvm_calculate_omega(struct GenModel *model, struct GenData *data, long i)
Calculate the value of omega for a single instance.
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.
int weight_idx
which weights to use (1 = unit, 2 = group)
struct GenWork * gensvm_init_work(struct GenModel *model)
Initialize the workspace structure.
double * V
augmented weight matrix
#define mu_run_test(test)
long * y
array of class labels, 1..K
struct GenModel * gensvm_init_model(void)
Initialize a GenModel structure.
char * test_gensvm_calculate_ab_non_simple()
void gensvm_simplex_diff(struct GenModel *model)
Generate the simplex difference matrix.
A structure to represent the data.
void gensvm_initialize_weights(struct GenData *data, struct GenModel *model)
Initialize instance weights.
A structure to represent a single GenSVM model.
int dposv(char UPLO, int N, int NRHS, double *A, int LDA, double *B, int LDB)
Solve AX = B where A is symmetric positive definite.
#define Realloc(var, type, size)
long n
number of instances in the dataset
void gensvm_free_data(struct GenData *data)
Free allocated GenData struct.
void gensvm_calculate_errors(struct GenModel *model, struct GenData *data, double *ZV)
Calculate the scalar errors.
void gensvm_allocate_model(struct GenModel *model)
Allocate memory for a GenModel.
Header file for gensvm_optimize.c.
char * test_gensvm_majorize_is_simple()
char * test_gensvm_calculate_omega()
Header file for gensvm_simplex.c.
double kappa
parameter for the Huber hinge function
long K
number of classes in the dataset
long m
number of predictors (width of RAW)
struct GenSparse * gensvm_dense_to_sparse(double *A, long rows, long cols)
Convert a dense matrix to a GenSparse structure if advantageous.
#define matrix_set(M, cols, i, j, val)
Header file for gensvm_init.c.
long n
number of instances
void gensvm_calculate_huber(struct GenModel *model)
Calculate the Huber hinge errors.
int dsysv(char UPLO, int N, int NRHS, double *A, int LDA, int *IPIV, double *B, int LDB, double *WORK, int LWORK)
Solve a system of equations AX = B where A is symmetric.
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 * RAW
augmented raw data matrix
char * test_gensvm_get_update_sparse()
struct GenSparse * spZ
sparse representation of the augmented data matrix
double lambda
regularization parameter in the loss function