Commit 43c2dff4 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Minor fix-ups to pass tests

1. Fix argument order in permutation-inverse test.
2. Test results for cholesky need to nest list for array contents.
3. Fix incorrect initial contents for matrix-transpose.
Now the tests results on SBCL 64 bit, GSL 1.14 are the same as the
master branch:
TOTAL: 4014 assertions passed, 2 failed, 0 execution errors.
parent 8612c543
;; Permutations ;; Permutations
;; Liam Healy, Sun Mar 26 2006 - 11:51 ;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2010-07-07 14:30:06EDT permutation.lisp> ;; Time-stamp: <2010-07-14 10:27:05EDT permutation.lisp>
;; ;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License ;; Distributed under the terms of the GNU General Public License
...@@ -339,13 +339,12 @@ ...@@ -339,13 +339,12 @@
(set-identity perm-1) (set-identity perm-1)
(grid:contents (permutation-reverse perm-1))) (grid:contents (permutation-reverse perm-1)))
(let ;permutation-next, permutation-inverse (let ;permutation-next, permutation-inverse
((perm-1 (make-permutation 4 t)) (perm-2 (make-permutation 4 t))) ((perm-1 (make-permutation 4 t)))
(set-identity perm-1) (set-identity perm-1)
(permutation-next perm-1) (permutation-next perm-1)
(permutation-next perm-1) (permutation-next perm-1)
(permutation-next perm-1) (permutation-next perm-1)
(permutation-inverse perm-2 perm-1) (grid:contents (permutation-inverse perm-1)))
(grid:contents perm-2))
(let ((perm-1 (make-permutation 4 t))) ;swap-elements (let ((perm-1 (make-permutation 4 t))) ;swap-elements
(set-identity perm-1) (set-identity perm-1)
(swap-elements perm-1 1 3) (swap-elements perm-1 1 3)
......
...@@ -39,105 +39,89 @@ ...@@ -39,105 +39,89 @@
(MULTIPLE-VALUE-LIST (TEST-CHOLESKY-DECOMP-DIM *HILB12*)))) (MULTIPLE-VALUE-LIST (TEST-CHOLESKY-DECOMP-DIM *HILB12*))))
(LISP-UNIT:ASSERT-NUMERICAL-EQUAL (LISP-UNIT:ASSERT-NUMERICAL-EQUAL
(LIST (LIST
(GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS '(2 2) :INITIAL-CONTENTS (GRID:MAKE-FOREIGN-ARRAY
'(4.0d0 -6.000000000000001d0 -6.000000000000001d0 'DOUBLE-FLOAT
12.000000000000002d0))) :DIMENSIONS '(2 2)
:INITIAL-CONTENTS
'((4.0d0 -6.000000000000001d0)
(-6.000000000000001d0 12.000000000000002d0))))
(MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB2*))) (MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB2*)))
(LISP-UNIT:ASSERT-NUMERICAL-EQUAL (LISP-UNIT:ASSERT-NUMERICAL-EQUAL
(LIST (LIST
(GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS '(3 3) :INITIAL-CONTENTS (GRID:MAKE-FOREIGN-ARRAY
'(8.999999999999996d0 -35.99999999999997d0 'DOUBLE-FLOAT :DIMENSIONS '(3 3)
29.999999999999968d0 -35.99999999999997d0 :INITIAL-CONTENTS
191.99999999999977d0 -179.99999999999974d0 '((8.999999999999996d0 -35.99999999999997d0 29.999999999999968d0)
29.999999999999968d0 -179.99999999999974d0 (-35.99999999999997d0 191.99999999999977d0 -179.99999999999974d0)
179.99999999999974d0))) (29.999999999999968d0 -179.99999999999974d0 179.99999999999974d0))))
(MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB3*))) (MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB3*)))
(LISP-UNIT:ASSERT-NUMERICAL-EQUAL (LISP-UNIT:ASSERT-NUMERICAL-EQUAL
(LIST (LIST
(GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS '(4 4) :INITIAL-CONTENTS (GRID:MAKE-FOREIGN-ARRAY
'(15.999999999997954d0 -119.99999999997637d0 'DOUBLE-FLOAT :DIMENSIONS '(4 4)
239.9999999999425d0 -139.9999999999624d0 :INITIAL-CONTENTS
-119.99999999997637d0 1199.9999999997276d0 '((15.999999999997954d0 -119.99999999997637d0
-2699.9999999993374d0 1679.999999999567d0 239.9999999999425d0 -139.9999999999624d0)
239.9999999999425d0 -2699.9999999993374d0 (-119.99999999997637d0 1199.9999999997276d0
6479.999999998391d0 -4199.999999998949d0 -2699.9999999993374d0 1679.999999999567d0)
-139.9999999999624d0 1679.999999999567d0 (239.9999999999425d0 -2699.9999999993374d0
-4199.999999998949d0 2799.9999999993133d0))) 6479.999999998391d0 -4199.999999998949d0)
(-139.9999999999624d0 1679.999999999567d0
-4199.999999998949d0 2799.9999999993133d0))))
(MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB4*))) (MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB4*)))
(LISP-UNIT:ASSERT-NUMERICAL-EQUAL (LISP-UNIT:ASSERT-NUMERICAL-EQUAL
(LIST (LIST
(GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS '(12 12) :INITIAL-CONTENTS (GRID:MAKE-FOREIGN-ARRAY
'(140.93894922210026d0 -9909.515598314396d0 'DOUBLE-FLOAT :DIMENSIONS '(12 12)
228130.1469667386d0 -2538275.7124035973d0 :INITIAL-CONTENTS
1.6095812913531223d7 -6.334945916568248d7 '((140.93894922210026d0 -9909.515598314396d0 228130.1469667386d0
1.6180891328288838d8 -2.729032142808902d8 -2538275.7124035973d0 1.6095812913531223d7 -6.334945916568248d7
3.0168290726564497d8 -2.1022884505162454d8 1.6180891328288838d8 -2.729032142808902d8 3.0168290726564497d8
8.375524587383476d7 -1.4541456776519377d7 -2.1022884505162454d8 8.375524587383476d7 -1.4541456776519377d7)
-9909.515598314396d0 932767.1833354546d0 (-9909.515598314396d0 932767.1833354546d0 -2.4237461160498716d7
-2.4237461160498716d7 2.8844188661576414d8 2.8844188661576414d8 -1.909680714415059d9 7.7460245161891d9
-1.909680714415059d9 7.7460245161891d9 -2.0231624766352333d10 3.471522329754068d10 -3.890662204538243d10
-2.0231624766352333d10 3.471522329754068d10 2.74177855208454d10 -1.102566741945975d10 1.929435802259886d9)
-3.890662204538243d10 2.74177855208454d10 (228130.1469667386d0 -2.4237461160498716d7 6.73572464659023d8
-1.102566741945975d10 1.929435802259886d9 -8.368269872726659d9 5.7091322157235695d10 -2.3676705075886935d11
228130.1469667386d0 -2.4237461160498716d7 6.73572464659023d8 6.290662520578335d11 -1.0941791365599775d12 1.2399453133327766d12
-8.368269872726659d9 5.7091322157235695d10 -8.81880779657557d11 3.574046855772319d11 -6.296195191459201d10)
-2.3676705075886935d11 6.290662520578335d11 (-2538275.7124035973d0 2.8844188661576414d8 -8.368269872726659d9
-1.0941791365599775d12 1.2399453133327766d12 1.0712764655128993d11 -7.472089890616971d11 3.151988258294786d12
-8.81880779657557d11 3.574046855772319d11 -8.488450614305809d12 1.4927814906150715d13 -1.7071606428565754d13
-6.296195191459201d10 -2538275.7124035973d0 1.223562085794148d13 -4.991562204869468d12 8.843597326374552d11)
2.8844188661576414d8 -8.368269872726659d9 (1.6095812913531223d7 -1.909680714415059d9 5.7091322157235695d10
1.0712764655128993d11 -7.472089890616971d11 -7.472089890616971d11 5.301074505619902d12 -2.2665189250955867d13
3.151988258294786d12 -8.488450614305809d12 6.171063739258524d13 -1.0951444151196363d14 1.2620388151208275d14
1.4927814906150715d13 -1.7071606428565754d13 -9.10465178565691d13 3.7353182667592734d13 -6.650622666809788d12)
1.223562085794148d13 -4.991562204869468d12 (-6.334945916568248d7 7.7460245161891d9 -2.3676705075886935d11
8.843597326374552d11 1.6095812913531223d7 3.151988258294786d12 -2.2665189250955867d13 9.797282297050839d13
-1.909680714415059d9 5.7091322157235695d10 -2.69178428716829d14 4.813523771637035d14 -5.583296199291294d14
-7.472089890616971d11 5.301074505619902d12 4.0506228228731506d14 -1.669993952432146d14 2.986227787462567d13)
-2.2665189250955867d13 6.171063739258524d13 (1.6180891328288838d8 -2.0231624766352333d10 6.290662520578335d11
-1.0951444151196363d14 1.2620388151208275d14 -8.488450614305809d12 6.171063739258524d13 -2.69178428716829d14
-9.10465178565691d13 3.7353182667592734d13 7.452168344520158d14 -1.341299342463819d15 1.5645387966054885d15
-6.650622666809788d12 -6.334945916568248d7 7.7460245161891d9 -1.1406123499040888d15 4.722759913598374d14 -8.477277839776764d13)
-2.3676705075886935d11 3.151988258294786d12 (-2.729032142808902d8 3.471522329754068d10 -1.0941791365599775d12
-2.2665189250955867d13 9.797282297050839d13 1.4927814906150715d13 -1.0951444151196363d14 4.813523771637035d14
-2.69178428716829d14 4.813523771637035d14 -1.341299342463819d15 2.4277247809232295d15 -2.8456190095051365d15
-5.583296199291294d14 4.0506228228731506d14 2.0834751168291395d15 -8.659507329260588d14 1.5596335658322444d14)
-1.669993952432146d14 2.986227787462567d13 (3.0168290726564497d8 -3.890662204538243d10 1.2399453133327766d12
1.6180891328288838d8 -2.0231624766352333d10 -1.7071606428565754d13 1.2620388151208275d14 -5.583296199291294d14
6.290662520578335d11 -8.488450614305809d12 1.5645387966054885d15 -2.8456190095051365d15 3.349749344363914d15
6.171063739258524d13 -2.69178428716829d14 -2.4618882271582375d15 1.0266886429154235d15 -1.854737730613888d14)
7.452168344520158d14 -1.341299342463819d15 (-2.1022884505162454d8 2.74177855208454d10 -8.81880779657557d11
1.5645387966054885d15 -1.1406123499040888d15 1.223562085794148d13 -9.10465178565691d13 4.0506228228731506d14
4.722759913598374d14 -8.477277839776764d13 -1.1406123499040888d15 2.0834751168291395d15 -2.4618882271582375d15
-2.729032142808902d8 3.471522329754068d10 1.8154690416182195d15 -7.594022010106465d14 1.3756208760169238d14)
-1.0941791365599775d12 1.4927814906150715d13 (8.375524587383476d7 -1.102566741945975d10 3.574046855772319d11
-1.0951444151196363d14 4.813523771637035d14 -4.991562204869468d12 3.7353182667592734d13 -1.669993952432146d14
-1.341299342463819d15 2.4277247809232295d15 4.722759913598374d14 -8.659507329260588d14 1.0266886429154235d15
-2.8456190095051365d15 2.0834751168291395d15 -7.594022010106465d14 3.1852041828393675d14 -5.7840886188367125d13)
-8.659507329260588d14 1.5596335658322444d14 (-1.4541456776519377d7 1.929435802259886d9 -6.296195191459201d10
3.0168290726564497d8 -3.890662204538243d10 8.843597326374552d11 -6.650622666809788d12 2.986227787462567d13
1.2399453133327766d12 -1.7071606428565754d13 -8.477277839776764d13 1.5596335658322444d14 -1.854737730613888d14
1.2620388151208275d14 -5.583296199291294d14 1.3756208760169238d14 -5.7840886188367125d13 1.0527040765219566d13))))
1.5645387966054885d15 -2.8456190095051365d15
3.349749344363914d15 -2.4618882271582375d15
1.0266886429154235d15 -1.854737730613888d14
-2.1022884505162454d8 2.74177855208454d10
-8.81880779657557d11 1.223562085794148d13
-9.10465178565691d13 4.0506228228731506d14
-1.1406123499040888d15 2.0834751168291395d15
-2.4618882271582375d15 1.8154690416182195d15
-7.594022010106465d14 1.3756208760169238d14
8.375524587383476d7 -1.102566741945975d10
3.574046855772319d11 -4.991562204869468d12
3.7353182667592734d13 -1.669993952432146d14
4.722759913598374d14 -8.659507329260588d14
1.0266886429154235d15 -7.594022010106465d14
3.1852041828393675d14 -5.7840886188367125d13
-1.4541456776519377d7 1.929435802259886d9
-6.296195191459201d10 8.843597326374552d11
-6.650622666809788d12 2.986227787462567d13
-8.477277839776764d13 1.5596335658322444d14
-1.854737730613888d14 1.3756208760169238d14
-5.7840886188367125d13 1.0527040765219566d13)))
(MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB12*)))) (MULTIPLE-VALUE-LIST (TEST-CHOLESKY-INVERT-DIM *HILB12*))))
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
(GRID:MAKE-FOREIGN-ARRAY (GRID:MAKE-FOREIGN-ARRAY
'(SIGNED-BYTE 64) '(SIGNED-BYTE 64)
:INITIAL-CONTENTS :INITIAL-CONTENTS
'((-64 -68 71) (-1 52 -10) (73 -5 123)))) '((-64 -68 71) (-91 52 -10) (73 -5 123))))
(M2 (M2
(GRID:MAKE-FOREIGN-ARRAY '(SIGNED-BYTE 64) :DIMENSIONS '(3 3)))) (GRID:MAKE-FOREIGN-ARRAY '(SIGNED-BYTE 64) :DIMENSIONS '(3 3))))
(GRID:COPY-TO (MATRIX-TRANSPOSE M1 M2))))) (GRID:COPY-TO (MATRIX-TRANSPOSE M1 M2)))))
......
...@@ -19,116 +19,106 @@ ...@@ -19,116 +19,106 @@
(in-package :gsl) (in-package :gsl)
(LISP-UNIT:DEFINE-TEST PERMUTATION (LISP-UNIT:DEFINE-TEST PERMUTATION
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 2) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 2)
(MULTIPLE-VALUE-LIST (MULTIPLE-VALUE-LIST
(LET ((PERM-1 (LET ((PERM-1
(MAKE-PERMUTATION (MAKE-PERMUTATION
4 T))) 4 T)))
(grid:gref PERM-1 (grid:gref PERM-1
2)))) 2))))
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(0 1 2 3)) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(0 1 2 3))
(MULTIPLE-VALUE-LIST (MULTIPLE-VALUE-LIST
(LET ((PERM-1 (LET ((PERM-1
(MAKE-PERMUTATION (MAKE-PERMUTATION
4 T))) 4 T)))
(GRID:COPY-TO (GRID:COPY-TO
PERM-1)))) PERM-1))))
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(3 2 1 0)) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(3 2 1 0))
(MULTIPLE-VALUE-LIST (MULTIPLE-VALUE-LIST
(LET ((PERM-1 (LET ((PERM-1
(MAKE-PERMUTATION (MAKE-PERMUTATION
4 T))) 4 T)))
(SET-IDENTITY (SET-IDENTITY
PERM-1) PERM-1)
(GRID:COPY-TO (GRID:COPY-TO
(PERMUTATION-REVERSE (PERMUTATION-REVERSE
PERM-1))))) PERM-1)))))
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(0 3 1 2)) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
(MULTIPLE-VALUE-LIST (LIST #(0 3 1 2))
(LET ((PERM-1 (MULTIPLE-VALUE-LIST
(MAKE-PERMUTATION (let ;permutation-next, permutation-inverse
4 T)) ((perm-1 (make-permutation 4 t)))
(PERM-2 (set-identity perm-1)
(MAKE-PERMUTATION (permutation-next perm-1)
4 T))) (permutation-next perm-1)
(SET-IDENTITY (permutation-next perm-1)
PERM-1) (grid:copy-to (permutation-inverse perm-1)))))
(PERMUTATION-NEXT (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(0 3 2 1))
PERM-1) (MULTIPLE-VALUE-LIST
(PERMUTATION-NEXT (LET ((PERM-1
PERM-1) (MAKE-PERMUTATION
(PERMUTATION-NEXT 4 T)))
PERM-1) (SET-IDENTITY
(PERMUTATION-INVERSE PERM-1)
PERM-2 PERM-1) (SWAP-ELEMENTS
(GRID:COPY-TO PERM-1 1 3)
PERM-2)))) (GRID:COPY-TO
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(0 3 2 1)) PERM-1))))
(MULTIPLE-VALUE-LIST (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(33 44 11 22))
(LET ((PERM-1 (MULTIPLE-VALUE-LIST
(MAKE-PERMUTATION (LET ((PERM-1
4 T))) (MAKE-PERMUTATION
(SET-IDENTITY 4 T))
PERM-1) (INTVEC
(SWAP-ELEMENTS (GRID:MAKE-FOREIGN-ARRAY
PERM-1 1 3) '(SIGNED-BYTE
(GRID:COPY-TO 32)
PERM-1)))) :INITIAL-CONTENTS
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(33 44 11 22)) '(11 22 33
(MULTIPLE-VALUE-LIST 44))))
(LET ((PERM-1 (SET-IDENTITY
(MAKE-PERMUTATION PERM-1)
4 T)) (SWAP-ELEMENTS
(INTVEC PERM-1 1 3)
(GRID:MAKE-FOREIGN-ARRAY (SWAP-ELEMENTS
'(SIGNED-BYTE PERM-1 0 2)
32) (PERMUTE
:INITIAL-CONTENTS PERM-1 INTVEC)
'(11 22 33 (GRID:COPY-TO
44)))) INTVEC))))
(SET-IDENTITY (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 3)
PERM-1) (MULTIPLE-VALUE-LIST
(SWAP-ELEMENTS (LET ((PERM-1
PERM-1 1 3) (MAKE-PERMUTATION
(SWAP-ELEMENTS 4 T)))
PERM-1 0 2) (SET-IDENTITY
(PERMUTE PERM-1)
PERM-1 INTVEC) (SWAP-ELEMENTS
(GRID:COPY-TO PERM-1 1 3)
INTVEC)))) (INVERSIONS
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 3) PERM-1))))
(MULTIPLE-VALUE-LIST (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 3)
(LET ((PERM-1 (MULTIPLE-VALUE-LIST
(MAKE-PERMUTATION (LET ((PERM-1
4 T))) (MAKE-PERMUTATION
(SET-IDENTITY 4 T)))
PERM-1) (SET-IDENTITY
(SWAP-ELEMENTS PERM-1)
PERM-1 1 3) (SWAP-ELEMENTS
(INVERSIONS PERM-1 1 3)
PERM-1)))) (LINEAR-CYCLES
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 3) PERM-1))))
(MULTIPLE-VALUE-LIST (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 2)
(LET ((PERM-1 (MULTIPLE-VALUE-LIST
(MAKE-PERMUTATION (LET ((PERM-1
4 T))) (MAKE-PERMUTATION
(SET-IDENTITY 4 T)))
PERM-1) (SET-IDENTITY
(SWAP-ELEMENTS PERM-1)
PERM-1 1 3) (SWAP-ELEMENTS
(LINEAR-CYCLES PERM-1 1 3)
PERM-1)))) (SWAP-ELEMENTS
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 2) PERM-1 0 2)
(MULTIPLE-VALUE-LIST (CANONICAL-CYCLES
(LET ((PERM-1 PERM-1)))))
(MAKE-PERMUTATION
4 T)))
(SET-IDENTITY
PERM-1)
(SWAP-ELEMENTS
PERM-1 1 3)
(SWAP-ELEMENTS
PERM-1 0 2)
(CANONICAL-CYCLES
PERM-1)))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment