26 |
#include <stdlib.h> |
#include <stdlib.h> |
27 |
#include <math.h> |
#include <math.h> |
28 |
#include "alloc.h" |
#include "alloc.h" |
|
#include "str.h" |
|
29 |
#include "case.h" |
#include "case.h" |
30 |
|
#include "casefile.h" |
31 |
#include "command.h" |
#include "command.h" |
32 |
#include "dictionary.h" |
#include "dictionary.h" |
|
#include "lexer.h" |
|
33 |
#include "error.h" |
#include "error.h" |
34 |
|
#include "group_proc.h" |
35 |
|
#include "hash.h" |
36 |
|
#include "levene.h" |
37 |
|
#include "lexer.h" |
38 |
#include "magic.h" |
#include "magic.h" |
39 |
#include "misc.h" |
#include "misc.h" |
40 |
#include "tab.h" |
#include "size_max.h" |
41 |
#include "som.h" |
#include "som.h" |
42 |
|
#include "str.h" |
43 |
|
#include "tab.h" |
44 |
#include "value-labels.h" |
#include "value-labels.h" |
45 |
#include "var.h" |
#include "var.h" |
46 |
#include "vfm.h" |
#include "vfm.h" |
|
#include "hash.h" |
|
|
#include "group_proc.h" |
|
|
#include "casefile.h" |
|
|
#include "levene.h" |
|
47 |
|
|
48 |
#include "gettext.h" |
#include "gettext.h" |
49 |
#define _(msgid) gettext (msgid) |
#define _(msgid) gettext (msgid) |
441 |
tts_custom_pairs (struct cmd_t_test *cmd UNUSED) |
tts_custom_pairs (struct cmd_t_test *cmd UNUSED) |
442 |
{ |
{ |
443 |
struct variable **vars; |
struct variable **vars; |
444 |
int n_vars; |
size_t n_vars; |
445 |
int n_pairs_local; |
size_t n_pairs_local; |
446 |
|
|
447 |
int n_before_WITH ; |
size_t n_before_WITH; |
448 |
int n_after_WITH = -1; |
size_t n_after_WITH = SIZE_MAX; |
449 |
int paired ; /* Was the PAIRED keyword given ? */ |
int paired ; /* Was the PAIRED keyword given ? */ |
450 |
|
|
451 |
lex_match('='); |
lex_match('='); |
459 |
} |
} |
460 |
assert (n_vars); |
assert (n_vars); |
461 |
|
|
462 |
n_before_WITH=0; |
n_before_WITH = 0; |
463 |
if (lex_match (T_WITH)) |
if (lex_match (T_WITH)) |
464 |
{ |
{ |
465 |
n_before_WITH = n_vars; |
n_before_WITH = n_vars; |
487 |
n_before_WITH, n_after_WITH ); |
n_before_WITH, n_after_WITH ); |
488 |
return 0; |
return 0; |
489 |
} |
} |
490 |
n_pairs_local=n_before_WITH; |
n_pairs_local = n_before_WITH; |
491 |
} |
} |
492 |
else if (n_before_WITH > 0) /* WITH keyword given, but not PAIRED keyword */ |
else if (n_before_WITH > 0) /* WITH keyword given, but not PAIRED keyword */ |
493 |
{ |
{ |
494 |
n_pairs_local=n_before_WITH * n_after_WITH ; |
n_pairs_local = n_before_WITH * n_after_WITH ; |
495 |
} |
} |
496 |
else /* Neither WITH nor PAIRED keyword given */ |
else /* Neither WITH nor PAIRED keyword given */ |
497 |
{ |
{ |
504 |
} |
} |
505 |
|
|
506 |
/* how many ways can you pick 2 from n_vars ? */ |
/* how many ways can you pick 2 from n_vars ? */ |
507 |
n_pairs_local = n_vars * (n_vars -1 ) /2 ; |
n_pairs_local = n_vars * (n_vars - 1) / 2; |
508 |
} |
} |
509 |
|
|
510 |
|
|
516 |
{ |
{ |
517 |
int i; |
int i; |
518 |
|
|
519 |
assert(n_pairs_local == n_vars/2); |
assert(n_pairs_local == n_vars / 2); |
520 |
for (i = 0; i < n_pairs_local ; ++i) |
for (i = 0; i < n_pairs_local; ++i) |
521 |
{ |
{ |
522 |
pairs[i].v[n_pairs+0] = vars[i]; |
pairs[i].v[n_pairs] = vars[i]; |
523 |
pairs[i].v[n_pairs+1] = vars[i+n_pairs_local]; |
pairs[i].v[n_pairs + 1] = vars[i + n_pairs_local]; |
524 |
} |
} |
525 |
} |
} |
526 |
else if (n_before_WITH > 0) /* WITH keyword given, but not PAIRED keyword */ |
else if (n_before_WITH > 0) /* WITH keyword given, but not PAIRED keyword */ |
527 |
{ |
{ |
528 |
int i,j; |
int i,j; |
529 |
int p=n_pairs; |
size_t p = n_pairs; |
530 |
|
|
531 |
for(i=0 ; i < n_before_WITH ; ++i ) |
for(i=0 ; i < n_before_WITH ; ++i ) |
532 |
{ |
{ |
540 |
} |
} |
541 |
else /* Neither WITH nor PAIRED given */ |
else /* Neither WITH nor PAIRED given */ |
542 |
{ |
{ |
543 |
int i,j; |
size_t i,j; |
544 |
int p=n_pairs; |
size_t p=n_pairs; |
545 |
|
|
546 |
for(i=0 ; i < n_vars ; ++i ) |
for(i=0 ; i < n_vars ; ++i ) |
547 |
{ |
{ |
890 |
|
|
891 |
/* Implementation of the Test Results box struct */ |
/* Implementation of the Test Results box struct */ |
892 |
|
|
893 |
void trbox_base_init(struct trbox *self,int n_vars, int cols); |
void trbox_base_init(struct trbox *self,size_t n_vars, int cols); |
894 |
void trbox_base_finalize(struct trbox *trb); |
void trbox_base_finalize(struct trbox *trb); |
895 |
|
|
896 |
void trbox_independent_samples_init(struct trbox *trb, |
void trbox_independent_samples_init(struct trbox *trb, |
1318 |
|
|
1319 |
/* Base initializer for the generalized trbox */ |
/* Base initializer for the generalized trbox */ |
1320 |
void |
void |
1321 |
trbox_base_init(struct trbox *self, int data_rows, int cols) |
trbox_base_init(struct trbox *self, size_t data_rows, int cols) |
1322 |
{ |
{ |
1323 |
const int rows = 3 + data_rows; |
const size_t rows = 3 + data_rows; |
1324 |
|
|
1325 |
self->finalize = trbox_base_finalize; |
self->finalize = trbox_base_finalize; |
1326 |
self->t = tab_create (cols, rows, 0); |
self->t = tab_create (cols, rows, 0); |