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 868


Ignore:
Timestamp:
2015-06-09T11:46:13-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monomial.lisp

    r866 r868  
    174174(defun monom-rel-prime-p (m1 m2)
    175175  "Returns T if two monomials M1 and M2 are relatively prime (disjoint)."
    176   (declare (type monom m1 m2))
    177   (every #'(lambda (x y) (declare (type exponent x y)) (zerop (min x y)))
    178          (monom-exponents m1)
    179          (monom-exponents m2)))
     176  (every #'(lambda (x y) (declare (type exponent x y)) (zerop (min x y))) m1 m2))
    180177
    181178(defun monom-equal-p (m1 m2)
    182179  "Returns T if two monomials M1 and M2 are equal."
    183   (declare (type monom m1 m2))
    184180  (every #'= (monom-exponents m1) (monom-exponents m2)))
    185181
    186 (defun monom-lcm (m1 m2 &aux (result (copy-structure m1)))
     182(defun monom-lcm (m1 m2 &aux (result (copy-sequence m1)))
    187183  "Returns least common multiple of monomials M1 and M2."
    188   (declare (type monom m1 m2))
    189   (map-into (monom-exponents result) #'max
    190             (monom-exponents m1)
    191             (monom-exponents m2))
    192   result)
    193 
    194 (defun monom-gcd (m1 m2 &aux (result (copy-structure m1)))
     184  (map-into result #'max m1 m2))
     185
     186(defun monom-gcd (m1 m2 &aux (result (copy-sequence m1)))
    195187  "Returns greatest common divisor of monomials M1 and M2."
    196   (declare (type monom m1 m2))
    197   (map-into (monom-exponents result) #'min (monom-exponents m1) (monom-exponents m2))
    198   result)
     188  (map-into result #'min m1 m2))
    199189
    200190(defun monom-depends-p (m k)
    201191  "Return T if the monomial M depends on variable number K."
    202   (declare (type monom m) (fixnum k))
    203192  (plusp (monom-elt m k)))
    204193
    205 (defmacro monom-map (fun m &rest ml &aux (result `(copy-structure ,m)))
    206   `(map-into (monom-exponents ,result) ,fun (monom-exponents ,m) ,@ml))
     194(defmacro monom-map (fun m &rest ml &aux (result `(copy-sequence ,m)))
     195  `(map-into ,result ,fun ,m ,@ml))
    207196
    208197(defmacro monom-append (m1 m2)
    209   `(make-monom :exponents (concatenate 'vector (monom-exponents ,m1) (monom-exponents ,m2))))
     198  `(concatenate 'vector ,m1 ,m2))
    210199
    211200(defmacro monom-contract (k m)
    212   `(setf (monom-exponents ,m) (subseq (monom-exponents ,m) ,k)))
     201  `(setf ,m (subseq ,m ,k)))
Note: See TracChangeset for help on using the changeset viewer.