about summary refs log tree commit diff
path: root/src/macros
diff options
context:
space:
mode:
authorArun Isaac2022-01-08 12:44:52 +0530
committerArun Isaac2022-01-08 13:02:05 +0530
commit81b49377edf2d5b08dca4b5ff3132499861244ea (patch)
tree9732533cbd870b0aa11a14c37b468e6ed1bfce45 /src/macros
parent0ef42dfb41960ffa49aafc04fc7c9bfd49d13857 (diff)
downloadnsmc-81b49377edf2d5b08dca4b5ff3132499861244ea.tar.gz
nsmc-81b49377edf2d5b08dca4b5ff3132499861244ea.tar.lz
nsmc-81b49377edf2d5b08dca4b5ff3132499861244ea.zip
Bunch of unfinished experiments unfinished-experiments
These experiments were in progress towards the end, and never properly
finished. I leave the code here in case it turns out to be useful.
Diffstat (limited to 'src/macros')
-rw-r--r--src/macros/macros.sc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/macros/macros.sc b/src/macros/macros.sc
index 1ccfeab..4832887 100644
--- a/src/macros/macros.sc
+++ b/src/macros/macros.sc
@@ -26,6 +26,9 @@
   (when (not condition)
     body ...))
 
+(sc-define-syntax (incr var)
+  (set+ var 1))
+
 (sc-define-syntax (for-i index limit body ...)
   (for ((define index int 0)
         (< index limit)
@@ -49,6 +52,18 @@
               gsl-vector-free
               body ...))
 
+(sc-define-syntax (with-matrix var m n body ...)
+  (with-alloc var gsl-matrix*
+              (gsl-matrix-alloc m n)
+              gsl-matrix-free
+              body ...))
+
+(sc-define-syntax (with-square-matrix var n body ...)
+  (with-alloc var gsl-matrix*
+              (gsl-matrix-alloc n n)
+              gsl-matrix-free
+              body ...))
+
 (sc-define-syntax (with-rng var body ...)
   (with-alloc var gsl-rng*
               (gsl-rng-alloc gsl-rng-default) gsl-rng-free