You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: <kin...@us...> - 2024-06-05 03:08:26
|
Revision: 7161
http://sourceforge.net/p/teem/code/7161
Author: kindlmann
Date: 2024-06-05 03:08:24 +0000 (Wed, 05 Jun 2024)
Log Message:
-----------
happy new year
Modified Paths:
--------------
teem/trunk/src/preamble.c
teem/trunk/src/preamble.mk
Modified: teem/trunk/src/preamble.c
===================================================================
--- teem/trunk/src/preamble.c 2023-11-11 08:11:32 UTC (rev 7160)
+++ teem/trunk/src/preamble.c 2024-06-05 03:08:24 UTC (rev 7161)
@@ -1,6 +1,6 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2023 University of Chicago
+ Copyright (C) 2009--2024 University of Chicago
Copyright (C) 2005--2008 Gordon Kindlmann
Copyright (C) 1998--2004 University of Utah
Modified: teem/trunk/src/preamble.mk
===================================================================
--- teem/trunk/src/preamble.mk 2023-11-11 08:11:32 UTC (rev 7160)
+++ teem/trunk/src/preamble.mk 2024-06-05 03:08:24 UTC (rev 7161)
@@ -1,6 +1,6 @@
#
# Teem: Tools to process and visualize scientific data and images
-# Copyright (C) 2009--2023 University of Chicago
+# Copyright (C) 2009--2024 University of Chicago
# Copyright (C) 2005--2008 Gordon Kindlmann
# Copyright (C) 1998--2004 University of Utah
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-11-11 08:11:33
|
Revision: 7160
http://sourceforge.net/p/teem/code/7160
Author: kindlmann
Date: 2023-11-11 08:11:32 +0000 (Sat, 11 Nov 2023)
Log Message:
-----------
what the hell was that
Modified Paths:
--------------
teem/trunk/src/unrrdu/ilk.c
Modified: teem/trunk/src/unrrdu/ilk.c
===================================================================
--- teem/trunk/src/unrrdu/ilk.c 2023-09-11 10:45:59 UTC (rev 7159)
+++ teem/trunk/src/unrrdu/ilk.c 2023-11-11 08:11:32 UTC (rev 7160)
@@ -298,7 +298,7 @@
"background color to use with boundary behavior \"pad\". "
"Defaults to all zeroes.",
&_bkgLen);
- hestOptAdd_2_Other(&opt, "s", "xSize ySize", scale, "x1 xfrqs1x1",
+ hestOptAdd_2_Other(&opt, "s", "xSize ySize", scale, "x1 x1",
"For each axis, information about how many samples in output:\n "
"\b\bo \"x<float>\": number of output samples is some scaling of "
" the number input of samples; multiplied by <float>\n "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-09-11 10:46:00
|
Revision: 7159
http://sourceforge.net/p/teem/code/7159
Author: kindlmann
Date: 2023-09-11 10:45:59 +0000 (Mon, 11 Sep 2023)
Log Message:
-----------
removing test on nrrdTypeIsIntegral[nrrdTypeBlock] from nrrdSanity()
Modified Paths:
--------------
teem/trunk/src/nrrd/arraysNrrd.c
teem/trunk/src/nrrd/simple.c
Modified: teem/trunk/src/nrrd/arraysNrrd.c
===================================================================
--- teem/trunk/src/nrrd/arraysNrrd.c 2023-09-11 10:12:18 UTC (rev 7158)
+++ teem/trunk/src/nrrd/arraysNrrd.c 2023-09-11 10:45:59 UTC (rev 7159)
@@ -73,10 +73,10 @@
0, /* nrrdTypeFloat: float */
0, /* nrrdTypeDouble: double */
0 /* nrrdTypeBlock: "for some reason we pretend that blocks are integers" is what this
- used to say since ~2002 when this array was created (under the name
- nrrdTypeIsFixedPoint), but that was never justified or necessary (afaik). For 2023
- Teem v2 hacking, GLK got annoyed that CC code in cc.c didn't immediately complain
- that nrrdTypeBloack was a useless type for output CC IDs. */
+ used to say since ~2002 when this array was created (under the name nrrdTypeFixed[],
+ as opposed to floating point), but that was never justified or necessary (afaik).
+ For 2023 Teem v2 hacking, GLK got annoyed that CC code in cc.c didn't immediately
+ complain that nrrdTypeBloack was a useless type for output CC IDs. */
};
const int nrrdTypeIsUnsigned[NRRD_TYPE_MAX + 1] = {
Modified: teem/trunk/src/nrrd/simple.c
===================================================================
--- teem/trunk/src/nrrd/simple.c 2023-09-11 10:12:18 UTC (rev 7158)
+++ teem/trunk/src/nrrd/simple.c 2023-09-11 10:45:59 UTC (rev 7159)
@@ -1538,6 +1538,8 @@
return 0;
}
+ /* this check was added in 2002 without explanation, but now (2023 pre v2 hacking)
+ it conflicts with a change that made that array entry 0; wackiness as yet unseen.
if (!nrrdTypeIsIntegral[nrrdTypeBlock]) {
biffAddf(NRRD,
"%s: nrrdTypeInteger[nrrdTypeBlock] is not true, things "
@@ -1544,7 +1546,7 @@
"could get wacky",
me);
return 0;
- }
+ } */
/* HEY: any other assumptions built into Teem? */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-09-11 10:12:19
|
Revision: 7158
http://sourceforge.net/p/teem/code/7158
Author: kindlmann
Date: 2023-09-11 10:12:18 +0000 (Mon, 11 Sep 2023)
Log Message:
-----------
nrrdTypeIsIntegral[nrrdTypeBlock] is no longer true; this was asserted in ~2002 but never made sense
Modified Paths:
--------------
teem/trunk/src/nrrd/arraysNrrd.c
Modified: teem/trunk/src/nrrd/arraysNrrd.c
===================================================================
--- teem/trunk/src/nrrd/arraysNrrd.c 2023-09-10 23:17:04 UTC (rev 7157)
+++ teem/trunk/src/nrrd/arraysNrrd.c 2023-09-11 10:12:18 UTC (rev 7158)
@@ -72,7 +72,11 @@
1, /* nrrdTypeULLong: unsigned long long */
0, /* nrrdTypeFloat: float */
0, /* nrrdTypeDouble: double */
- 1 /* nrrdTypeBlock: for some reason we pretend that blocks are integers */
+ 0 /* nrrdTypeBlock: "for some reason we pretend that blocks are integers" is what this
+ used to say since ~2002 when this array was created (under the name
+ nrrdTypeIsFixedPoint), but that was never justified or necessary (afaik). For 2023
+ Teem v2 hacking, GLK got annoyed that CC code in cc.c didn't immediately complain
+ that nrrdTypeBloack was a useless type for output CC IDs. */
};
const int nrrdTypeIsUnsigned[NRRD_TYPE_MAX + 1] = {
@@ -87,7 +91,10 @@
1, /* nrrdTypeULLong: unsigned long long */
0, /* nrrdTypeFloat: float */
0, /* nrrdTypeDouble: double */
- 0 /* nrrdTypeBlock: for some reason we pretend that blocks are signed */
+ 0 /* nrrdTypeBlock: "for some reason we pretend that blocks are signed" See note about
+ nrrdTypeIsIntegral[nrrdTypeBlock] above. While the value of
+ nrrdTypeIsUnsigned[nrrdTypeBlock] has not changed; we don't pretend that nrrdTypeBlock
+ is any kind of number. */
};
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-09-10 23:17:07
|
Revision: 7157
http://sourceforge.net/p/teem/code/7157
Author: kindlmann
Date: 2023-09-10 23:17:04 +0000 (Sun, 10 Sep 2023)
Log Message:
-----------
synching with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/nrrd.csv
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/nrrd.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/nrrd.csv 2023-09-10 23:16:22 UTC (rev 7156)
+++ teem/trunk/python/cffi/biffdata/nrrd.csv 2023-09-10 23:17:04 UTC (rev 7157)
@@ -25,10 +25,10 @@
nrrdOrientationReduce,int,1,0,nrrd,nrrd/axis.c:1221
nrrdMetaDataNormalize,int,1,0,nrrd,nrrd/axis.c:1266
nrrdCCFind,int,1,0,nrrd,nrrd/cc.c:285
-nrrdCCAdjacency,int,1,0,nrrd,nrrd/cc.c:542
-nrrdCCMerge,int,1,0,nrrd,nrrd/cc.c:642
-nrrdCCRevalue,int,1,0,nrrd,nrrd/cc.c:792
-nrrdCCSettle,int,1,0,nrrd,nrrd/cc.c:819
+nrrdCCAdjacency,int,1,0,nrrd,nrrd/cc.c:545
+nrrdCCMerge,int,1,0,nrrd,nrrd/cc.c:645
+nrrdCCRevalue,int,1,0,nrrd,nrrd/cc.c:795
+nrrdCCSettle,int,1,0,nrrd,nrrd/cc.c:822
nrrdCCValid,int,0,0,nrrd,nrrd/ccmethods.c:26
nrrdCCSize,unsigned int,1,0,nrrd,nrrd/ccmethods.c:57
nrrdDeringVerboseSet,int,1,0,nrrd,nrrd/deringNrrd.c:101
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2023-09-10 23:16:22 UTC (rev 7156)
+++ teem/trunk/python/cffi/teem.py 2023-09-10 23:17:04 UTC (rev 7157)
@@ -148,10 +148,10 @@
'nrrdOrientationReduce': (_equals_one, 0, b'nrrd', 'nrrd/axis.c:1221'),
'nrrdMetaDataNormalize': (_equals_one, 0, b'nrrd', 'nrrd/axis.c:1266'),
'nrrdCCFind': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:285'),
- 'nrrdCCAdjacency': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:542'),
- 'nrrdCCMerge': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:642'),
- 'nrrdCCRevalue': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:792'),
- 'nrrdCCSettle': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:819'),
+ 'nrrdCCAdjacency': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:545'),
+ 'nrrdCCMerge': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:645'),
+ 'nrrdCCRevalue': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:795'),
+ 'nrrdCCSettle': (_equals_one, 0, b'nrrd', 'nrrd/cc.c:822'),
'nrrdCCValid': ((lambda rv: 0 == rv), 0, b'nrrd', 'nrrd/ccmethods.c:26'),
'nrrdCCSize': (_equals_one, 0, b'nrrd', 'nrrd/ccmethods.c:57'),
'nrrdDeringVerboseSet': (_equals_one, 0, b'nrrd', 'nrrd/deringNrrd.c:101'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-09-10 23:16:23
|
Revision: 7156
http://sourceforge.net/p/teem/code/7156
Author: kindlmann
Date: 2023-09-10 23:16:22 +0000 (Sun, 10 Sep 2023)
Log Message:
-----------
more explicitly disallowing block type
Modified Paths:
--------------
teem/trunk/src/nrrd/cc.c
Modified: teem/trunk/src/nrrd/cc.c
===================================================================
--- teem/trunk/src/nrrd/cc.c 2023-09-07 20:57:42 UTC (rev 7155)
+++ teem/trunk/src/nrrd/cc.c 2023-09-10 23:16:22 UTC (rev 7156)
@@ -314,6 +314,9 @@
biffAddf(NRRD, "%s: got invalid target type %d", me, type);
return 1;
}
+ if (nrrdTypeBlock == type) {
+ biffAddf(NRRD, "%s: cannot output CCs in type %s", me, airEnumStr(nrrdType, type));
+ }
if (!(nrrdTypeIsIntegral[type] && nrrdTypeIsUnsigned[nin->type]
&& nrrdTypeSize[type] <= 4)) {
biffAddf(NRRD,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-09-07 20:57:49
|
Revision: 7155
http://sourceforge.net/p/teem/code/7155
Author: kindlmann
Date: 2023-09-07 20:57:42 +0000 (Thu, 07 Sep 2023)
Log Message:
-----------
changing URL for where GLK learned this trick
Modified Paths:
--------------
teem/trunk/python/cffi/build_teem.py
teem/trunk/python/cffi/exult.py
teem/trunk/python/cffi/lliibb.py
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/build_teem.py
===================================================================
--- teem/trunk/python/cffi/build_teem.py 2023-08-11 16:07:24 UTC (rev 7154)
+++ teem/trunk/python/cffi/build_teem.py 2023-09-07 20:57:42 UTC (rev 7155)
@@ -32,8 +32,8 @@
import exult
-# halt if python2; thanks to https://preview.tinyurl.com/44f2beza
-_x, *_y = 1, 2 # NOTE: A SyntaxError here means you need python3, not python2
+# halt if python2; thanks to https://stackoverflow.com/a/65407535/1465384
+_x, *_y = 1, 2 # NOTE: A SyntaxError means you need Python3, not Python2
del _x, _y
# learned:
Modified: teem/trunk/python/cffi/exult.py
===================================================================
--- teem/trunk/python/cffi/exult.py 2023-08-11 16:07:24 UTC (rev 7154)
+++ teem/trunk/python/cffi/exult.py 2023-09-07 20:57:42 UTC (rev 7155)
@@ -46,8 +46,8 @@
import cffi
-# halt if python2; thanks to https://preview.tinyurl.com/44f2beza
-_x, *_y = 1, 2 # NOTE: A SyntaxError here means you need python3, not python2
+# halt if python2; thanks to https://stackoverflow.com/a/65407535/1465384
+_x, *_y = 1, 2 # NOTE: A SyntaxError means you need Python3, not Python2
del _x, _y
# info about all the Teem libraries (TEEM_LIB_LIST)
Modified: teem/trunk/python/cffi/lliibb.py
===================================================================
--- teem/trunk/python/cffi/lliibb.py 2023-08-11 16:07:24 UTC (rev 7154)
+++ teem/trunk/python/cffi/lliibb.py 2023-09-07 20:57:42 UTC (rev 7155)
@@ -32,8 +32,8 @@
import math as _math # # likely used in _BIFF_DICT, below, for testing function return values
-# halt if python2; thanks to https://preview.tinyurl.com/44f2beza
-_x, *_y = 1, 2 # NOTE: A SyntaxError here means you need python3, not python2
+# halt if python2; thanks to https://stackoverflow.com/a/65407535/1465384
+_x, *_y = 1, 2 # NOTE: A SyntaxError means you need Python3, not Python2
del _x, _y
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2023-08-11 16:07:24 UTC (rev 7154)
+++ teem/trunk/python/cffi/teem.py 2023-09-07 20:57:42 UTC (rev 7155)
@@ -32,8 +32,8 @@
import math as _math # # likely used in _BIFF_DICT, below, for testing function return values
-# halt if python2; thanks to https://preview.tinyurl.com/44f2beza
-_x, *_y = 1, 2 # NOTE: A SyntaxError here means you need python3, not python2
+# halt if python2; thanks to https://stackoverflow.com/a/65407535/1465384
+_x, *_y = 1, 2 # NOTE: A SyntaxError means you need Python3, not Python2
del _x, _y
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-11 16:07:26
|
Revision: 7154
http://sourceforge.net/p/teem/code/7154
Author: kindlmann
Date: 2023-08-11 16:07:24 +0000 (Fri, 11 Aug 2023)
Log Message:
-----------
tweaked handling of too-small ioctl-produced columns
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2023-08-11 06:56:25 UTC (rev 7153)
+++ teem/trunk/src/hest/methodsHest.c 2023-08-11 16:07:24 UTC (rev 7154)
@@ -90,10 +90,17 @@
Try to dynamically learn number of columns in the current terminal from ioctl(), and save
it in hparm->columns. Learning the terminal size from stdin will probably work if we're
not being piped into, else try learning it from stdout (but that won't work if we're
-piping elsewhere), else try learning the terminal size from stderr. If one of these
-works, then hparm->columns is set via ioctl(), and we return 0. If ioctl() never worked,
-then hparm->columns gets the given nonIoctlColumns, and we return 1 (but this 1 is not an
-error that needs any recovering from). */
+piping elsewhere), else try learning the terminal size from stderr.
+
+If one of these works, and returns a reasonably large-enough value for #columns, then
+then hparm->columns is set via the ioctl-generated info, and we return 0. "large-enough"
+means bigger than sanity threshold of max(20, hestDefaultColumns/2); if not above that
+threshold, then hparm->columns is set to it and we return -1. Why bother with this
+threshold: hest usage generation code isn't trusted to produce anything informative with
+a tiny number of columns (and certainly hasn't been well-tested with that).
+
+If ioctl() never worked, then hparm->columns gets the given nonIoctlColumns, and we
+return 1 (but this 1 is not an error that needs any recovering from). */
int
hestParmColumnsIoctl(hestParm *hparm, unsigned int nonIoctlColumns) {
struct winsize wsz;
@@ -101,10 +108,20 @@
if (-1 != ioctl(STDIN_FILENO, TIOCGWINSZ, &wsz)
|| -1 != ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsz)
|| -1 != ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz)) {
+ /* one of the ioctl calls worked */
+ unsigned int sanemin;
/* the "- 2" here may be the sign of a hest bug; sometimes it seems the "\" for line
continuation (in generated usage info) causes a line wrap when it shouldn't */
hparm->columns = wsz.ws_col - 2;
- ret = 0;
+ sanemin = AIR_MAX(20, hestDefaultColumns / 2);
+ if (hparm->columns < sanemin) {
+ /* will ignore the too-small value ioctl produced */
+ hparm->columns = sanemin;
+ ret = -1;
+ } else {
+ /* ioctl didn't say something crazy; we keep it */
+ ret = 0;
+ }
} else {
hparm->columns = nonIoctlColumns;
ret = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-11 06:56:27
|
Revision: 7153
http://sourceforge.net/p/teem/code/7153
Author: kindlmann
Date: 2023-08-11 06:56:25 +0000 (Fri, 11 Aug 2023)
Log Message:
-----------
sync with sources
Modified Paths:
--------------
teem/trunk/python/cffi/cdef/cdef_hest.h
Modified: teem/trunk/python/cffi/cdef/cdef_hest.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_hest.h 2023-08-11 06:50:47 UTC (rev 7152)
+++ teem/trunk/python/cffi/cdef/cdef_hest.h 2023-08-11 06:56:25 UTC (rev 7153)
@@ -116,7 +116,7 @@
length of the hestOpt array, and in arrLen the number of hestOpts actually used and
set. This facilitates implementing something much like an airArray, but without the
burden of extra calls for the user (like airArrayLenIncr), nor new kinds of containers
- for hest and its users to manage: just same same array of hestOpt structs */
+ for hest and its users to manage: it is just the same array of hestOpt structs */
unsigned int arrAlloc, arrLen;
/* --------------------- Output
Things set/allocated by hestParse. */
@@ -215,6 +215,7 @@
extern hestParm *hestParmNew(void);
extern hestParm *hestParmFree(hestParm *parm);
extern void *hestParmFree_vp(void *parm);
+extern int hestParmColumnsIoctl(hestParm *hparm, unsigned int nonIoctlColumns);
extern void hestOptSingleSet(hestOpt *opt, const char *flag, const char *name,
int type, unsigned int min, int max, void *valueP,
const char *dflt, const char *info, unsigned int *sawP,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-11 06:50:49
|
Revision: 7152
http://sourceforge.net/p/teem/code/7152
Author: kindlmann
Date: 2023-08-11 06:50:47 +0000 (Fri, 11 Aug 2023)
Log Message:
-----------
adding and using hestParmColumnsIoctl() to contain in a single function smarts for using ioctl() to get terminal width, for the sake of hest usage
Modified Paths:
--------------
teem/trunk/src/bin/gprobe.c
teem/trunk/src/bin/ilk.c
teem/trunk/src/bin/tend.c
teem/trunk/src/bin/unu.c
teem/trunk/src/hest/hest.h
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/unrrdu/flotsam.c
Modified: teem/trunk/src/bin/gprobe.c
===================================================================
--- teem/trunk/src/bin/gprobe.c 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/bin/gprobe.c 2023-08-11 06:50:47 UTC (rev 7152)
@@ -270,6 +270,7 @@
mop = airMopNew();
hparm = hestParmNew();
airMopAdd(mop, hparm, AIR_CAST(airMopper, hestParmFree), airMopAlways);
+ hestParmColumnsIoctl(hparm, hestDefaultColumns);
hparm->elideSingleOtherType = AIR_TRUE;
hparm->respectDashDashHelp = AIR_TRUE;
hestOptAdd_1_Other(&hopt, "i", "nin", &nin, NULL, "input volume", nrrdHestNrrd);
Modified: teem/trunk/src/bin/ilk.c
===================================================================
--- teem/trunk/src/bin/ilk.c 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/bin/ilk.c 2023-08-11 06:50:47 UTC (rev 7152)
@@ -21,7 +21,6 @@
#include <teem/unrrdu.h>
#include <teem/moss.h>
-#include <sys/ioctl.h>
static const char *ilkInfo
= ("(I)mage (L)inear Trans(X-->K)forms. Applies linear (homogenous coordinate) "
@@ -51,7 +50,6 @@
int debug[2], d, bound, ax0, size[2]; /* HEY size[] should be size_t */
unsigned int matListLen, _bkgLen, i, avgNum, bkgIdx;
double scale[4];
- struct winsize wsz;
me = argv[0];
mop = airMopNew();
@@ -62,12 +60,8 @@
hparm->elideSingleOtherDefault = AIR_FALSE;
hparm->elideMultipleNonExistFloatDefault = AIR_TRUE;
hparm->respFileEnable = AIR_TRUE;
+ hestParmColumnsIoctl(hparm, hestDefaultColumns);
- ioctl(0, TIOCGWINSZ, &wsz);
- /* -2 because else "\" for continuation can wrap when it shouldn't
- (which may be a hest bug) */
- hparm->columns = AIR_MAX(59, wsz.ws_col - 2);
-
hestOptAdd_1_Other(&hopt, "i", "image", &nin, "-", "input image", nrrdHestNrrd);
hestOptAdd_1_Other(&hopt, "0", "origin", &origInfo, "p:0,0",
"where to location (0,0) prior to applying transforms.\n "
Modified: teem/trunk/src/bin/tend.c
===================================================================
--- teem/trunk/src/bin/tend.c 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/bin/tend.c 2023-08-11 06:50:47 UTC (rev 7152)
@@ -21,16 +21,10 @@
#include <teem/ten.h>
-/* to learn # columns */
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
#define TEND "tend"
int
main(int argc, const char **argv) {
- struct winsize wsz;
int i, ret;
const char *me;
char *argv0 = NULL;
@@ -60,18 +54,8 @@
/* so that we look for, and know how to handle, seeing "--help" */
hparm->respectDashDashHelp = AIR_TRUE;
hparm->cleverPluralizeOtherY = AIR_TRUE;
- /* (following ~copied from unu.c) */
- /* Try to dynamically learn number of columns. Learning the terminal size will probably
- work if stdout is the terminal, but not if we're piping elsewhere (as is common with
- unu), Then try stderr, or else use an old reliable number */
- if (-1 != ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsz)) {
- hparm->columns = wsz.ws_col - 2;
- } else if (-1 != ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz)) {
- hparm->columns = wsz.ws_col - 2;
- } else {
- /* old default */
- hparm->columns = 78;
- }
+ /* set hparm->columns from ioctl if possible, else use 78 */
+ hestParmColumnsIoctl(hparm, 78);
/* if there are no arguments, then we give general usage information */
if (1 >= argc) {
Modified: teem/trunk/src/bin/unu.c
===================================================================
--- teem/trunk/src/bin/unu.c 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/bin/unu.c 2023-08-11 06:50:47 UTC (rev 7152)
@@ -21,16 +21,10 @@
#include <teem/unrrdu.h>
-/* to learn # columns */
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
#define UNU "unu"
int
main(int argc, const char **argv) {
- struct winsize wsz;
int i, ret, listAll;
const char *me;
char *argv0 = NULL;
@@ -76,16 +70,8 @@
hparm->elideMultipleEmptyStringDefault = AIR_TRUE;
/* say that we look for, and know how to handle, seeing "--help" */
hparm->respectDashDashHelp = AIR_TRUE;
- /* Try to dynamically learn number of columns. Learning the terminal size will probably
- work if stdout is the terminal, but not if we're piping elsewhere (as is common with
- unu), Then try stderr, or else use unrrduDefNumColumns */
- if (-1 != ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsz)) {
- hparm->columns = wsz.ws_col - 2;
- } else if (-1 != ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz)) {
- hparm->columns = wsz.ws_col - 2;
- } else {
- hparm->columns = unrrduDefNumColumns;
- }
+ /* set hparm->columns from ioctl if possible, else use unrrduDefNumColumns */
+ hestParmColumnsIoctl(hparm, unrrduDefNumColumns);
hparm->greedySingleString = AIR_TRUE;
/* if there are no arguments, or "unu list" (or "unu all" shhh), then we give general
Modified: teem/trunk/src/hest/hest.h
===================================================================
--- teem/trunk/src/hest/hest.h 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/hest/hest.h 2023-08-11 06:50:47 UTC (rev 7152)
@@ -141,7 +141,7 @@
length of the hestOpt array, and in arrLen the number of hestOpts actually used and
set. This facilitates implementing something much like an airArray, but without the
burden of extra calls for the user (like airArrayLenIncr), nor new kinds of containers
- for hest and its users to manage: just same same array of hestOpt structs */
+ for hest and its users to manage: it is just the same array of hestOpt structs */
unsigned int arrAlloc, arrLen;
/* --------------------- Output
@@ -245,6 +245,7 @@
HEST_EXPORT hestParm *hestParmNew(void);
HEST_EXPORT hestParm *hestParmFree(hestParm *parm);
HEST_EXPORT void *hestParmFree_vp(void *parm);
+HEST_EXPORT int hestParmColumnsIoctl(hestParm *hparm, unsigned int nonIoctlColumns);
HEST_EXPORT void hestOptSingleSet(hestOpt *opt, const char *flag, const char *name,
int type, unsigned int min, int max, void *valueP,
const char *dflt, const char *info, unsigned int *sawP,
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/hest/methodsHest.c 2023-08-11 06:50:47 UTC (rev 7152)
@@ -24,6 +24,9 @@
#include <limits.h>
#include <assert.h>
+#include <sys/ioctl.h> /* for ioctl(), TIOCGWINSZ, struct winsize */
+#include <unistd.h> /* for STDOUT_FILENO and friends */
+
const int hestPresent = 42;
/* INCR is like airArray->incr: granularity with which we (linearly) reallocate the
@@ -83,6 +86,32 @@
return NULL;
}
+/* hestParmColumnsIoctl:
+Try to dynamically learn number of columns in the current terminal from ioctl(), and save
+it in hparm->columns. Learning the terminal size from stdin will probably work if we're
+not being piped into, else try learning it from stdout (but that won't work if we're
+piping elsewhere), else try learning the terminal size from stderr. If one of these
+works, then hparm->columns is set via ioctl(), and we return 0. If ioctl() never worked,
+then hparm->columns gets the given nonIoctlColumns, and we return 1 (but this 1 is not an
+error that needs any recovering from). */
+int
+hestParmColumnsIoctl(hestParm *hparm, unsigned int nonIoctlColumns) {
+ struct winsize wsz;
+ int ret;
+ if (-1 != ioctl(STDIN_FILENO, TIOCGWINSZ, &wsz)
+ || -1 != ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsz)
+ || -1 != ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz)) {
+ /* the "- 2" here may be the sign of a hest bug; sometimes it seems the "\" for line
+ continuation (in generated usage info) causes a line wrap when it shouldn't */
+ hparm->columns = wsz.ws_col - 2;
+ ret = 0;
+ } else {
+ hparm->columns = nonIoctlColumns;
+ ret = 1;
+ }
+ return ret;
+}
+
/* _hestMax(-1) == INT_MAX, otherwise _hestMax(m) == m */
int
_hestMax(int max) {
Modified: teem/trunk/src/unrrdu/flotsam.c
===================================================================
--- teem/trunk/src/unrrdu/flotsam.c 2023-08-05 12:09:58 UTC (rev 7151)
+++ teem/trunk/src/unrrdu/flotsam.c 2023-08-11 06:50:47 UTC (rev 7152)
@@ -89,14 +89,9 @@
hparm->elideSingleEmptyStringDefault = AIR_TRUE;
hparm->elideMultipleEmptyStringDefault = AIR_TRUE;
hparm->cleverPluralizeOtherY = AIR_TRUE;
- /* learning columns from current window; if ioctl is available
- if (1) {
- struct winsize ws;
- ioctl(1, TIOCGWINSZ, &ws);
- hparm->columns = ws.ws_col - 1;
- }
- */
- hparm->columns = 78;
+ /* it is up to caller to try hestParmColumnsIoctl if they want
+ output to vary depending on current terminal. If nothing else;
+ hestParmNew() above sets hparm->columns to hestDefaultColumns */
}
/* if there are no arguments, then we give general usage information */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-05 12:10:00
|
Revision: 7151
http://sourceforge.net/p/teem/code/7151
Author: kindlmann
Date: 2023-08-05 12:09:58 +0000 (Sat, 05 Aug 2023)
Log Message:
-----------
variable rename to reflect what is described in the comment
Modified Paths:
--------------
teem/trunk/src/unrrdu/uncmt.c
Modified: teem/trunk/src/unrrdu/uncmt.c
===================================================================
--- teem/trunk/src/unrrdu/uncmt.c 2023-08-04 18:34:16 UTC (rev 7150)
+++ teem/trunk/src/unrrdu/uncmt.c 2023-08-05 12:09:58 UTC (rev 7151)
@@ -58,10 +58,10 @@
state is maintained by the floatCount and doubleCount variables
passed by reference */
int
-nfdsChar(unsigned int *pfc, unsigned int *pdc, int ci) {
+nfdsChar(unsigned int *floatCountP, unsigned int *doubleCountP, int ci) {
int co = ci; /* by default, output == input */
- unsigned int fc = *pfc;
- unsigned int dc = *pdc;
+ unsigned int fc = *floatCountP;
+ unsigned int dc = *doubleCountP;
switch (ci) {
case 'f':
@@ -108,8 +108,8 @@
dc = 5;
}
- *pfc = fc;
- *pdc = dc;
+ *floatCountP = fc;
+ *doubleCountP = dc;
return co;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-04 18:34:18
|
Revision: 7150
http://sourceforge.net/p/teem/code/7150
Author: kindlmann
Date: 2023-08-04 18:34:16 +0000 (Fri, 04 Aug 2023)
Log Message:
-----------
sync with source
Modified Paths:
--------------
teem/trunk/python/cffi/cdef/cdef_air.h
Modified: teem/trunk/python/cffi/cdef/cdef_air.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_air.h 2023-08-04 18:29:43 UTC (rev 7149)
+++ teem/trunk/python/cffi/cdef/cdef_air.h 2023-08-04 18:34:16 UTC (rev 7150)
@@ -383,10 +383,13 @@
extern unsigned int airJSFRandVal(airJSFRand *jsf);
extern unsigned int airJSFRandValMod(airJSFRand *jsf, unsigned int N);
extern float airJSFRandUni_f(airJSFRand *jsf); /* [0,1) */
-extern double airJSFRandUni_d(airJSFRand *jsf); /* [0,1) */
extern float airJSFRandBiUni_f(airJSFRand *jsf); /* (-1,1) */
extern float airJSFRandNormal_f(airJSFRand *jsf);
extern void airJSFRandNormal2_f(airJSFRand *jsf, float val[2]);
+extern double airJSFRandUni_d(airJSFRand *jsf); /* [0,1) */
+extern double airJSFRandBiUni_d(airJSFRand *jsf); /* (-1,1) */
+extern double airJSFRandNormal_d(airJSFRand *jsf);
+extern void airJSFRandNormal2_d(airJSFRand *jsf, double val[2]);
extern int airJSFRandSanity(void);
/* ---- END non-NrrdIO */
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-04 18:29:46
|
Revision: 7149
http://sourceforge.net/p/teem/code/7149
Author: kindlmann
Date: 2023-08-04 18:29:43 +0000 (Fri, 04 Aug 2023)
Log Message:
-----------
finished BUT NOT TESTED double-precision versions
Modified Paths:
--------------
teem/trunk/src/air/air.h
teem/trunk/src/air/randJSF.c
Modified: teem/trunk/src/air/air.h
===================================================================
--- teem/trunk/src/air/air.h 2023-08-04 17:25:15 UTC (rev 7148)
+++ teem/trunk/src/air/air.h 2023-08-04 18:29:43 UTC (rev 7149)
@@ -451,10 +451,13 @@
AIR_EXPORT unsigned int airJSFRandVal(airJSFRand *jsf);
AIR_EXPORT unsigned int airJSFRandValMod(airJSFRand *jsf, unsigned int N);
AIR_EXPORT float airJSFRandUni_f(airJSFRand *jsf); /* [0,1) */
-AIR_EXPORT double airJSFRandUni_d(airJSFRand *jsf); /* [0,1) */
AIR_EXPORT float airJSFRandBiUni_f(airJSFRand *jsf); /* (-1,1) */
AIR_EXPORT float airJSFRandNormal_f(airJSFRand *jsf);
AIR_EXPORT void airJSFRandNormal2_f(airJSFRand *jsf, float val[2]);
+AIR_EXPORT double airJSFRandUni_d(airJSFRand *jsf); /* [0,1) */
+AIR_EXPORT double airJSFRandBiUni_d(airJSFRand *jsf); /* (-1,1) */
+AIR_EXPORT double airJSFRandNormal_d(airJSFRand *jsf);
+AIR_EXPORT void airJSFRandNormal2_d(airJSFRand *jsf, double val[2]);
AIR_EXPORT int airJSFRandSanity(void);
/* ---- END non-NrrdIO */
Modified: teem/trunk/src/air/randJSF.c
===================================================================
--- teem/trunk/src/air/randJSF.c 2023-08-04 17:25:15 UTC (rev 7148)
+++ teem/trunk/src/air/randJSF.c 2023-08-04 18:29:43 UTC (rev 7149)
@@ -188,69 +188,37 @@
#endif
}
-#if 0
-static unsigned int
-uint64_clz(airULLong nn) {
-# if 0
- /* HEY should figure out a configure-time test for having __builtin_clz */
- return __builtin_clzll(nn);
-# else
- unsigned int ret = 0;
- if (!(nn & 0xFFFFFFFF00000000)) {
- ret += 32;
- nn <<= 32;
- }
- if (!(nn & 0xFFFF000000000000)) {
- ret += 16;
- nn <<= 16;
- }
- if (!(nn & 0xFF00000000000000)) {
- ret += 8;
- nn <<= 8;
- }
- if (!(nn & 0xF000000000000000)) {
- ret += 4;
- nn <<= 4;
- }
- if (!(nn & 0xC000000000000000)) {
- ret += 2;
- nn <<= 2;
- }
- if (!(nn & 0x8000000000000000)) {
- ret += 1;
- }
- return ret;
-# endif
-}
-#endif
-
float
airJSFRandUni_f(airJSFRand *rng) {
- unsigned int expo = 126; /* one less than bias => values in [0.5,1) */
- unsigned int nz; /* number of leading zeros seen */
- unsigned int rnd;
+ unsigned int expo = 126, /* one less than bias => values in [0.5,1) */
+ nz, /* number of leading zeros seen */
+ val;
airFloat ret;
- rnd = airJSFRandVal(rng);
- while (!rnd && expo > 32) {
+ val = airJSFRandVal(rng);
+ while (!val && expo > 32) {
/* got 32 bits of zeros (!) and can decrement expo by 32; try again */
expo -= 32;
- rnd = airJSFRandVal(rng);
+ val = airJSFRandVal(rng);
}
- /* possible (though unlikely) to leave loop with expo <= 32 and rnd == 0,
- and builtin clz(0) is undefined, so need extra "rnd ?" check here */
- nz = rnd ? uint32_clz(rnd) : 32;
+ /* possible (though super unlikely) to leave loop with expo <= 32 and val == 0,
+ but builtin clz(0) is undefined, so need extra "val ?" check here */
+ nz = val ? uint32_clz(val) : 32;
/* either we saw a 1 before expo hits zero, or not, in which case
we're into the denormals (expo == 0), which is fine */
expo = nz > expo ? 0 : expo - nz;
- /* # zero bits has determined expo; now determine frac */
+ /* # zero bits has determined expo; now determine fraction.
+ (binary) rng is 1 followed by R = 32 - 1 - nz random bits.
+ We need 23 bits for the fraction, but can't use the (non-random) 1
+ that ended the zero bit counting loop above.
+ Requiring 23 <= R ==> 23 <= 32 - 1 - nz ==> nz <= 8.
+ So if nz > 8, we need to get more random bits */
if (nz > 8) {
- /* there are less then 32 - 1 - 8 = 23 random bits remaining (the
- first 1 after the leading 0s does not get to be in fraction)
- so need to get more random bits for fraction */
- rnd = airJSFRandVal(rng);
+ val = airJSFRandVal(rng);
}
- ret.i = (expo << 23) | (rnd & 0x7fffff);
+ ret.i = ((expo << 23) /* move expo up past frac */
+ | (val & 0x7fffff) /* lo 23 bits of val */
+ );
return ret.f;
}
@@ -258,73 +226,83 @@
airJSFRandBiUni_f(airJSFRand *rng) {
/* HEY copy-pasta (minus comments) from above,
but now we use more bit of randomness to set the sign */
- unsigned int expo = 126;
- unsigned int nz;
- unsigned int rnd;
+ unsigned int expo = 126, nz, val;
airFloat ret;
- rnd = airJSFRandVal(rng);
- while (!rnd && expo > 32) {
+ val = airJSFRandVal(rng);
+ while (!val && expo > 32) {
expo -= 32;
- rnd = airJSFRandVal(rng);
+ val = airJSFRandVal(rng);
}
- nz = rnd ? uint32_clz(rnd) : 32;
+ nz = val ? uint32_clz(val) : 32;
expo = nz > expo ? 0 : expo - nz;
- if (nz > 7) { /* vs 8 above */
- rnd = airJSFRandVal(rng);
+ if (nz > 7) { /* vs 8 above; need 24 bits of randomness */
+ val = airJSFRandVal(rng);
}
- ret.i = ((rnd & 0x800000) << 8) | (expo << 23) | (rnd & 0x7fffff);
+ ret.i = (((val & 0x800000) << 8) /* 24th bit of val, move up 8 to 32nd bit */
+ | (expo << 23) /* move expo up past frac */
+ | (val & 0x7fffff) /* low 23 bits of val */
+ );
return ret.f;
}
-#if 0
-/* for accessing bits of a IEEE754 double
- 1-bit sign, 11-bit expo with bias=1023, 52-bit frac
- 6666555555555544444444443333333333222222222211111111110000000000
- 3210987654321098765432109876543210987654321098765432109876543210
- seeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff
-*/
-typedef union {
- uint64_t ii;
- double dd;
-} empcg_double;
+double
+airJSFRandUni_d(airJSFRand *rng) {
+ /* HEY more mostly uncommented copy-pasta from airJSFRandUni_f above */
+ unsigned int expo = 1022 /* one less than bias */, nz, val, rlo;
+ airDouble ret;
-double
-empcg64_urand(empcg64_state_t *rng) {
- unsigned int expo = 1022u; /* one less than bias */
- uint64_t rnd = empcg64_random(rng);
- while (!rnd && expo > 64u) {
- expo -= 64u;
- rnd = empcg64_random(rng);
+ val = airJSFRandVal(rng);
+ while (!val && expo > 32) {
+ expo -= 32;
+ val = airJSFRandVal(rng);
}
- unsigned int nz = rnd ? empcg64_clz(rnd) : 64u;
+ nz = val ? uint32_clz(val) : 32;
expo = nz > expo ? 0 : expo - nz;
- if (nz > 11u) {
- /* there are less then 64 - 1 - 11 = 52 random bits remaining */
- rnd = empcg64_random(rng);
+ /* # zero bits has determined expo; now determine fraction.
+ (binary) rng is 1 followed by R = 32 - 1 - nz random bits.
+ We need *52* bits for the fraction, but can't use the (non-random) 1
+ that ended the zero bit counting loop above.
+ First get 32 more bits into rlo */
+ rlo = airJSFRandVal(rng);
+ /* We now need 52 - 32 = 20 bits more.
+ Requiring 20 <= R ==> 20 <= 32 - 1 - nz ==> nz <= 11.
+ So if nz > 11, we need to get more random bits */
+ if (nz > 11) {
+ val = airJSFRandVal(rng);
}
- empcg_double ret = {.ii = (((uint64_t)expo) << 52) | (rnd & 0xfffffffffffff)};
- return ret.dd;
+ ret.i = (((airULLong)expo) << 52 /* move expo up past frac */
+ | ((airULLong)(val & 0xfffff)) << 32 /* lo 20 bits of rng, moved up 32 */
+ | rlo /* lo 32 bits */
+ );
+ return ret.d;
}
double
-empcg64_sgn_urand(empcg64_state_t *rng) {
- unsigned int expo = 1022;
- uint64_t rnd = empcg64_random(rng);
- while (!rnd && expo > 64u) {
- expo -= 64u;
- rnd = empcg64_random(rng);
+airJSFRandBiUni_d(airJSFRand *rng) {
+ /* HEY yet more uncommented copy-pasta */
+ unsigned int expo = 1022, nz, val, rlo;
+ airDouble ret;
+
+ val = airJSFRandVal(rng);
+ while (!val && expo > 32) {
+ expo -= 32;
+ val = airJSFRandVal(rng);
}
- unsigned int nz = rnd ? empcg64_clz(rnd) : 64u;
+ nz = val ? uint32_clz(val) : 32;
expo = nz > expo ? 0 : expo - nz;
- if (nz > 10u) {
- rnd = empcg64_random(rng);
+ rlo = airJSFRandVal(rng);
+ if (nz > 10) { /* vs 11 above; need 21 bits of randomness */
+ val = airJSFRandVal(rng);
}
- empcg_double ret = {.ii = ((rnd & 0x10000000000000) << 11) | (((uint64_t)expo) << 52)
- | (rnd & 0xfffffffffffff)};
- return ret.dd;
+ /* sign is 21st bit of rng, moved up 11 to 32nd, and then up 32 to 64rth */
+ ret.i = (((airULLong)((val & 0x100000) << 11)) << 32
+ | ((airULLong)expo) << 52 /* move expo up past frac */
+ | ((airULLong)(val & 0xfffff)) << 32 /* lo 20 bits of rng, moved up 32 */
+ | rlo /* lo 32 bits */
+ );
+ return ret.d;
}
-#endif
/* Polar Box–Muller
https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform#Polar_form
@@ -357,30 +335,30 @@
return rr * (xx + yy) * 0.7071067811865475244f;
}
-#if 0
-double
-empcg64_nrand(empcg64_state_t *rng) {
+/* HEY more copy-pasta! */
+void
+airJSFRandNormal2_d(airJSFRand *rng, double val[2]) {
double xx, yy, rr;
do {
- xx = empcg64_sgn_urand(rng);
- yy = empcg64_sgn_urand(rng);
+ xx = airJSFRandBiUni_d(rng);
+ yy = airJSFRandBiUni_d(rng);
rr = xx * xx + yy * yy;
} while (!rr || rr >= 1);
rr = sqrt((-2 * log(rr)) / rr);
- return rr * (xx + yy) * 0.7071067811865475244008;
+ val[0] = xx * rr;
+ val[1] = yy * rr;
+ return;
}
-void
-empcg64_nrand2(empcg64_state_t *rng, double *vv) {
+double
+airJSFRandNormal_d(airJSFRand *rng) {
double xx, yy, rr;
do {
- xx = empcg64_sgn_urand(rng);
- yy = empcg64_sgn_urand(rng);
+ xx = airJSFRandBiUni_d(rng);
+ yy = airJSFRandBiUni_d(rng);
rr = xx * xx + yy * yy;
} while (!rr || rr >= 1);
rr = sqrt((-2 * log(rr)) / rr);
- vv[0] = xx * rr;
- vv[1] = yy * rr;
- return;
+ /* sum of two normals has variance 2 or stdv sqrt(2) */
+ return rr * (xx + yy) * 0.7071067811865475244;
}
-#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-04 17:25:17
|
Revision: 7148
http://sourceforge.net/p/teem/code/7148
Author: kindlmann
Date: 2023-08-04 17:25:15 +0000 (Fri, 04 Aug 2023)
Log Message:
-----------
sync with sources
Modified Paths:
--------------
teem/trunk/python/cffi/cdef/cdef_air.h
Modified: teem/trunk/python/cffi/cdef/cdef_air.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_air.h 2023-08-04 17:18:29 UTC (rev 7147)
+++ teem/trunk/python/cffi/cdef/cdef_air.h 2023-08-04 17:25:15 UTC (rev 7148)
@@ -372,6 +372,22 @@
extern void airSrandMT(unsigned int seed);
extern double airDrandMT(void);
extern int airRandMTSanity(void);
+/* "Jenkins Small Fast" (psuedo)random number generator */
+typedef struct {
+ unsigned int a, b, c, d;
+} airJSFRand;
+/* randJSF.c */
+extern airJSFRand *airJSFRandNew(unsigned int seed);
+extern airJSFRand *airJSFRandNix(airJSFRand *jsf);
+extern void airJSFRandSeed(airJSFRand *jsf, unsigned int seed);
+extern unsigned int airJSFRandVal(airJSFRand *jsf);
+extern unsigned int airJSFRandValMod(airJSFRand *jsf, unsigned int N);
+extern float airJSFRandUni_f(airJSFRand *jsf); /* [0,1) */
+extern double airJSFRandUni_d(airJSFRand *jsf); /* [0,1) */
+extern float airJSFRandBiUni_f(airJSFRand *jsf); /* (-1,1) */
+extern float airJSFRandNormal_f(airJSFRand *jsf);
+extern void airJSFRandNormal2_f(airJSFRand *jsf, float val[2]);
+extern int airJSFRandSanity(void);
/* ---- END non-NrrdIO */
/*
******** airType
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-04 17:18:31
|
Revision: 7147
http://sourceforge.net/p/teem/code/7147
Author: kindlmann
Date: 2023-08-04 17:18:29 +0000 (Fri, 04 Aug 2023)
Log Message:
-----------
starting BUT NOT YET TESTED Jenkins Small Fast JSF RNG
Modified Paths:
--------------
teem/trunk/src/air/CMakeLists.txt
teem/trunk/src/air/GNUmakefile
teem/trunk/src/air/air.h
Added Paths:
-----------
teem/trunk/src/air/randJSF.c
Modified: teem/trunk/src/air/CMakeLists.txt
===================================================================
--- teem/trunk/src/air/CMakeLists.txt 2023-08-04 16:52:19 UTC (rev 7146)
+++ teem/trunk/src/air/CMakeLists.txt 2023-08-04 17:18:29 UTC (rev 7147)
@@ -14,6 +14,7 @@
parseAir.c
privateAir.h
randMT.c
+ randJSF.c
sane.c
string.c
threadAir.c
Modified: teem/trunk/src/air/GNUmakefile
===================================================================
--- teem/trunk/src/air/GNUmakefile 2023-08-04 16:52:19 UTC (rev 7146)
+++ teem/trunk/src/air/GNUmakefile 2023-08-04 17:18:29 UTC (rev 7147)
@@ -47,11 +47,11 @@
$(L).NEED =
$(L).PUBLIC_HEADERS = air.h
$(L).PRIVATE_HEADERS = privateAir.h
-$(L).OBJS = 754.o randMT.o array.o miscAir.o parseAir.o math.o \
+$(L).OBJS = 754.o randMT.o randJSF.o array.o miscAir.o parseAir.o math.o \
endianAir.o dio.o mop.o enum.o sane.o string.o threadAir.o heap.o
$(L).TESTS = test/floatprint test/doubleprint test/tok \
- test/tmop test/tline test/fp test/trand test/tmisc test/tdio \
- test/bessy test/tarr test/texp test/logrice test/tprint
+ test/tmop test/tline test/fp test/trand test/trandJSF test/tmisc test/tdio \
+ test/bessy test/tarr test/texp test/logrice test/tprint
$(L).NEED_QNANHIBIT = true
$(L).NEED_DIO = true
Modified: teem/trunk/src/air/air.h
===================================================================
--- teem/trunk/src/air/air.h 2023-08-04 16:52:19 UTC (rev 7146)
+++ teem/trunk/src/air/air.h 2023-08-04 17:18:29 UTC (rev 7147)
@@ -440,6 +440,23 @@
AIR_EXPORT double airDrandMT(void);
AIR_EXPORT int airRandMTSanity(void);
+/* "Jenkins Small Fast" (psuedo)random number generator */
+typedef struct {
+ unsigned int a, b, c, d;
+} airJSFRand;
+/* randJSF.c */
+AIR_EXPORT airJSFRand *airJSFRandNew(unsigned int seed);
+AIR_EXPORT airJSFRand *airJSFRandNix(airJSFRand *jsf);
+AIR_EXPORT void airJSFRandSeed(airJSFRand *jsf, unsigned int seed);
+AIR_EXPORT unsigned int airJSFRandVal(airJSFRand *jsf);
+AIR_EXPORT unsigned int airJSFRandValMod(airJSFRand *jsf, unsigned int N);
+AIR_EXPORT float airJSFRandUni_f(airJSFRand *jsf); /* [0,1) */
+AIR_EXPORT double airJSFRandUni_d(airJSFRand *jsf); /* [0,1) */
+AIR_EXPORT float airJSFRandBiUni_f(airJSFRand *jsf); /* (-1,1) */
+AIR_EXPORT float airJSFRandNormal_f(airJSFRand *jsf);
+AIR_EXPORT void airJSFRandNormal2_f(airJSFRand *jsf, float val[2]);
+AIR_EXPORT int airJSFRandSanity(void);
+
/* ---- END non-NrrdIO */
/*
Added: teem/trunk/src/air/randJSF.c
===================================================================
--- teem/trunk/src/air/randJSF.c (rev 0)
+++ teem/trunk/src/air/randJSF.c 2023-08-04 17:18:29 UTC (rev 7147)
@@ -0,0 +1,386 @@
+/*
+ Teem: Tools to process and visualize scientific data and images
+ Copyright (C) 2009--2023 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
+
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along with
+ this library; if not, write to Free Software Foundation, Inc., 51 Franklin Street,
+ Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#include "air.h"
+#include "privateAir.h"
+
+/*
+The "Jenkins Small Fast" (JSF) pseudo-random number generator is from Bob Jenkins,
+http://burtleburtle.net/bob/rand/smallprng.html (circa 2009 ?)
+who called it "A small noncryptographic PRNG", but didn't provide a tidier name.
+GLK learned about this from Melissa O'Neill's 2018 writing here
+https://www.pcg-random.org/posts/bob-jenkins-small-prng-passes-practrand.html
+where she notes how other have identified it as "JSF" in another RNG library.
+The JSF name is used by others as well, e.g.
+https://en.wikipedia.org/wiki/List_of_random_number_generators
+*/
+
+/*
+These #defines allow the (following) original code for "ranval" and "raninit" to BE the
+definition of Teem's airJSFRandVal and airJSFRandSeed, respectively, and for "randctx" to
+refer to the airJSFRand struct which has been already and identically defined in air.h
+*/
+#define ranval airJSFRandVal
+#define raninit airJSFRandSeed
+#define ranctx airJSFRand
+
+/* the following (public-domain) code is copied verbatim from Jenkins' web page,
+except for two changes:
+1) "typedef unsigned long int u4;" --> "typedef unsigned int u4;"
+ airRandJSFSanity() ensures that sizeof(unsigned int) == 4
+2) commenting out the ranctx == airJSFRand struct definition */
+
+/* clang-format off */
+typedef unsigned int u4;
+/* typedef struct ranctx { u4 a; u4 b; u4 c; u4 d; } ranctx; */
+
+#define rot(x,k) (((x)<<(k))|((x)>>(32-(k))))
+u4 ranval( ranctx *x ) {
+ u4 e = x->a - rot(x->b, 27);
+ x->a = x->b ^ rot(x->c, 17);
+ x->b = x->c + x->d;
+ x->c = x->d + e;
+ x->d = e + x->a;
+ return x->d;
+}
+
+void raninit( ranctx *x, u4 seed ) {
+ u4 i;
+ x->a = 0xf1ea5eed, x->b = x->c = x->d = seed;
+ for (i=0; i<20; ++i) {
+ (void)ranval(x);
+ }
+}
+/* clang-format on */
+#undef rot
+
+airJSFRand *
+airJSFRandNew(unsigned int seed) {
+ airJSFRand *jsf;
+ jsf = malloc(sizeof(airJSFRand));
+ airJSFRandSeed(jsf, seed); /* == "raninit" above */
+ return jsf;
+}
+
+airJSFRand *
+airJSFRandNix(airJSFRand *jsf) {
+ return airFree(jsf);
+}
+
+unsigned int
+airJSFRandValMod(airJSFRand *jsf, unsigned int N) {
+ unsigned int cap, val;
+ if (!N) {
+ /* no specific range requested; so provide val in range [0, UINT_MAX] */
+ return ranval(jsf);
+ }
+ /* else want values in range [0, N-1].
+ Set cap to biggest multiple of N that fits in a uint32 */
+ cap = 0xffffffff;
+ cap -= cap % N;
+ /* uniformly sample the remainders mod N by generating uints until less than cap */
+ do {
+ val = ranval(jsf);
+ } while (val >= cap);
+ /* return result mod N */
+ return val % N;
+}
+
+int
+airJSFRandSanity(void) {
+ int sane = 0;
+ airJSFRand jsf;
+ if (4 != sizeof(unsigned int)) {
+ return 0;
+ }
+ airJSFRandSeed(&jsf, 2600);
+ sane = (3114645624 == airJSFRandVal(&jsf) && /* */
+ 580265137 == airJSFRandVal(&jsf) && /* */
+ 3377642734 == airJSFRandVal(&jsf) && /* */
+ 630323219 == airJSFRandVal(&jsf) && /* */
+ 3984528821 == airJSFRandVal(&jsf) && /* */
+ 849682424 == airJSFRandVal(&jsf) && /* */
+ 3735540612 == airJSFRandVal(&jsf) && /* */
+ 2696920995 == airJSFRandVal(&jsf) && /* */
+ 155857509 == airJSFRandVal(&jsf) && /* */
+ 1578235471 == airJSFRandVal(&jsf));
+ return sane;
+}
+
+/******************************************************************************
+ ******************************************************************************
+ End of basic random number generation, start of floating-point specific stuff
+ ******************************************************************************
+ ******************************************************************************/
+
+/* airJSFRandUni_f,airJSFRandUni_d functions are for accurately sampling floats,doubles
+between 0 and 1, making sure that it is possible for all finite values in that range to
+be generated, which is NOT true of the naive approach of dividing some int in [0,N-1] by
+N. Random values really close to 0 turn into (via the RandNormal functions below) samples
+far into the tails of the Gaussian.
+
+The idea for these is described in Section 3.1 of:
+
+ David B. Thomas, Wayne Luk, Philip H.W. Leong, and John D. Villasenor.
+ Gaussian random number generators. ACM Comput. Surv. 39, 4, Article 11
+ (November 2007). DOI=http://dx.doi.org/10.1145/1287620.1287622
+
+ which is also the same basic idea as Taylor Campbell describes here:
+
+ http://mumble.net/~campbell/2014/04/28/uniform-random-float
+ http://mumble.net/~campbell/2014/04/28/random_real.c
+
+Essentially: the probability of returning a float X should be proportional to the width
+of the interval containing all the reals closer to X than any other float, which is
+(except when the fraction field is all zeros) simply the ulp(X), or the distance to the
+next representable float. In IEEE754 the value of the exponent field determines the ulp,
+and the ulp is halved by decrementing the exponent. Starting with the highest possible
+exponent for values below 1 (that is, the bias minus 1), a stream of random bits
+determines whether to decrement the exponent, stopping when a 1 bit is seen. The ulp
+within the denormals is the same as for the lowest normal.
+*/
+
+/* https://en.wikipedia.org/wiki/Find_first_set */
+static unsigned int
+uint32_clz(unsigned int nn) {
+ /* HEY should figure out a configure-time test for having __builtin_clz */
+#if 0
+ return __builtin_clz(nn);
+#else
+ unsigned int ret = 0;
+ if (!(nn & 0xFFFF0000)) {
+ ret += 16;
+ nn <<= 16;
+ }
+ if (!(nn & 0xFF000000)) {
+ ret += 8;
+ nn <<= 8;
+ }
+ if (!(nn & 0xF0000000)) {
+ ret += 4;
+ nn <<= 4;
+ }
+ if (!(nn & 0xC0000000)) {
+ ret += 2;
+ nn <<= 2;
+ }
+ if (!(nn & 0x80000000)) {
+ ret += 1;
+ }
+ return ret;
+#endif
+}
+
+#if 0
+static unsigned int
+uint64_clz(airULLong nn) {
+# if 0
+ /* HEY should figure out a configure-time test for having __builtin_clz */
+ return __builtin_clzll(nn);
+# else
+ unsigned int ret = 0;
+ if (!(nn & 0xFFFFFFFF00000000)) {
+ ret += 32;
+ nn <<= 32;
+ }
+ if (!(nn & 0xFFFF000000000000)) {
+ ret += 16;
+ nn <<= 16;
+ }
+ if (!(nn & 0xFF00000000000000)) {
+ ret += 8;
+ nn <<= 8;
+ }
+ if (!(nn & 0xF000000000000000)) {
+ ret += 4;
+ nn <<= 4;
+ }
+ if (!(nn & 0xC000000000000000)) {
+ ret += 2;
+ nn <<= 2;
+ }
+ if (!(nn & 0x8000000000000000)) {
+ ret += 1;
+ }
+ return ret;
+# endif
+}
+#endif
+
+float
+airJSFRandUni_f(airJSFRand *rng) {
+ unsigned int expo = 126; /* one less than bias => values in [0.5,1) */
+ unsigned int nz; /* number of leading zeros seen */
+ unsigned int rnd;
+ airFloat ret;
+
+ rnd = airJSFRandVal(rng);
+ while (!rnd && expo > 32) {
+ /* got 32 bits of zeros (!) and can decrement expo by 32; try again */
+ expo -= 32;
+ rnd = airJSFRandVal(rng);
+ }
+ /* possible (though unlikely) to leave loop with expo <= 32 and rnd == 0,
+ and builtin clz(0) is undefined, so need extra "rnd ?" check here */
+ nz = rnd ? uint32_clz(rnd) : 32;
+ /* either we saw a 1 before expo hits zero, or not, in which case
+ we're into the denormals (expo == 0), which is fine */
+ expo = nz > expo ? 0 : expo - nz;
+ /* # zero bits has determined expo; now determine frac */
+ if (nz > 8) {
+ /* there are less then 32 - 1 - 8 = 23 random bits remaining (the
+ first 1 after the leading 0s does not get to be in fraction)
+ so need to get more random bits for fraction */
+ rnd = airJSFRandVal(rng);
+ }
+ ret.i = (expo << 23) | (rnd & 0x7fffff);
+ return ret.f;
+}
+
+float
+airJSFRandBiUni_f(airJSFRand *rng) {
+ /* HEY copy-pasta (minus comments) from above,
+ but now we use more bit of randomness to set the sign */
+ unsigned int expo = 126;
+ unsigned int nz;
+ unsigned int rnd;
+ airFloat ret;
+
+ rnd = airJSFRandVal(rng);
+ while (!rnd && expo > 32) {
+ expo -= 32;
+ rnd = airJSFRandVal(rng);
+ }
+ nz = rnd ? uint32_clz(rnd) : 32;
+ expo = nz > expo ? 0 : expo - nz;
+ if (nz > 7) { /* vs 8 above */
+ rnd = airJSFRandVal(rng);
+ }
+ ret.i = ((rnd & 0x800000) << 8) | (expo << 23) | (rnd & 0x7fffff);
+ return ret.f;
+}
+
+#if 0
+/* for accessing bits of a IEEE754 double
+ 1-bit sign, 11-bit expo with bias=1023, 52-bit frac
+ 6666555555555544444444443333333333222222222211111111110000000000
+ 3210987654321098765432109876543210987654321098765432109876543210
+ seeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff
+*/
+typedef union {
+ uint64_t ii;
+ double dd;
+} empcg_double;
+
+double
+empcg64_urand(empcg64_state_t *rng) {
+ unsigned int expo = 1022u; /* one less than bias */
+ uint64_t rnd = empcg64_random(rng);
+ while (!rnd && expo > 64u) {
+ expo -= 64u;
+ rnd = empcg64_random(rng);
+ }
+ unsigned int nz = rnd ? empcg64_clz(rnd) : 64u;
+ expo = nz > expo ? 0 : expo - nz;
+ if (nz > 11u) {
+ /* there are less then 64 - 1 - 11 = 52 random bits remaining */
+ rnd = empcg64_random(rng);
+ }
+ empcg_double ret = {.ii = (((uint64_t)expo) << 52) | (rnd & 0xfffffffffffff)};
+ return ret.dd;
+}
+
+double
+empcg64_sgn_urand(empcg64_state_t *rng) {
+ unsigned int expo = 1022;
+ uint64_t rnd = empcg64_random(rng);
+ while (!rnd && expo > 64u) {
+ expo -= 64u;
+ rnd = empcg64_random(rng);
+ }
+ unsigned int nz = rnd ? empcg64_clz(rnd) : 64u;
+ expo = nz > expo ? 0 : expo - nz;
+ if (nz > 10u) {
+ rnd = empcg64_random(rng);
+ }
+ empcg_double ret = {.ii = ((rnd & 0x10000000000000) << 11) | (((uint64_t)expo) << 52)
+ | (rnd & 0xfffffffffffff)};
+ return ret.dd;
+}
+#endif
+
+/* Polar Box–Muller
+https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform#Polar_form
+which generates two values at once */
+void
+airJSFRandNormal2_f(airJSFRand *rng, float val[2]) {
+ float xx, yy, rr;
+ do {
+ xx = airJSFRandBiUni_f(rng);
+ yy = airJSFRandBiUni_f(rng);
+ rr = xx * xx + yy * yy;
+ } while (!rr || rr >= 1);
+ rr = sqrtf((-2 * logf(rr)) / rr);
+ val[0] = xx * rr;
+ val[1] = yy * rr;
+ return;
+}
+
+/* If you really only want one value */
+float
+airJSFRandNormal_f(airJSFRand *rng) {
+ float xx, yy, rr;
+ do {
+ xx = airJSFRandBiUni_f(rng);
+ yy = airJSFRandBiUni_f(rng);
+ rr = xx * xx + yy * yy;
+ } while (!rr || rr >= 1);
+ rr = sqrtf((-2 * logf(rr)) / rr);
+ /* sum of two normals has variance 2 or stdv sqrt(2) */
+ return rr * (xx + yy) * 0.7071067811865475244f;
+}
+
+#if 0
+double
+empcg64_nrand(empcg64_state_t *rng) {
+ double xx, yy, rr;
+ do {
+ xx = empcg64_sgn_urand(rng);
+ yy = empcg64_sgn_urand(rng);
+ rr = xx * xx + yy * yy;
+ } while (!rr || rr >= 1);
+ rr = sqrt((-2 * log(rr)) / rr);
+ return rr * (xx + yy) * 0.7071067811865475244008;
+}
+
+void
+empcg64_nrand2(empcg64_state_t *rng, double *vv) {
+ double xx, yy, rr;
+ do {
+ xx = empcg64_sgn_urand(rng);
+ yy = empcg64_sgn_urand(rng);
+ rr = xx * xx + yy * yy;
+ } while (!rr || rr >= 1);
+ rr = sqrt((-2 * log(rr)) / rr);
+ vv[0] = xx * rr;
+ vv[1] = yy * rr;
+ return;
+}
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-04 16:52:20
|
Revision: 7146
http://sourceforge.net/p/teem/code/7146
Author: kindlmann
Date: 2023-08-04 16:52:19 +0000 (Fri, 04 Aug 2023)
Log Message:
-----------
fixing and improving description and usage info
Modified Paths:
--------------
teem/trunk/src/unrrdu/uncmt.c
Modified: teem/trunk/src/unrrdu/uncmt.c
===================================================================
--- teem/trunk/src/unrrdu/uncmt.c 2023-08-03 04:57:47 UTC (rev 7145)
+++ teem/trunk/src/unrrdu/uncmt.c 2023-08-04 16:52:19 UTC (rev 7146)
@@ -25,8 +25,9 @@
#define INFO "Change comment contents in a C99 input file"
static const char *_unrrdu_uncmtInfoL
= (INFO
- "; the comment delimeters are preserved by default, but comments can also be "
- "entirely excised. This command can also change contents of string literals in a "
+ ". By default comments are wholly excised, but it is also possible to preserve "
+ "comment delimiters while over-writing comment contents. "
+ "This command can also change contents of string literals in a "
"very particular way. This is all motivated by a class GLK teaches, wherein "
"students are not to use types \"float\" or \"double\" directly (but rather a "
"class-specific \"real\" typedef). Grepping for \"float\" and \"double\" gives "
@@ -346,14 +347,17 @@
char *cmtSubst, *nameIn, *nameOut;
int nfds, nosub;
+ hparm->elideSingleEmptyStringDefault = AIR_FALSE;
hestOptAdd_1_String(
&opt, "cs", "cmtsub", &cmtSubst, "",
+ /* the \t character is turned by hest into non-breaking space */
"Given a non-empty string, those characters are looped through to replace the "
"non-white space characters is contents; EXCEPT if a length-2 string of a "
- "repeating character is given, (e.g. \"-cs xx\") in which case the string contents "
- "are preserved (contrary to the intended purpose of this command). To both "
- "transform the comment contents into whitespace and to wholly remove the comment "
- "delimiters, pass an empty string here (the default).");
+ "repeating character is given, (e.g. \"-cs\txx\") in which case the string contents "
+ "are preserved (contrary to the intended purpose of this command). To preserve "
+ "comment delimiters but turn comments entirely into whitespace, use "
+ "-cs\t\"\t\". To remove the comment delimiters and turn comment contents into "
+ "whitespace (the default), pass an empty string here.");
hestOptAdd_Flag(
&opt, "nfds", &nfds,
"prevent \"float\" or \"double\" from appearing in string literals. String "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-03 04:57:49
|
Revision: 7145
http://sourceforge.net/p/teem/code/7145
Author: kindlmann
Date: 2023-08-03 04:57:47 +0000 (Thu, 03 Aug 2023)
Log Message:
-----------
more handling of NaN
Modified Paths:
--------------
teem/trunk/python/cffi/exult.py
Modified: teem/trunk/python/cffi/exult.py
===================================================================
--- teem/trunk/python/cffi/exult.py 2023-08-02 00:00:35 UTC (rev 7144)
+++ teem/trunk/python/cffi/exult.py 2023-08-03 04:57:47 UTC (rev 7145)
@@ -736,7 +736,7 @@
ret = '_equals_one' # this is defined in lliibb.py
elif errval_t.endswith('*') and 'NULL' == errval:
ret = '_equals_null' # this is defined in lliibb.py
- elif 'AIR_NAN' == errval:
+ elif 'AIR_NAN' == errval or 'nan' == errval.lower():
ret = '_math.isnan'
else:
evlist = errval.split('|') # list (likely length-1) of error-indicating return values
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-02 00:00:37
|
Revision: 7144
http://sourceforge.net/p/teem/code/7144
Author: kindlmann
Date: 2023-08-02 00:00:35 +0000 (Wed, 02 Aug 2023)
Log Message:
-----------
better wording of diagnostic message
Modified Paths:
--------------
teem/trunk/python/cffi/exult.py
Modified: teem/trunk/python/cffi/exult.py
===================================================================
--- teem/trunk/python/cffi/exult.py 2023-08-01 20:47:28 UTC (rev 7143)
+++ teem/trunk/python/cffi/exult.py 2023-08-02 00:00:35 UTC (rev 7144)
@@ -763,7 +763,7 @@
path_bdata = self.path_biffdata + f'/{lib}.csv'
if not os.path.isfile(path_bdata):
if self.verb:
- print(f'Tffi.wrap: library {lib} has no biffdata.csv file, moving on')
+ print(f'Tffi.wrap: library {lib} has no biffdata .csv file, moving on')
continue
if self.verb:
print(f'Tffi.wrap: reading {path_bdata} ...')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-01 20:47:29
|
Revision: 7143
http://sourceforge.net/p/teem/code/7143
Author: kindlmann
Date: 2023-08-01 20:47:28 +0000 (Tue, 01 Aug 2023)
Log Message:
-----------
sync with source
Modified Paths:
--------------
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2023-08-01 20:46:06 UTC (rev 7142)
+++ teem/trunk/python/cffi/teem.py 2023-08-01 20:47:28 UTC (rev 7143)
@@ -285,8 +285,8 @@
'ell_Nm_wght_pseudo_inv': (_equals_one, 0, b'ell', 'ell/genmat.c:413'),
'ell_q_avg4_d': (_equals_one, 0, b'ell', 'ell/quat.c:471'),
'ell_q_avgN_d': (_equals_one, 0, b'ell', 'ell/quat.c:539'),
- 'mossImageCheck': (_equals_one, 0, b'moss', 'moss/methodsMoss.c:73'),
- 'mossImageAlloc': (_equals_one, 0, b'moss', 'moss/methodsMoss.c:94'),
+ 'mossImageCheck': (_equals_one, 0, b'moss', 'moss/methodsMoss.c:74'),
+ 'mossImageAlloc': (_equals_one, 0, b'moss', 'moss/methodsMoss.c:95'),
'mossSamplerImageSet': (_equals_one, 0, b'moss', 'moss/sampler.c:26'),
'mossSamplerKernelSet': (_equals_one, 0, b'moss', 'moss/sampler.c:78'),
'mossSamplerUpdate': (_equals_one, 0, b'moss', 'moss/sampler.c:100'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-01 20:46:08
|
Revision: 7142
http://sourceforge.net/p/teem/code/7142
Author: kindlmann
Date: 2023-08-01 20:46:06 +0000 (Tue, 01 Aug 2023)
Log Message:
-----------
smplr->verbPixel never initialized
Modified Paths:
--------------
teem/trunk/src/moss/methodsMoss.c
Modified: teem/trunk/src/moss/methodsMoss.c
===================================================================
--- teem/trunk/src/moss/methodsMoss.c 2023-08-01 20:45:31 UTC (rev 7141)
+++ teem/trunk/src/moss/methodsMoss.c 2023-08-01 20:46:06 UTC (rev 7142)
@@ -36,6 +36,7 @@
smplr = AIR_CALLOC(1, mossSampler);
if (smplr) {
smplr->verbose = 0;
+ smplr->verbPixel[0] = smplr->verbPixel[1] = -1;
smplr->image = NULL;
smplr->boundary = nrrdBoundaryUnknown;
smplr->kspec = nrrdKernelSpecNew();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-08-01 20:45:34
|
Revision: 7141
http://sourceforge.net/p/teem/code/7141
Author: kindlmann
Date: 2023-08-01 20:45:31 +0000 (Tue, 01 Aug 2023)
Log Message:
-----------
sync with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/moss.csv
Modified: teem/trunk/python/cffi/biffdata/moss.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/moss.csv 2023-07-22 05:11:12 UTC (rev 7140)
+++ teem/trunk/python/cffi/biffdata/moss.csv 2023-08-01 20:45:31 UTC (rev 7141)
@@ -1,6 +1,6 @@
func_name,return_type,error_val(s),mubi,biff_key,filename:linenumber
-mossImageCheck,int,1,0,moss,moss/methodsMoss.c:73
-mossImageAlloc,int,1,0,moss,moss/methodsMoss.c:94
+mossImageCheck,int,1,0,moss,moss/methodsMoss.c:74
+mossImageAlloc,int,1,0,moss,moss/methodsMoss.c:95
mossSamplerImageSet,int,1,0,moss,moss/sampler.c:26
mossSamplerKernelSet,int,1,0,moss,moss/sampler.c:78
mossSamplerUpdate,int,1,0,moss,moss/sampler.c:100
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-22 05:11:14
|
Revision: 7140
http://sourceforge.net/p/teem/code/7140
Author: kindlmann
Date: 2023-07-22 05:11:12 +0000 (Sat, 22 Jul 2023)
Log Message:
-----------
synching source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/seek.csv
teem/trunk/python/cffi/cdef/cdef_seek.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/seek.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/seek.csv 2023-07-22 05:08:53 UTC (rev 7139)
+++ teem/trunk/python/cffi/biffdata/seek.csv 2023-07-22 05:11:12 UTC (rev 7140)
@@ -1,5 +1,5 @@
func_name,return_type,error_val(s),mubi,biff_key,filename:linenumber
-seekExtract,int,1,0,seek,seek/extract.c:935
+seekExtract,int,1,0,seek,seek/extract.c:936
seekDataSet,int,1,0,seek,seek/setSeek.c:56
seekSamplesSet,int,1,0,seek,seek/setSeek.c:116
seekTypeSet,int,1,0,seek,seek/setSeek.c:149
Modified: teem/trunk/python/cffi/cdef/cdef_seek.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_seek.h 2023-07-22 05:08:53 UTC (rev 7139)
+++ teem/trunk/python/cffi/cdef/cdef_seek.h 2023-07-22 05:11:12 UTC (rev 7140)
@@ -155,9 +155,9 @@
vertex strength seen (from probing slabs) */
double time; /* time for extraction */
double gradMagAvg; /* in case per-vertex gradients were computed (such as:
- isocontouring without a gageContext), then the average gradient
- magnitude over all the verts (useful for some computations
- involving signed distance functions) */
+ isocontouring without a gageContext but with normalsFind on),
+ then the average gradient magnitude over all the verts (useful
+ for some computations involving signed distance functions) */
} seekContext;
/* enumsSeek.c */
extern const char *const seekBiffKey;
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2023-07-22 05:08:53 UTC (rev 7139)
+++ teem/trunk/python/cffi/teem.py 2023-07-22 05:11:12 UTC (rev 7140)
@@ -447,7 +447,7 @@
'echoRTRender': (_equals_one, 0, b'echo', 'echo/renderEcho.c:409'),
'hooverContextCheck': (_equals_one, 0, b'hoover', 'hoover/methodsHoover.c:53'),
'hooverRender': ((lambda rv: _teem.lib.hooverErrInit == rv), 0, b'hoover', 'hoover/rays.c:359'),
- 'seekExtract': (_equals_one, 0, b'seek', 'seek/extract.c:935'),
+ 'seekExtract': (_equals_one, 0, b'seek', 'seek/extract.c:936'),
'seekDataSet': (_equals_one, 0, b'seek', 'seek/setSeek.c:56'),
'seekSamplesSet': (_equals_one, 0, b'seek', 'seek/setSeek.c:116'),
'seekTypeSet': (_equals_one, 0, b'seek', 'seek/setSeek.c:149'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-22 05:08:54
|
Revision: 7139
http://sourceforge.net/p/teem/code/7139
Author: kindlmann
Date: 2023-07-22 05:08:53 +0000 (Sat, 22 Jul 2023)
Log Message:
-----------
bug fix in sctx->gradMagAvg computation, and improved descriptive comment in seek.h
Modified Paths:
--------------
teem/trunk/src/seek/extract.c
teem/trunk/src/seek/seek.h
Modified: teem/trunk/src/seek/extract.c
===================================================================
--- teem/trunk/src/seek/extract.c 2023-07-22 04:00:51 UTC (rev 7138)
+++ teem/trunk/src/seek/extract.c 2023-07-22 05:08:53 UTC (rev 7139)
@@ -836,7 +836,8 @@
ELL_3V_LERP(grad, ww, vgrad[vi0], vgrad[vi1]);
ELL_3MV_MUL(tvec, sctx->txfNormal, grad);
ELL_3V_NORM_TT(lpld->norm + 3 * ovi, float, tvec, tlen);
- sctx->gradMagAvg += tlen;
+ /* need to /2 because vgrad were found by central differences */
+ sctx->gradMagAvg += tlen / 2;
}
}
sctx->vertNum++;
Modified: teem/trunk/src/seek/seek.h
===================================================================
--- teem/trunk/src/seek/seek.h 2023-07-22 04:00:51 UTC (rev 7138)
+++ teem/trunk/src/seek/seek.h 2023-07-22 05:08:53 UTC (rev 7139)
@@ -185,9 +185,9 @@
vertex strength seen (from probing slabs) */
double time; /* time for extraction */
double gradMagAvg; /* in case per-vertex gradients were computed (such as:
- isocontouring without a gageContext), then the average gradient
- magnitude over all the verts (useful for some computations
- involving signed distance functions) */
+ isocontouring without a gageContext but with normalsFind on),
+ then the average gradient magnitude over all the verts (useful
+ for some computations involving signed distance functions) */
} seekContext;
/* enumsSeek.c */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-22 04:12:34
|
Revision: 7137
http://sourceforge.net/p/teem/code/7137
Author: kindlmann
Date: 2023-07-22 04:00:04 +0000 (Sat, 22 Jul 2023)
Log Message:
-----------
API CHANGE: (oops didn't commit all files last time) adding another field to seekContext, to record the average (world-space) gradient magnitude, over the vertices in an isosurface (when there isn't a gageContext), with the hope that it is useful for some signed distance field computations. Also noting that Thomas Schultz commited some work to this file (other files in seek have a similar copyright attribution)
Modified Paths:
--------------
teem/trunk/src/seek/methodsSeek.c
teem/trunk/src/seek/seek.h
Modified: teem/trunk/src/seek/methodsSeek.c
===================================================================
--- teem/trunk/src/seek/methodsSeek.c 2023-07-22 03:55:59 UTC (rev 7136)
+++ teem/trunk/src/seek/methodsSeek.c 2023-07-22 04:00:04 UTC (rev 7137)
@@ -122,6 +122,7 @@
sctx->faceNum = 0;
sctx->strengthSeenMax = AIR_NAN;
sctx->time = AIR_NAN;
+ sctx->gradMagAvg = AIR_NAN;
}
return sctx;
}
Modified: teem/trunk/src/seek/seek.h
===================================================================
--- teem/trunk/src/seek/seek.h 2023-07-22 03:55:59 UTC (rev 7136)
+++ teem/trunk/src/seek/seek.h 2023-07-22 04:00:04 UTC (rev 7137)
@@ -184,6 +184,10 @@
double strengthSeenMax; /* in case strength was used, the maximum
vertex strength seen (from probing slabs) */
double time; /* time for extraction */
+ double gradMagAvg; /* in case per-vertex gradients were computed (such as:
+ isocontouring without a gageContext), then the average gradient
+ magnitude over all the verts (useful for some computations
+ involving signed distance functions) */
} seekContext;
/* enumsSeek.c */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-22 04:12:34
|
Revision: 7138
http://sourceforge.net/p/teem/code/7138
Author: kindlmann
Date: 2023-07-22 04:00:51 +0000 (Sat, 22 Jul 2023)
Log Message:
-----------
synch with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/seek.csv
teem/trunk/python/cffi/cdef/cdef_seek.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/seek.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/seek.csv 2023-07-22 04:00:04 UTC (rev 7137)
+++ teem/trunk/python/cffi/biffdata/seek.csv 2023-07-22 04:00:51 UTC (rev 7138)
@@ -1,5 +1,5 @@
func_name,return_type,error_val(s),mubi,biff_key,filename:linenumber
-seekExtract,int,1,0,seek,seek/extract.c:924
+seekExtract,int,1,0,seek,seek/extract.c:935
seekDataSet,int,1,0,seek,seek/setSeek.c:56
seekSamplesSet,int,1,0,seek,seek/setSeek.c:116
seekTypeSet,int,1,0,seek,seek/setSeek.c:149
Modified: teem/trunk/python/cffi/cdef/cdef_seek.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_seek.h 2023-07-22 04:00:04 UTC (rev 7137)
+++ teem/trunk/python/cffi/cdef/cdef_seek.h 2023-07-22 04:00:51 UTC (rev 7138)
@@ -154,6 +154,10 @@
double strengthSeenMax; /* in case strength was used, the maximum
vertex strength seen (from probing slabs) */
double time; /* time for extraction */
+ double gradMagAvg; /* in case per-vertex gradients were computed (such as:
+ isocontouring without a gageContext), then the average gradient
+ magnitude over all the verts (useful for some computations
+ involving signed distance functions) */
} seekContext;
/* enumsSeek.c */
extern const char *const seekBiffKey;
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2023-07-22 04:00:04 UTC (rev 7137)
+++ teem/trunk/python/cffi/teem.py 2023-07-22 04:00:51 UTC (rev 7138)
@@ -447,7 +447,7 @@
'echoRTRender': (_equals_one, 0, b'echo', 'echo/renderEcho.c:409'),
'hooverContextCheck': (_equals_one, 0, b'hoover', 'hoover/methodsHoover.c:53'),
'hooverRender': ((lambda rv: _teem.lib.hooverErrInit == rv), 0, b'hoover', 'hoover/rays.c:359'),
- 'seekExtract': (_equals_one, 0, b'seek', 'seek/extract.c:924'),
+ 'seekExtract': (_equals_one, 0, b'seek', 'seek/extract.c:935'),
'seekDataSet': (_equals_one, 0, b'seek', 'seek/setSeek.c:56'),
'seekSamplesSet': (_equals_one, 0, b'seek', 'seek/setSeek.c:116'),
'seekTypeSet': (_equals_one, 0, b'seek', 'seek/setSeek.c:149'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|