close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Changeset 2213


Ignore:
Timestamp:
2015-06-18T10:33:28-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r2212 r2213  
    6565
    6666(defmethod initialize-instance :after ((self monom)
    67                                   &key
    68                                     (dimension nil dimension-suppied-p)
    69                                     (exponents nil exponents-supplied-p)
    70                                     (exponent  nil exponent-supplied-p))
     67                                       &key
     68                                        (dimension nil dimension-suppied-p)
     69                                        (exponents nil exponents-supplied-p)
     70                                        (exponent  nil exponent-supplied-p))
    7171  "A constructor (factory) of monomials. If DIMENSION is given, a
    7272sequence of DIMENSION elements of type EXPONENT is constructed, where
     
    7474to 0.  Alternatively, all elements may be specified as a list
    7575EXPONENTS."
    76   (setf (slot-value self 'dimension) (cond (dimension-suppied-p
    77                                             dimension)
    78                                            (exponents-supplied-p
    79                                             (length exponents))
    80                                            (t
    81                                             (error "You must provide DIMENSION or EXPONENTS")))
    82         (slot-value self 'exponents) (cond
    83                                        ;; when exponents are supplied
    84                                        (exponents-supplied-p
    85                                         (when (and dimension-suppied-p
    86                                                    (/= dimension (length exponents)))
    87                                           (error "EXPONENTS must have length DIMENSION"))
    88                                         (make-array (list dimension) :initial-contents exponents
    89                                                     :element-type 'exponent))
    90                                        ;; when all exponents are to be identical
    91                                        (exponent-supplied-p
    92                                         (make-array (list dimension) :initial-element exponent
    93                                                     :element-type 'exponent))
    94                                        ;; otherwise, all exponents are zero
    95                                        (t
    96                                         (make-array (list dimension) :element-type 'exponent :initial-element 0)))))
     76  (format t "INITIALIZE-INSTANCE called with SELF ~A, DIMENSION ~A, EXPONENTS ~A, EXPONENT ~A.~%"
     77          self dimension exponents exponent)
     78  (let ((new-dimension (cond (dimension-suppied-p dimension)
     79                             (exponents-supplied-p
     80                              (length exponents))
     81                             (t
     82                              (error "You must provide DIMENSION or EXPONENTS"))))
     83        (new-exponents  (cond
     84                          ;; when exponents are supplied
     85                          (exponents-supplied-p
     86                           (make-array (list dimension) :initial-contents exponents
     87                                       :element-type 'exponent))
     88                          ;; when all exponents are to be identical
     89                          (exponent-supplied-p
     90                           (make-array (list dimension) :initial-element exponent
     91                                       :element-type 'exponent))
     92                          ;; otherwise, all exponents are zero
     93                          (t
     94                           (make-array (list dimension) :element-type 'exponent :initial-element 0)))))
     95))
    9796
    9897;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note: See TracChangeset for help on using the changeset viewer.