projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MATRIX DATA: Fully implement.
[pspp]
/
src
/
math
/
wilcoxon-sig.c
diff --git
a/src/math/wilcoxon-sig.c
b/src/math/wilcoxon-sig.c
index d9a4bcae43d0020474cedb02ad60985f218ff5a4..17484f1411d51adb170fd431c4b6193dce769f85 100644
(file)
--- a/
src/math/wilcoxon-sig.c
+++ b/
src/math/wilcoxon-sig.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009
, 2021
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-86,7
+86,7
@@
only 250,047.
*/
static unsigned long int
only 250,047.
*/
static unsigned long int
-count_sums_to_W (unsigned long int n,
unsigned
long int w)
+count_sums_to_W (unsigned long int n, long int w)
{
/* The array contain ints even though everything else is long,
but no element in the array can have a value bigger than N,
{
/* The array contain ints even though everything else is long,
but no element in the array can have a value bigger than N,
@@
-95,17
+95,18
@@
count_sums_to_W (unsigned long int n, unsigned long int w)
unsigned long int max;
int *array;
unsigned long int max;
int *array;
+ assert (w >= 0);
assert (n < CHAR_BIT * sizeof (unsigned long int));
if (n == 0)
return 0;
assert (n < CHAR_BIT * sizeof (unsigned long int));
if (n == 0)
return 0;
- else if (w
<
= 0)
+ else if (w
=
= 0)
return 1 << n;
else if (w > n * (n + 1) / 2)
return 0;
else if (n == 1)
return 1;
return 1 << n;
else if (w > n * (n + 1) / 2)
return 0;
else if (n == 1)
return 1;
- array = xcalloc (
sizeof *array, w + 1
);
+ array = xcalloc (
w + 1, sizeof *array
);
array[w] = 1;
max = w;
array[w] = 1;
max = w;