Changeset 18115 in project


Ignore:
Timestamp:
05/19/10 04:27:00 (9 years ago)
Author:
kon
Message:

Rmvd f64vector stuff from srfi-27-vector since dup in srfi-27 module

Location:
release/4/srfi-27/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • release/4/srfi-27/trunk/composite-random-source.scm

    r17461 r18115  
    7373;;  -> (real inexact (< 0.0 _ 1.0)))
    7474
     75;FIXME - the combinators are awful!
     76
    7577(define (composite-random-source
    7678          #!optional
  • release/4/srfi-27/trunk/srfi-27

    r16196 r18115  
    33== srfi-27
    44
    5 Sources of Random Bits
     5Source of Random Bits
    66
    77[[toc:]]
     
    1010== Documentation
    1111
    12       (p "This is a Chicken implementation of SRFI-27. This document only "
    13       "describes the extensions and violations. For the SRFI-27 API see "
    14       (url "http://srfi.schemers.org/srfi-27/srfi-27.html" "SRFI-27") ".")
     12A Chicken implementation of [[http://srfi.schemers.org/srfi-27/srfi-27.html|SRFI 27]].
     13
     14A choice of random number and entropy generators is provided.
    1515
    1616      (subsection "Signatures"
     
    505505== Notes
    506506
     507* Portions by Sebastian.Egner@philips.com
     508
    507509
    508510== Requirements
     
    528530== License
    529531
    530 Copyright (C) 2009 Kon Lovett.  All rights reserved.
     532Copyright (C) 2010 Kon Lovett.  All rights reserved.
    531533
    532534Permission is hereby granted, free of charge, to any person obtaining a
  • release/4/srfi-27/trunk/srfi-27-distributions.scm

    r17461 r18115  
    3939    srfi-27-uniform-random)
    4040
    41 ;;;
     41;;; Chicken Generic Arithmetic Argument Checks
    4242
    4343(define (check-nonzero-real loc obj #!optional argnam)
     
    7070;;;
    7171
    72 (define-constant PI 3.1415926535897932384626433832795028841972)
    73 (define-constant fp1/3 0.3333333333333333333333333333333333333333)
     72(define-constant PI     3.1415926535897932384626433832795028841972)
     73(define-constant FP1/3 0.3333333333333333333333333333333333333333)
    7474
    7575;;;
     
    265265                    (lambda () (expt (randoms) inv-alpha) ) )
    266266                  randoms)))
    267         (let* ((d (- (or (and (< alpha 1.0) (+ 1.0 alpha)) alpha) fp1/3))
     267        (let* ((d (- (or (and (< alpha 1.0) (+ 1.0 alpha)) alpha) FP1/3))
    268268               (c (*inverse (sqrt (* 9.0 d)))))
    269269          (lambda ()
  • release/4/srfi-27/trunk/srfi-27-uniform-random.scm

    r17531 r18115  
    2828;;; Uniform random integers in [low high] by precision
    2929
    30 (define (*make-uniform-random-integers high low prec rand)
     30(define (*make-uniform-random-integers low high prec rand)
    3131  (let ((range (quotient (+ (- high low) 1) prec)))
    3232      (cond ((and (= 0 low) (= 1 prec)) (lambda () (rand range)))
     
    5050    (error 'make-uniform-random-integers "`precision' greater-than range" precision low high))
    5151  (values
    52     (*make-uniform-random-integers high low precision ((@random-source-make-integers source)))
     52    (*make-uniform-random-integers low high precision ((@random-source-make-integers source)))
    5353    (lambda () (values high low precision source)) ) )
    5454
  • release/4/srfi-27/trunk/srfi-27-vector.scm

    r17347 r18115  
    99    ;
    1010    *random-permutation!
    11     *random-64vector!
    1211    *random-vector!
    1312    *random-normal-vector!
     
    1615    ;
    1716    make-random-permutations
    18     make-random-f64vector
    1917    make-random-vector
    2018    make-random-normal-vector
     
    3028  (import scheme
    3129          chicken
    32           (only srfi-4 make-f64vector)
    3330          (only type-checks check-cardinal-integer check-vector)
    3431          (only type-errors error-vector)
     
    3936
    4037  (require-library
    41     srfi-4
    4238    type-checks type-errors
    4339    random-source
     
    7066(define (make-random-permutations #!key (randoms (make-uniform-random-integers)))
    7167  (lambda (n)
     68    (check-cardinal-integer 'make-random-permutations n 'length)
    7269    (*random-permutation! (make-vector n 0) randoms)) )
    7370
     
    8986  (*random-vector! vec randoms) )
    9087
    91 (define *random-64vector! *random-vector!)
    92 
    93 (define (make-random-f64vector #!key (randoms (make-uniform-random-reals)))
    94   (lambda (n)
    95     (check-cardinal-integer 'random-vector n 'length)
    96     (*random-vector! (make-f64vector n) randoms)) )
    97 
    9888;;; Normal vectors
    9989
    10090;;
    10191
    102 ;Fills vect with inexact real random numbers that are independent
    103 ;and standard normally distributed (i.e., with mean 0 and variance 1).
     92; Fills vect with inexact real random numbers that are independent
     93; and standard normally distributed (i.e., with mean 0 and variance 1).
    10494
    10595(define (**random-normal-vector! vec norms)
     
    122112;;
    123113
    124 ;Fills vect with inexact real random numbers the sum of whose
    125 ;squares is equal to 1.0.  Thinking of vect as coordinates in space
    126 ;of dimension n = (vector-length vect), the coordinates are
    127 ;uniformly distributed over the surface of the unit n-sphere.
     114; Fills vect with inexact real random numbers the sum of whose
     115; squares is equal to 1.0.  Thinking of vect as coordinates in space
     116; of dimension n = (vector-length vect), the coordinates are
     117; uniformly distributed over the surface of the unit n-sphere.
    128118
    129119(define (**random-hollow-sphere! vec norms)
     
    146136;;
    147137
    148 ;Fills vect with inexact real random numbers the sum of whose
    149 ;squares is less than 1.0.  Thinking of vect as coordinates in
    150 ;space of dimension n = (vector-length vect), the coordinates are
    151 ;uniformly distributed within the unit n-sphere.  The sum of the
    152 ;squares of the numbers is returned.
     138; Fills vect with inexact real random numbers the sum of whose
     139; squares is less than 1.0.  Thinking of vect as coordinates in
     140; space of dimension n = (vector-length vect), the coordinates are
     141; uniformly distributed within the unit n-sphere.  The sum of the
     142; squares of the numbers is returned.
    153143
    154144(define (**random-solid-sphere! vec randoms norms)
  • release/4/srfi-27/trunk/srfi-27.scm

    r17531 r18115  
    206206(define random-u8vector
    207207  (let ((mkv (*random-source-make-u8vectors default-random-source)))
    208     (lambda (n)
    209       (mkv n) ) ) )
     208    (lambda (n) (mkv n) ) ) )
    210209
    211210(define random-f64vector
    212211  (let ((mkv (*random-source-make-f64vectors default-random-source #f)))
    213     (lambda (n)
    214       (mkv n) ) ) )
     212    (lambda (n) (mkv n) ) ) )
    215213
    216214) ;module srfi-27
  • release/4/srfi-27/trunk/srfi-27.setup

    r17531 r18115  
    1818(setup-shared-extension-module 'srfi-27-numbers (extension-version "3.0.0")
    1919  #:compile-options '(
     20    -scrutinize
    2021    -optimize-level 3
    2122    -debug-level 0
     
    2425(setup-shared-extension-module 'srfi-27-vector-support (extension-version "3.0.0")
    2526  #:compile-options '(
     27    -scrutinize
    2628    -optimize-level 3
    2729    -debug-level 0
     
    3032(setup-shared-extension-module 'thread-support (extension-version "3.0.0")
    3133  #:compile-options '(
     34    -scrutinize
    3235    -optimize-level 3
    33     ;-debug-level 0
     36    -debug-level 0
    3437    -no-procedure-checks) )
    3538
    3639(setup-shared-extension-module 'thread-reaper (extension-version "3.0.0")
    3740  #:compile-options '(
     41    -scrutinize
    3842    -optimize-level 3
    39     ;-debug-level 0
     43    -debug-level 0
    4044    -no-procedure-checks) )
    4145
    4246(setup-shared-extension-module 'timed-resource (extension-version "3.0.0")
    4347  #:compile-options '(
     48    -scrutinize
    4449    -optimize-level 3
    45     ;-debug-level 0
     50    -debug-level 0
    4651    -no-procedure-checks) )
    4752
    4853(setup-shared-extension-module 'entropy-source (extension-version "3.0.0")
    4954  #:compile-options '(
     55    -scrutinize
    5056    -optimize-level 3
    51     ;-debug-level 0
     57    -debug-level 0
    5258    -no-procedure-checks) )
    5359
    5460(setup-shared-extension-module 'entropy-support (extension-version "3.0.0")
    5561  #:compile-options '(
     62    -scrutinize
    5663    -optimize-level 3
    57     ;-debug-level 0
     64    -debug-level 0
    5865    -no-procedure-checks -no-argc-checks -no-bound-checks) )
    5966
    6067(setup-shared-extension-module 'entropy-clock (extension-version "3.0.0")
    6168  #:compile-options '(
     69    -scrutinize
    6270    -optimize-level 3
    6371    ;-debug-level 0
     
    6674(setup-shared-extension-module 'entropy-procedure (extension-version "3.0.0")
    6775  #:compile-options '(
     76    -scrutinize
    6877    -optimize-level 3
    6978    ;-debug-level 0
     
    7281(setup-shared-extension-module 'entropy-port (extension-version "3.0.0")
    7382  #:compile-options '(
     83    -scrutinize
    7484    -optimize-level 3
    7585    ;-debug-level 0
     
    7989(setup-shared-extension-module 'entropy-unix (extension-version "3.0.0")
    8090  #:compile-options '(
     91    -scrutinize
    8192    -optimize-level 3
    8293    ;-debug-level 0
     
    8697(setup-shared-extension-module 'entropy-windows (extension-version "3.0.0")
    8798  #:compile-options '(
     99    -scrutinize
    88100    -optimize-level 3
    89101    ;-debug-level 0
     
    92104(setup-shared-extension-module 'random-source (extension-version "3.0.0")
    93105  #:compile-options '(
     106    -scrutinize
    94107    -optimize-level 3
    95     ;-debug-level 0
     108    -debug-level 0
    96109    -no-procedure-checks) )
    97110
    98111(setup-shared-extension-module 'composite-random-source (extension-version "3.0.0")
    99112  #:compile-options '(
     113    -scrutinize
    100114    -optimize-level 3
    101115    ;-debug-level 0
     
    104118(setup-shared-extension-module 'mrg32k3a (extension-version "3.0.0")
    105119  #:compile-options '(
     120    -scrutinize
    106121    -optimize-level 3
    107     ;-debug-level 0
     122    -debug-level 0
    108123    -no-procedure-checks -no-argc-checks -no-bound-checks) )
    109124
    110125(setup-shared-extension-module 'mwc (extension-version "3.0.0")
    111126  #:compile-options '(
     127    -scrutinize
    112128    -optimize-level 3
    113129    -debug-level 0
     
    116132(setup-shared-extension-module 'moa (extension-version "3.0.0")
    117133  #:compile-options '(
     134    -scrutinize
    118135    -optimize-level 3
    119136    -debug-level 0
     
    122139(setup-shared-extension-module 'srfi-27 (extension-version "3.0.0")
    123140  #:compile-options '(
     141    -scrutinize
    124142    -optimize-level 3
    125     -debug-level 0
     143    ;-debug-level 0
    126144    -no-procedure-checks) )
    127145
    128146(setup-shared-extension-module 'srfi-27-uniform-random (extension-version "3.0.0")
    129147  #:compile-options '(
     148    -scrutinize
    130149    -optimize-level 3
    131150    ;-debug-level 0
     
    134153(setup-shared-extension-module 'srfi-27-distributions (extension-version "3.0.0")
    135154  #:compile-options '(
     155    -scrutinize
    136156    -optimize-level 3
    137157    ;-debug-level 0
     
    140160(setup-shared-extension-module 'srfi-27-vector (extension-version "3.0.0")
    141161  #:compile-options '(
     162    -scrutinize
    142163    -optimize-level 3
    143164    ;-debug-level 0
  • release/4/srfi-27/trunk/tests/run.scm

    r17401 r18115  
    11csi -n -s test-mrg32k3a.scm
    22csi -n -s test-confidence
    3 csi -n -s test-diehard
     3;csi -n -s test-diehard
Note: See TracChangeset for help on using the changeset viewer.