summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-10-09 21:37:44 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-10-09 21:37:44 -0600
commite46e5eee74af75aa1123b2370ff2f4587f4adc2a (patch)
treeae793dd22176613282e41ce6d15f481c072a8a57
parentadda6869cb2a07984b48c39fcd70ee76449c353d (diff)
downloadcmath-e46e5eee74af75aa1123b2370ff2f4587f4adc2a.tar.gz
cmath-e46e5eee74af75aa1123b2370ff2f4587f4adc2a.zip
flatten directory structure to appease dr koebbe
-rw-r--r--compile.sh3
-rw-r--r--lizfcm.abin0 -> 9632 bytes
-rw-r--r--lizfcm.asd39
-rw-r--r--src/approx,derivative.lisp (renamed from src/approx/derivative.lisp)10
-rw-r--r--src/approx,maceps.lisp (renamed from src/approx/maceps.lisp)0
-rw-r--r--src/approx,package.lisp (renamed from src/approx/package.lisp)3
-rw-r--r--src/lizfcm.asd32
-rw-r--r--src/package.lisp7
-rw-r--r--src/tests,approx.lisp (renamed from tests/approx.lisp)12
-rw-r--r--src/tests,maceps.lisp (renamed from tests/maceps.lisp)0
-rw-r--r--src/tests,suite.lisp (renamed from tests/suite.lisp)0
-rw-r--r--src/tests,table.lisp (renamed from tests/table.lisp)0
-rw-r--r--src/tests,vector.lisp (renamed from tests/vector.lisp)0
-rw-r--r--src/utils,package.lisp (renamed from src/utils/package.lisp)0
-rw-r--r--src/utils,table.lisp (renamed from src/utils/table.lisp)0
-rw-r--r--src/utils,within-range.lisp (renamed from src/utils/within-range.lisp)0
-rw-r--r--src/vector,distance.lisp (renamed from src/vector/distance.lisp)0
-rw-r--r--src/vector,norm.lisp (renamed from src/vector/norm.lisp)0
-rw-r--r--src/vector,package.lisp (renamed from src/vector/package.lisp)0
19 files changed, 58 insertions, 48 deletions
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 0000000..1d27463
--- /dev/null
+++ b/lizfcm.a
Binary files differ
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
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
index e2738e4..e2738e4 100644
--- a/src/approx/maceps.lisp
+++ b/src/approx,maceps.lisp
diff --git a/src/approx/package.lisp b/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
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
index cd5ced9..cd5ced9 100644
--- a/tests/maceps.lisp
+++ b/src/tests,maceps.lisp
diff --git a/tests/suite.lisp b/src/tests,suite.lisp
index e23cfaf..e23cfaf 100644
--- a/tests/suite.lisp
+++ b/src/tests,suite.lisp
diff --git a/tests/table.lisp b/src/tests,table.lisp
index 33d4e86..33d4e86 100644
--- a/tests/table.lisp
+++ b/src/tests,table.lisp
diff --git a/tests/vector.lisp b/src/tests,vector.lisp
index 3ffe5a8..3ffe5a8 100644
--- a/tests/vector.lisp
+++ b/src/tests,vector.lisp
diff --git a/src/utils/package.lisp b/src/utils,package.lisp
index bdd5589..bdd5589 100644
--- a/src/utils/package.lisp
+++ b/src/utils,package.lisp
diff --git a/src/utils/table.lisp b/src/utils,table.lisp
index e96f37b..e96f37b 100644
--- a/src/utils/table.lisp
+++ b/src/utils,table.lisp
diff --git a/src/utils/within-range.lisp b/src/utils,within-range.lisp
index 9a0b762..9a0b762 100644
--- a/src/utils/within-range.lisp
+++ b/src/utils,within-range.lisp
diff --git a/src/vector/distance.lisp b/src/vector,distance.lisp
index 74631ce..74631ce 100644
--- a/src/vector/distance.lisp
+++ b/src/vector,distance.lisp
diff --git a/src/vector/norm.lisp b/src/vector,norm.lisp
index aa51bce..aa51bce 100644
--- a/src/vector/norm.lisp
+++ b/src/vector,norm.lisp
diff --git a/src/vector/package.lisp b/src/vector,package.lisp
index 009b190..009b190 100644
--- a/src/vector/package.lisp
+++ b/src/vector,package.lisp