~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/math/matrix/mat_free.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)Matrix freeing (various types and shapes)
  2  */
  3 
  4 #include <math.h>
  5 #include <stdio.h>
  6 #include <tina/sys.h>
  7 #include <tina/sysfuncs.h>
  8 #include <tina/math.h>
  9 
 10 void    cmatrix_free(Matrix * mat);
 11 void    smatrix_free(Matrix * mat);
 12 void    imatrix_free(Matrix * mat);
 13 void    fmatrix_free(Matrix * mat);
 14 void    dmatrix_free(Matrix * mat);
 15 void    zmatrix_free(Matrix * mat);
 16 void    pmatrix_free(Matrix * mat);
 17 
 18 void    matrix_free(Matrix * mat)
 19 {
 20     if (mat == NULL)
 21         return;
 22     switch (mat->vtype)
 23     {
 24     case char_v:
 25     case uchar_v:
 26         cmatrix_free((Matrix *) mat);
 27         break;
 28     case short_v:
 29     case ushort_v:
 30         smatrix_free((Matrix *) mat);
 31         break;
 32     case int_v:
 33     case uint_v:
 34         imatrix_free((Matrix *) mat);
 35         break;
 36     case float_v:
 37         fmatrix_free(mat);
 38         break;
 39     case double_v:
 40         dmatrix_free(mat);
 41         break;
 42     case complex_v:
 43         zmatrix_free(mat);
 44         break;
 45     case ptr_v:
 46         pmatrix_free(mat);
 47         break;
 48     }
 49 }
 50 
 51 void    cmatrix_free(Matrix * mat)
 52 {
 53     switch (mat->shape)
 54     {
 55         case matrix_full:
 56         carray_free((char **) mat->el.char_v, 0, 0, mat->m, mat->n);
 57         break;
 58     case matrix_lower:
 59     case matrix_symmetric:
 60         clower_free((char **) mat->el.char_v, 0, mat->m);
 61         break;
 62     case matrix_upper:
 63         cupper_free((char **) mat->el.char_v, 0, mat->m);
 64         break;
 65     }
 66     rfree((void *) mat);
 67 }
 68 
 69 void    smatrix_free(Matrix * mat)
 70 {
 71     switch (mat->shape)
 72     {
 73         case matrix_full:
 74         sarray_free((char **) mat->el.short_v, 0, 0, mat->m, mat->n);
 75         break;
 76     case matrix_lower:
 77     case matrix_symmetric:
 78         slower_free((char **) mat->el.short_v, 0, mat->m);
 79         break;
 80     case matrix_upper:
 81         supper_free((char **) mat->el.short_v, 0, mat->m);
 82         break;
 83     }
 84     rfree((void *) mat);
 85 }
 86 
 87 void    imatrix_free(Matrix * mat)
 88 {
 89     switch (mat->shape)
 90     {
 91         case matrix_full:
 92         iarray_free((char **) mat->el.int_v, 0, 0, mat->m, mat->n);
 93         break;
 94     case matrix_lower:
 95     case matrix_symmetric:
 96         ilower_free((char **) mat->el.int_v, 0, mat->m);
 97         break;
 98     case matrix_upper:
 99         iupper_free((char **) mat->el.int_v, 0, mat->m);
100         break;
101     }
102     rfree((void *) mat);
103 }
104 
105 void    fmatrix_free(Matrix * mat)
106 {
107     switch (mat->shape)
108     {
109         case matrix_full:
110         farray_free((char **) mat->el.float_v, 0, 0, mat->m, mat->n);
111         break;
112     case matrix_lower:
113     case matrix_symmetric:
114         flower_free((char **) mat->el.float_v, 0, mat->m);
115         break;
116     case matrix_upper:
117         fupper_free((char **) mat->el.float_v, 0, mat->m);
118         break;
119     }
120     rfree((void *) mat);
121 }
122 
123 void    dmatrix_free(Matrix * mat)
124 {
125     switch (mat->shape)
126     {
127         case matrix_full:
128         darray_free((char **) mat->el.double_v, 0, 0, mat->m, mat->n);
129         break;
130     case matrix_lower:
131     case matrix_symmetric:
132         dlower_free((char **) mat->el.double_v, 0, mat->m);
133         break;
134     case matrix_upper:
135         dupper_free((char **) mat->el.double_v, 0, mat->m);
136         break;
137     }
138     rfree((void *) mat);
139 }
140 
141 void    pmatrix_free(Matrix * mat)
142 {
143     switch (mat->shape)
144     {
145         case matrix_full:
146         parray_free((char **) mat->el.ptr_v, 0, 0, mat->m, mat->n);
147         break;
148     case matrix_lower:
149     case matrix_symmetric:
150         plower_free((char **) mat->el.ptr_v, 0, mat->m);
151         break;
152     case matrix_upper:
153         pupper_free((char **) mat->el.ptr_v, 0, mat->m);
154         break;
155     }
156     rfree((void *) mat);
157 }
158 
159 void    zmatrix_free(Matrix * mat)
160 {
161     switch (mat->shape)
162     {
163         case matrix_full:
164         zarray_free((char **) mat->el.complex_v, 0, 0, mat->m, mat->n);
165         break;
166     case matrix_lower:
167     case matrix_symmetric:
168         zlower_free((char **) mat->el.complex_v, 0, mat->m);
169         break;
170     case matrix_upper:
171         zupper_free((char **) mat->el.complex_v, 0, mat->m);
172         break;
173     }
174     rfree((void *) mat);
175 }
176 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.