/[cl-gsl]/cl-gsl/matrix.lisp
ViewVC logotype

Contents of /cl-gsl/matrix.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Mon Apr 18 00:52:16 2005 UTC (9 years ago) by edenny
Branch: MAIN
Changes since 1.1: +51 -355 lines
Initial checkin.
1 edenny 1.1 ;;;; -*- Mode: Lisp; Synatx: ANSI-Common-Lisp; Base: 10 -*-
2     ;;;;
3     ;;;; Copyright (C) 2005 Edgar Denny <edgardenny@comcast.net>
4     ;;;; This file is part of CL-GSL.
5     ;;;;
6     ;;;; This program is free software; you can redistribute it and/or modify
7     ;;;; it under the terms of the GNU General Public License as published by
8     ;;;; the Free Software Foundation; either version 2 of the License, or
9     ;;;; (at your option) any later version.
10     ;;;;
11     ;;;; This program is distributed in the hope that it will be useful,
12     ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13     ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     ;;;; GNU General Public License for more details.
15     ;;;;
16     ;;;; You should have received a copy of the GNU General Public License
17     ;;;; along with this program; if not, write to the Free Software
18     ;;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19    
20 edenny 1.2 (in-package #:cl-gsl-matrix)
21 edenny 1.1
22 edenny 1.2 (defmacro def-matrix-type-funcs% (typ)
23     (let ((type-ptr)
24     (type-val)
25     (type-val-ptr)
26     (type-string))
27     (cond
28     ((eq typ 'double-float)
29     (setq type-ptr 'gsl-matrix-ptr)
30     (setq type-val :double)
31     (setq type-val-ptr '(* :double))
32     (setq type-string "matrix"))
33     ((eq typ 'single-float)
34     (setq type-ptr 'gsl-matrix-float-ptr)
35     (setq type-val :float)
36     (setq type-val-ptr '(* :float))
37     (setq type-string "matrix_float"))
38     ((eq typ 'integer)
39     (setq type-ptr 'gsl-matrix-int-ptr)
40     (setq type-val :int)
41     (setq type-val-ptr '(* :int))
42     (setq type-string "matrix_int"))
43     ((equal typ '(complex (double-float)))
44     (setq type-ptr 'gsl-matrix-complex-ptr)
45     (setq type-val 'gsl-complex)
46     (setq type-val-ptr '(* gsl-complex))
47     (setq type-string "matrix_complex"))
48     ((equal typ '(complex (single-float)))
49     (setq type-ptr 'gsl-matrix-complex-float-ptr)
50     (setq type-val 'gsl-complex-float)
51     (setq type-val-ptr '(* gsl-complex-float))
52     (setq type-string "matrix_complex_float"))
53     (t
54     (error "no matching type.")))
55    
56     `(progn
57     (defun-foreign ,(concatenate 'string "gsl_" type-string "_alloc")
58     ((size-1 size-t)
59     (size-2 size-t))
60     ,type-ptr)
61    
62     (defun-foreign ,(concatenate 'string "gsl_" type-string "_free")
63     ((m ,type-ptr))
64     :void)
65     )))
66    
67     (def-matrix-type-funcs% double-float)
68     (def-matrix-type-funcs% single-float)
69     (def-matrix-type-funcs% integer)
70     (def-matrix-type-funcs% (complex (double-float)))
71     (def-matrix-type-funcs% (complex (single-float)))
72 edenny 1.1
73    
74     ;; Function: gsl_matrix * gsl_matrix_alloc (size_t n1, size_t n2)
75    
76     ;; Function: gsl_matrix * gsl_matrix_calloc (size_t n1, size_t n2)
77    
78     ;; Function: void gsl_matrix_free (gsl_matrix * m)
79    
80     ;; Function: double gsl_matrix_get (const gsl_matrix * m, size_t i, size_t j)
81    
82     ;; Function: void gsl_matrix_set (gsl_matrix * m, size_t i, size_t j, double x)
83    
84     ;; Function: double * gsl_matrix_ptr (gsl_matrix * m, size_t i, size_t j)
85     ;; Function: const double * gsl_matrix_const_ptr (const gsl_matrix * m, size_t i, size_t j)
86    
87     ;; Function: void gsl_matrix_set_all (gsl_matrix * m, double x)
88    
89     ;; Function: void gsl_matrix_set_zero (gsl_matrix * m)
90    
91     ;; Function: void gsl_matrix_set_identity (gsl_matrix * m)
92    
93     ;; Function: int gsl_matrix_fwrite (FILE * stream, const gsl_matrix * m)
94    
95     ;; Function: int gsl_matrix_fread (FILE * stream, gsl_matrix * m)
96    
97     ;; Function: int gsl_matrix_fprintf (FILE * stream, const gsl_matrix * m, const char * format)
98    
99     ;; Function: int gsl_matrix_fscanf (FILE * stream, gsl_matrix * m)
100    
101     ;; Function: gsl_matrix_view gsl_matrix_submatrix (gsl_matrix * m, size_t k1, size_t k2, size_t n1, size_t n2)
102     ;; Function: gsl_matrix_const_view gsl_matrix_const_submatrix (const gsl_matrix * m, size_t k1, size_t k2, size_t n1, size_t n2)
103    
104     ;; Function: gsl_matrix_view gsl_matrix_view_array (double * base, size_t n1, size_t n2)
105     ;; Function: gsl_matrix_const_view gsl_matrix_const_view_array (const double * base, size_t n1, size_t n2)
106    
107     ;; Function: gsl_matrix_view gsl_matrix_view_array_with_tda (double * base, size_t n1, size_t n2, size_t tda)
108     ;; Function: gsl_matrix_const_view gsl_matrix_const_view_array_with_tda (const double * base, size_t n1, size_t n2, size_t tda)
109    
110     ;; Function: gsl_matrix_view gsl_matrix_view_vector (gsl_vector * v, size_t n1, size_t n2)
111     ;; Function: gsl_matrix_const_view gsl_matrix_const_view_vector (const gsl_vector * v, size_t n1, size_t n2)
112    
113     ;; Function: gsl_matrix_view gsl_matrix_view_vector_with_tda (gsl_vector * v, size_t n1, size_t n2, size_t tda)
114     ;; Function: gsl_matrix_const_view gsl_matrix_const_view_vector_with_tda (const gsl_vector * v, size_t n1, size_t n2, size_t tda)
115    
116     ;; Function: gsl_vector_view gsl_matrix_row (gsl_matrix * m, size_t i)
117     ;; Function: gsl_vector_const_view gsl_matrix_const_row (const gsl_matrix * m, size_t i)
118    
119     ;; Function: gsl_vector_view gsl_matrix_column (gsl_matrix * m, size_t j)
120     ;; Function: gsl_vector_const_view gsl_matrix_const_column (const gsl_matrix * m, size_t j)
121    
122     ;; Function: gsl_vector_view gsl_matrix_diagonal (gsl_matrix * m)
123     ;; Function: gsl_vector_const_view gsl_matrix_const_diagonal (const gsl_matrix * m)
124    
125     ;; Function: gsl_vector_view gsl_matrix_subdiagonal (gsl_matrix * m, size_t k)
126     ;; Function: gsl_vector_const_view gsl_matrix_const_subdiagonal (const gsl_matrix * m, size_t k)
127    
128     ;; Function: gsl_vector_view gsl_matrix_superdiagonal (gsl_matrix * m, size_t k)
129     ;; Function: gsl_vector_const_view gsl_matrix_const_superdiagonal (const gsl_matrix * m, size_t k)
130    
131     ;; Function: int gsl_matrix_memcpy (gsl_matrix * dest, const gsl_matrix * src)
132    
133     ;; Function: int gsl_matrix_swap (gsl_matrix * m1, gsl_matrix * m2)
134    
135    
136     ;; Function: int gsl_matrix_get_row (gsl_vector * v, const gsl_matrix * m, size_t i)
137    
138     ;; Function: int gsl_matrix_get_col (gsl_vector * v, const gsl_matrix * m, size_t j)
139    
140     ;; Function: int gsl_matrix_set_row (gsl_matrix * m, size_t i, const gsl_vector * v)
141    
142     ;; Function: int gsl_matrix_set_col (gsl_matrix * m, size_t j, const gsl_vector * v)
143    
144     ;; Function: int gsl_matrix_swap_rows (gsl_matrix * m, size_t i, size_t j)
145    
146     ;; Function: int gsl_matrix_swap_columns (gsl_matrix * m, size_t i, size_t j)
147    
148     ;; Function: int gsl_matrix_swap_rowcol (gsl_matrix * m, size_t i, size_t j)
149    
150     ;; Function: int gsl_matrix_transpose_memcpy (gsl_matrix * dest, const gsl_matrix * src)
151    
152     ;; Function: int gsl_matrix_transpose (gsl_matrix * m)
153    
154     ;; Function: int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b)
155    
156     ;; Function: int gsl_matrix_sub (gsl_matrix * a, const gsl_matrix * b)
157    
158     ;; Function: int gsl_matrix_mul_elements (gsl_matrix * a, const gsl_matrix * b)
159    
160     ;; Function: int gsl_matrix_div_elements (gsl_matrix * a, const gsl_matrix * b)
161    
162     ;; Function: int gsl_matrix_scale (gsl_matrix * a, const double x)
163    
164     ;; Function: int gsl_matrix_add_constant (gsl_matrix * a, const double x)
165    
166     ;; Function: double gsl_matrix_max (const gsl_matrix * m)
167    
168     ;; Function: double gsl_matrix_min (const gsl_matrix * m)
169    
170     ;; Function: void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out)
171    
172     ;; Function: void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t * jmax)
173    
174     ;; Function: void gsl_matrix_min_index (const gsl_matrix * m, size_t * imax, size_t * jmax)
175    
176     ;; Function: void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * imax)
177    
178     ;; Function: int gsl_matrix_isnull (const gsl_matrix * m)
179    

  ViewVC Help
Powered by ViewVC 1.1.5