From e46e5eee74af75aa1123b2370ff2f4587f4adc2a Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Mon, 9 Oct 2023 21:37:44 -0600 Subject: [PATCH] flatten directory structure to appease dr koebbe --- compile.sh | 3 ++ lizfcm.a | Bin 0 -> 9632 bytes lizfcm.asd | 39 ------------------ ...derivative.lisp => approx,derivative.lisp} | 10 ++++- .../maceps.lisp => approx,maceps.lisp} | 0 .../package.lisp => approx,package.lisp} | 3 +- src/lizfcm.asd | 32 ++++++++++++++ src/package.lisp | 7 ---- tests/approx.lisp => src/tests,approx.lisp | 12 ++++++ tests/maceps.lisp => src/tests,maceps.lisp | 0 tests/suite.lisp => src/tests,suite.lisp | 0 tests/table.lisp => src/tests,table.lisp | 0 tests/vector.lisp => src/tests,vector.lisp | 0 .../package.lisp => utils,package.lisp} | 0 src/{utils/table.lisp => utils,table.lisp} | 0 ...hin-range.lisp => utils,within-range.lisp} | 0 .../distance.lisp => vector,distance.lisp} | 0 src/{vector/norm.lisp => vector,norm.lisp} | 0 .../package.lisp => vector,package.lisp} | 0 19 files changed, 58 insertions(+), 48 deletions(-) create mode 100644 compile.sh create mode 100644 lizfcm.a delete mode 100644 lizfcm.asd rename src/{approx/derivative.lisp => approx,derivative.lisp} (59%) rename src/{approx/maceps.lisp => approx,maceps.lisp} (100%) rename src/{approx/package.lisp => approx,package.lisp} (64%) create mode 100644 src/lizfcm.asd delete mode 100644 src/package.lisp rename tests/approx.lisp => src/tests,approx.lisp (73%) rename tests/maceps.lisp => src/tests,maceps.lisp (100%) rename tests/suite.lisp => src/tests,suite.lisp (100%) rename tests/table.lisp => src/tests,table.lisp (100%) rename tests/vector.lisp => src/tests,vector.lisp (100%) rename src/{utils/package.lisp => utils,package.lisp} (100%) rename src/{utils/table.lisp => utils,table.lisp} (100%) rename src/{utils/within-range.lisp => utils,within-range.lisp} (100%) rename src/{vector/distance.lisp => vector,distance.lisp} (100%) rename src/{vector/norm.lisp => vector,norm.lisp} (100%) rename src/{vector/package.lisp => vector,package.lisp} (100%) diff --git a/compile.sh b/compile.sh new file mode 100644 index 0000000..f174fbe --- /dev/null +++ b/compile.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +ar rcs lizfcm.a src/* diff --git a/lizfcm.a b/lizfcm.a new file mode 100644 index 0000000000000000000000000000000000000000..1d27463724a6783a9702623d29341286a2165f06 GIT binary patch literal 9632 zcmds7-H+Qg62E8v6;lUDxXEf`dAHlO5ES>&6zxNCz%?)T)TJeQEmW3NeK>ai`VKiH zMaq=pbkn;-1?-2#;c&kAue!E=2@Wl74`_*E#xQhY4Uf?gF;drsQ zzq`Xv4~F(}_RB9fKmX^a@7{k8KmY6BAKriW59g75Eh$bRz7MO_1mFABQZs&>@w#rR z!*wQ_e9yalFK&vwt%*6y%c$n*ulz|sQslpH(%lWwU(IGL6Pvz-RFqxAi)dgF@ebGq z4)C(7ySyrS0Z3bP92Pf=`08o~zzWg52F4CcU~iC84XY6?7dynjqTt98=b#Y95jMyt zZ#y_Fue`ZOoI9exWi<(VD;Xn`V=N_6k6dX92O=_xZK~!YZ?eBYv4dS0E%Dz{XN`V* zmOh@;|3ml8W@;Y=;yqs8hWF9!5;v22Y`pJyD(cpWbs6y&#e21@`%Xl}Kn6O8yv#cj z))>`W`+^o_qG{+AIi3|&RYO`8g-CI$s2Jw31tfDK1G37*C$eF!=r%}$;k$*UOGazR zB^Y0~GPoJ;%aj*|+#qjIysf)Ch}`?_&~v*_h~ncmF9fh}rEIWJgVXk3tyW?CFD*J* z`)gS79pKqNEuy{^Xb}lC28BEjl0cFm4J2uy%%6xuT{Rtk4uO(mO-O>f+oK3?7>^|N zVgaqJpD@lpd?O(~g!A#&3mwjnGoxXf4FJ!0n{5&_LwjsHv4c4g&0S%XzmmOZT7+Df zFK*(SMSy_!-L`6A{vKKIwdl6+Ltl0Q!Xif_qHX6t{rDj;ELE>cG;@0*1Y^lYM$NqM z@}j-|n0H$|M;cx}i8-JawJ5VTLLr%^(9WHQ!qn&0@pbW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2byx5nS_@iSLI@=D)F{Cn1%+Od6D&xGyLAK~akz3}FfZMBjPai9+CZ%*kSRWcPbu=)@ zu;0+90$#j&GYVp30H>Wiq8MUa-tkWkV!+4+F&JuNpkb!@Z*R?u-zA6@<>0LyKj`C9 zX)wr)10ZKwd<)|Agq`C%L;X0@b`AoyXYVt0=?yWF8zgl9uk4dJSw>>iq7f64MxEIo DjBAWe literal 0 HcmV?d00001 diff --git a/lizfcm.asd b/lizfcm.asd deleted file mode 100644 index 3e8c289..0000000 --- a/lizfcm.asd +++ /dev/null @@ -1,39 +0,0 @@ -(asdf:defsystem "lizfcm" - :version "0.1.0" - :author "Elizabeth Hunt" - :license "MIT" - :components ((:module "src" - :components - ((:module "utils" - :components - ((:file "within-range" :depends-on ("package")) - (:file "table" :depends-on ("package")) - (:file "package"))) - (:module "approx" - :components - ((:file "maceps" :depends-on ("package")) - (:file "derivative" :depends-on ("package")) - (:file "package"))) - (:module "vector" - :components - ((:file "distance" :depends-on ("norm" "package")) - (:file "norm" :depends-on ("package")) - (:file "package"))))))) - - -(asdf:defsystem "lizfcm/tests" - :author "Elizabeth Hunt" - :license "MIT" - :depends-on (:fiveam - :lizfcm) - :components ((:module "tests" - :components - ((:file "table" :depends-on ("suite")) - (:file "maceps" :depends-on ("suite")) - (:file "approx" :depends-on ("suite")) - (:file "vector" :depends-on ("suite")) - (:file "suite")))) - :perform (asdf:test-op (o c) (uiop:symbol-call - :fiveam :run! - (uiop:find-symbol* :lizfcm-test-suite :lizfcm/tests)))) - diff --git a/src/approx/derivative.lisp b/src/approx,derivative.lisp similarity index 59% rename from src/approx/derivative.lisp rename to src/approx,derivative.lisp index 8aa171a..631a5c0 100644 --- a/src/approx/derivative.lisp +++ b/src/approx,derivative.lisp @@ -8,10 +8,18 @@ (/ (- y2 y1) (- x2 x1)))) -(defun fwd-derivative-at (f x &optional (delta 0.01)) +(defun forward-derivative-at (f x &optional (delta 0.01)) (let* ((x2 (+ x delta)) (x1 x) (y2 (apply f (list x2))) (y1 (apply f (list x1)))) (/ (- y2 y1) (- x2 x1)))) + +(defun backward-derivative-at (f x &optional (delta 0.01)) + (let* ((x2 x) + (x1 (- x delta)) + (y2 (apply f (list x2))) + (y1 (apply f (list x1)))) + (/ (- y2 y1) + (- x2 x1)))) diff --git a/src/approx/maceps.lisp b/src/approx,maceps.lisp similarity index 100% rename from src/approx/maceps.lisp rename to src/approx,maceps.lisp diff --git a/src/approx/package.lisp b/src/approx,package.lisp similarity index 64% rename from src/approx/package.lisp rename to src/approx,package.lisp index 67c6a90..a0eac80 100644 --- a/src/approx/package.lisp +++ b/src/approx,package.lisp @@ -2,5 +2,6 @@ (defpackage lizfcm.approx (:use :cl) (:export :central-derivative-at - :fwd-derivative-at + :forward-derivative-at + :backward-derivative-at :compute-maceps)) diff --git a/src/lizfcm.asd b/src/lizfcm.asd new file mode 100644 index 0000000..ee8beb0 --- /dev/null +++ b/src/lizfcm.asd @@ -0,0 +1,32 @@ +(asdf:defsystem "lizfcm" + :version "0.1.0" + :author "Elizabeth Hunt" + :license "MIT" + :components + ((:file "utils,within-range" :depends-on ("utils,package")) + (:file "utils,table" :depends-on ("utils,package")) + (:file "utils,package") + (:file "approx,maceps" :depends-on ("approx,package")) + (:file "approx,derivative" :depends-on ("approx,package")) + (:file "approx,package") + (:file "vector,distance" :depends-on ("vector,norm" "vector,package")) + (:file "vector,norm" :depends-on ("vector,package")) + (:file "vector,package"))) + + +(asdf:defsystem "lizfcm/tests" + :author "Elizabeth Hunt" + :license "MIT" + :depends-on + (:fiveam + :lizfcm) + :components + ((:file "tests,table" :depends-on ("tests,suite")) + (:file "tests,maceps" :depends-on ("tests,suite")) + (:file "tests,approx" :depends-on ("tests,suite")) + (:file "tests,vector" :depends-on ("tests,suite")) + (:file "tests,suite")) + :perform + (asdf:test-op (o c) (uiop:symbol-call + :fiveam :run! + (uiop:find-symbol* :lizfcm-test-suite :lizfcm/tests)))) diff --git a/src/package.lisp b/src/package.lisp deleted file mode 100644 index 88b10eb..0000000 --- a/src/package.lisp +++ /dev/null @@ -1,7 +0,0 @@ -(in-package :cl-user) -(defpackage lizfcm.vector - (:use :cl) - (:export - :n-norm - :max-norm - :distance)) diff --git a/tests/approx.lisp b/src/tests,approx.lisp similarity index 73% rename from tests/approx.lisp rename to src/tests,approx.lisp index 588b16d..678ff8c 100644 --- a/tests/approx.lisp +++ b/src/tests,approx.lisp @@ -34,3 +34,15 @@ (forward-derivative-at f x delta) f-prime-at-x accepted-delta)))) + +(test bwd-derivative-at + :description "backward derivative at is within bounds" + (let ((f (lambda (x) (* x x))) + (x 2) + (accepted-delta 0.02) + (f-prime-at-x 4) + (delta 0.01)) + (is (within-range-p + (backward-derivative-at f x delta) + f-prime-at-x + accepted-delta)))) diff --git a/tests/maceps.lisp b/src/tests,maceps.lisp similarity index 100% rename from tests/maceps.lisp rename to src/tests,maceps.lisp diff --git a/tests/suite.lisp b/src/tests,suite.lisp similarity index 100% rename from tests/suite.lisp rename to src/tests,suite.lisp diff --git a/tests/table.lisp b/src/tests,table.lisp similarity index 100% rename from tests/table.lisp rename to src/tests,table.lisp diff --git a/tests/vector.lisp b/src/tests,vector.lisp similarity index 100% rename from tests/vector.lisp rename to src/tests,vector.lisp diff --git a/src/utils/package.lisp b/src/utils,package.lisp similarity index 100% rename from src/utils/package.lisp rename to src/utils,package.lisp diff --git a/src/utils/table.lisp b/src/utils,table.lisp similarity index 100% rename from src/utils/table.lisp rename to src/utils,table.lisp diff --git a/src/utils/within-range.lisp b/src/utils,within-range.lisp similarity index 100% rename from src/utils/within-range.lisp rename to src/utils,within-range.lisp diff --git a/src/vector/distance.lisp b/src/vector,distance.lisp similarity index 100% rename from src/vector/distance.lisp rename to src/vector,distance.lisp diff --git a/src/vector/norm.lisp b/src/vector,norm.lisp similarity index 100% rename from src/vector/norm.lisp rename to src/vector,norm.lisp diff --git a/src/vector/package.lisp b/src/vector,package.lisp similarity index 100% rename from src/vector/package.lisp rename to src/vector,package.lisp