~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to share/linearalgebra/linalg-extra.lisp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;; Copyright 2006 by Barton Willis
 
2
 
 
3
;;  This is free software; you can redistribute it and/or
 
4
;;  modify it under the terms of the GNU General Public License,
 
5
;;  http://www.gnu.org/copyleft/gpl.html.
 
6
 
 
7
;; This software has NO WARRANTY, not even the implied warranty of
 
8
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
9
 
 
10
($put '$linalgextra 1 '$version)
 
11
 
 
12
(defun $circulant (lst)
 
13
  ($require_list lst "$first" "$circulant")
 
14
  (let ((q) (n ($length lst)))
 
15
    (setq lst (rest lst))
 
16
    (setq q (list lst))
 
17
    (decf n)
 
18
    (dotimes (i n)
 
19
      (setq lst `(,@(rest lst) ,(car lst)))
 
20
      (push lst q))
 
21
    (setq q (mapcar #'(lambda(s) (cons '(mlist) s)) q))
 
22
    (push '($matrix) q)))
 
23
 
 
24
(defun $cauchy_matrix (p &optional q)
 
25
  ($require_list p "$first" "$cauchy_matrix")
 
26
  (if q ($require_list q "$second" "$cauchy_matrix") (setq q p))
 
27
  (let ((row) (mat))
 
28
    (setq p (margs p))
 
29
    (setq q (margs q))
 
30
    (dolist (pj p)
 
31
      (setq row nil)
 
32
      (dolist (qj q)
 
33
        (push (div 1 (add pj qj)) row))
 
34
      (setq row (nreverse row))
 
35
      (push '(mlist) row)
 
36
      (push row mat))
 
37
    (setq mat (nreverse mat))
 
38
    (push '($matrix) mat)))
 
39
 
 
40
 
 
41