From f2e72823910da0a82121cf12ffa84c2d0cb58c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Cuevas-Rozo?= Date: Tue, 21 May 2019 00:25:06 +0200 Subject: [PATCH] Some comments about auxiliary functions were added --- src/sage-interface.lisp | 58 +++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/sage-interface.lisp b/src/sage-interface.lisp index c3fa3b8..d3fd157 100644 --- a/src/sage-interface.lisp +++ b/src/sage-interface.lisp @@ -8,18 +8,13 @@ -;;;; Chain complexes - +;;;;; Chain complexes ;;;;; (DEFVAR *ASCII-NUM-START* 48) - - - (DEFVAR *ASCII-NUM-END* 57) - (DEFUN ITOA (value) (if (not (integerp value)) (error "Wrong type")) (if (zerop value) @@ -40,17 +35,15 @@ (return (format nil "~{~a~}" (nreverse result)))))) - (DEFUN STRCAT (&rest strings) (apply 'concatenate 'string strings)) - (DEFMACRO GEN (num1 num2) `(read-from-string (strcat "G" (itoa ,num1) "G" (itoa ,num2)))) - (DEFUN KBASIS (schcm) +#| It provides the slot :basis of the KenzoSimplicialSet obtained by applying the function 'KChainComplex' to 'schcm' |# (flet ((rslt (dim) (let ((pair (assoc dim schcm))) (if (null pair) @@ -60,8 +53,8 @@ (the basis #'rslt))) - (DEFUN KDFFR (schcm) +#| It provides the slot :intr-dffr of the KenzoSimplicialSet obtained by applying the function 'KChainComplex' to 'schcm' |# (flet ((frslt (dim gnr) (let* ((sep (1+ (position #\G (subseq (write-to-string gnr) 1)))) (dim_gnr (read-from-string (subseq (write-to-string gnr) 1 sep))) @@ -83,8 +76,8 @@ #'frslt)) - (DEFUN G-CMPR (GnGm1 GnGm2) +#| It provides the slot :cmpr of the KenzoSimplicialSet obtained by applying the function 'KChainComplex' to 'schcm' |# (let* ((sep (1+ (position #\G (subseq (write-to-string GnGm1) 1)))) (m1 (read-from-string (subseq (write-to-string GnGm1) (1+ sep)))) (m2 (read-from-string (subseq (write-to-string GnGm2) (1+ sep))))) @@ -97,8 +90,16 @@ :greater))))) +(DEFUN ENTRY (mat i j) +#| It provides the entry in row 'i' and column 'j' of the matrice 'mat' |# + (let ((p (left (chercher-hor (baselig mat i) j)))) + (if (= j (icol p)) + (val p) + 0))) + (DEFUN CONVERTMATRICE (matrice) +#| It converts a matrix of type matrice to an array |# (let* ((numfil (nlig matrice)) (numcol (ncol matrice)) (rslt (make-array (list numfil numcol) :initial-element 0))) @@ -110,16 +111,8 @@ rslt)) - -(DEFUN ENTRY (mat i j) - (let ((p (left (chercher-hor (baselig mat i) j)))) - (if (= j (icol p)) - (val p) - 0))) - - - (DEFUN CHCM-MAT2 (chcm n) +#| The same 'chcm-mat' function but it does not print on screen intermediate computations |# (declare (type chain-complex chcm) (type fixnum n)) @@ -153,41 +146,38 @@ mat))) - (DEFUN MAKE-ARRAY-TO-LISTS (array) +#| It converts an array to a list formed by its rows |# (loop for i below (array-dimension array 0) collect (loop for j below (array-dimension array 1) collect (aref array i j)))) - (DEFUN MAKE-ARRAY-FROM-LISTS (nrows ncols list) +#| It constructs an array from a list formed by its rows |# (make-array (list nrows ncols) :initial-contents list)) - (DEFUN BASIS_AUX1 (kchcm dim) (basis kchcm dim)) - (DEFUN ORGN_AUX1 (kchcm) (orgn kchcm)) - (DEFUN DFFR_AUX1(kchcm dim cmbn_list) +#| Differential of a comb with dimension 'dim' and 'cmbn_list' as its cmbn-list |# (let ((comb (cmbn dim))) (setf (cmbn-list comb) cmbn_list) (dffr kchcm comb))) - -;;;; Simplicial sets - +;;;;; SImplicial Sets ;;;;; (DEFUN BUILD-FINITE-SS2 (list) +#| The same 'build-finite-ss' function but it does not check the face relations of the simplices in 'list' ('check-smst' omitted) |# (declare (list list)) (let ((bspn (first list)) (table (finite-ss-table list)) @@ -208,5 +198,17 @@ rslt))) +(DEFUN SFINITESIMPLICIALSET_AUX1 (finitess limit) +#| It constructs a list (L0 L1 ... Lm), with m <= 'limit', where each list Lk is formed by lists of the form (S (a0 ... ak)), where each aj is a face of the k-simplex S |# + (let ((rslt NIL)) + (do ((k 1 (1+ k))) ((> k limit)) + (let ((dimk NIL)) + (dolist (simplex (basis finitess k)) + (let ((faces NIL)) + (do ((i k (1- i))) ((< i 0)) + (push (face finitess i k simplex) faces)) + (push (cons simplex faces) dimk))) + (push dimk rslt))) + (reverse rslt)))