#9798: Accelerate Polyhedron constructor and fix cddlib output ordering
----------------------------+-----------------------------------------------
   Reporter:  vbraun        |       Owner:  mhampton  
       Type:  defect        |      Status:  needs_work
   Priority:  major         |   Milestone:  sage-4.6  
  Component:  geometry      |    Keywords:            
     Author:  Volker Braun  |    Upstream:  N/A       
   Reviewer:                |      Merged:            
Work_issues:                |  
----------------------------+-----------------------------------------------
Changes (by drkirkby):

 * cc: dimpase (added)


Comment:

 FWIW I had a quick look at the code of that so-called ''portable random
 number generator'', and did a few quick checks. Several things are odd
 about it. None are serious issues, but make me skeptical of the code -
 especially use of the word "portable".

 I would certainly '''not''' trust its statistical properties, given the
 pretty basic flaws I found in the coding, though I understand that does
 not matter for this application.

 Anyway, this is what I found.

  * {{{portable_srand}}} is declared as void, but then tries to return 0.
 That's a pretty basic programming error. Even GCC flags that as a warning.
  * The local variable {{{type}}} is declared in {{{portable_srand}}} then
 set to the value {{{rng_state.rand_type}}}. However, {{{type}}} is never
 used after being set. So it was pointless declaring {{{type}}} and setting
 it. It's anyone's guess if someone actually intended the algorithm to use
 {{{{{{rng_state.rand_type}}} or not.

 GCC can't detect the last problem, but !SunStudio detects this programming
 error. That's one of the advantages of using another !SunStudio - it roots
 out dubious code better than gcc.

 I added a {{{main}}}, and compared the sequence of numbers generated on
 several platforms. All these produced the same sequence for the 4 seeds I
 tried.

  * AIX 5.3 on PowerPC 32-bit (Since my RS/6000 7025 F50 is only 32-bit, I
 could not try 64-bit)
  * Linux on x86 32-bit
  * Linux on x86 64-bit
  * !OpenSolaris on x86 32-bit
  * !OpenSolaris on x86 64-bit
  * OS X on x86 32-bit
  * OS X on x86 64-bit
  * Solaris 10 on SPARC 32-bit
  * Solaris 10 on SPARC 64-bit

 It will not compile at all on my HP C3600 running HP-UX 11.11B, since the
 RNG uses {{{stdint.h}}}, which is only part of the C99 standard and the
 older HP-UX 11.11B is not C99 aware. Quite why we need C99 code for a RNG
 I will never know. I was using portable random number generators well
 before 1999.

 So I'm not sure one could attach the name "portable" to this, as it
 certainly presents issues on HP-UX. It may do on Cygwin and FreeBSD too.

 In contrast, the GNU Scientific Library builds and passes all tests on HP-
 UX, FreeBSD and Cygwin, so is more portable.

 It should also be noted this RNG produces the same sequence if the seed is
 0 or 1. For at least some other values I tried, the numbers changed as the
 seed was changed. But for 0 or 1, the output is the same.

 I cc'ed Dima on this, as I thought he might find this interesting!

 Dave

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9798#comment:47>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to