NEURON
zmatop.c
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 
3 /**************************************************************************
4 **
5 ** Copyright (C) 1993 David E. Steward & Zbigniew Leyk, all rights reserved.
6 **
7 ** Meschach Library
8 **
9 ** This Meschach Library is provided "as is" without any express
10 ** or implied warranty of any kind with respect to this software.
11 ** In particular the authors shall not be liable for any direct,
12 ** indirect, special, incidental or consequential damages arising
13 ** in any way from use of the software.
14 **
15 ** Everyone is granted permission to copy, modify and redistribute this
16 ** Meschach Library, provided:
17 ** 1. All copies contain this copyright notice.
18 ** 2. All modified copies shall carry a notice stating who
19 ** made the last modification and the date of such modification.
20 ** 3. No charge is made for this software or works derived from it.
21 ** This clause shall not be construed as constraining other software
22 ** distributed on the same medium as this software, nor is a
23 ** distribution fee considered a charge.
24 **
25 ***************************************************************************/
26 
27 
28 
29 #include <stdio.h>
30 #include "zmatrix.h"
31 
32 static char rcsid[] = "zmatop.c,v 1.1 1997/12/04 17:56:12 hines Exp";
33 
34 
35 #define is_zero(z) ((z).re == 0.0 && (z).im == 0.0)
36 
37 /* zm_add -- matrix addition -- may be in-situ */
38 ZMAT *zm_add(mat1,mat2,out)
39 ZMAT *mat1,*mat2,*out;
40 {
41  u_int m,n,i;
42 
43  if ( mat1==ZMNULL || mat2==ZMNULL )
44  error(E_NULL,"zm_add");
45  if ( mat1->m != mat2->m || mat1->n != mat2->n )
46  error(E_SIZES,"zm_add");
47  if ( out==ZMNULL || out->m != mat1->m || out->n != mat1->n )
48  out = zm_resize(out,mat1->m,mat1->n);
49  m = mat1->m; n = mat1->n;
50  for ( i=0; i<m; i++ )
51  {
52  __zadd__(mat1->me[i],mat2->me[i],out->me[i],(int)n);
53  /**************************************************
54  for ( j=0; j<n; j++ )
55  out->me[i][j] = mat1->me[i][j]+mat2->me[i][j];
56  **************************************************/
57  }
58 
59  return (out);
60 }
61 
62 /* zm_sub -- matrix subtraction -- may be in-situ */
63 ZMAT *zm_sub(mat1,mat2,out)
64 ZMAT *mat1,*mat2,*out;
65 {
66  u_int m,n,i;
67 
68  if ( mat1==ZMNULL || mat2==ZMNULL )
69  error(E_NULL,"zm_sub");
70  if ( mat1->m != mat2->m || mat1->n != mat2->n )
71  error(E_SIZES,"zm_sub");
72  if ( out==ZMNULL || out->m != mat1->m || out->n != mat1->n )
73  out = zm_resize(out,mat1->m,mat1->n);
74  m = mat1->m; n = mat1->n;
75  for ( i=0; i<m; i++ )
76  {
77  __zsub__(mat1->me[i],mat2->me[i],out->me[i],(int)n);
78  /**************************************************
79  for ( j=0; j<n; j++ )
80  out->me[i][j] = mat1->me[i][j]-mat2->me[i][j];
81  **************************************************/
82  }
83 
84  return (out);
85 }
86 
87 /*
88  Note: In the following routines, "adjoint" means complex conjugate
89  transpose:
90  A* = conjugate(A^T)
91  */
92 
93 /* zm_mlt -- matrix-matrix multiplication */
95 ZMAT *A,*B,*OUT;
96 {
97  u_int i, /* j, */ k, m, n, p;
98  complex **A_v, **B_v /*, *B_row, *OUT_row, sum, tmp */;
99 
100  if ( A==ZMNULL || B==ZMNULL )
101  error(E_NULL,"zm_mlt");
102  if ( A->n != B->m )
103  error(E_SIZES,"zm_mlt");
104  if ( A == OUT || B == OUT )
105  error(E_INSITU,"zm_mlt");
106  m = A->m; n = A->n; p = B->n;
107  A_v = A->me; B_v = B->me;
108 
109  if ( OUT==ZMNULL || OUT->m != A->m || OUT->n != B->n )
110  OUT = zm_resize(OUT,A->m,B->n);
111 
112  /****************************************************************
113  for ( i=0; i<m; i++ )
114  for ( j=0; j<p; j++ )
115  {
116  sum = 0.0;
117  for ( k=0; k<n; k++ )
118  sum += A_v[i][k]*B_v[k][j];
119  OUT->me[i][j] = sum;
120  }
121  ****************************************************************/
122  zm_zero(OUT);
123  for ( i=0; i<m; i++ )
124  for ( k=0; k<n; k++ )
125  {
126  if ( ! is_zero(A_v[i][k]) )
127  __zmltadd__(OUT->me[i],B_v[k],A_v[i][k],(int)p,Z_NOCONJ);
128  /**************************************************
129  B_row = B_v[k]; OUT_row = OUT->me[i];
130  for ( j=0; j<p; j++ )
131  (*OUT_row++) += tmp*(*B_row++);
132  **************************************************/
133  }
134 
135  return OUT;
136 }
137 
138 /* zmma_mlt -- matrix-matrix adjoint multiplication
139  -- A.B* is returned, and stored in OUT */
141 ZMAT *A, *B, *OUT;
142 {
143  int i, j, limit;
144  /* complex *A_row, *B_row, sum; */
145 
146  if ( ! A || ! B )
147  error(E_NULL,"zmma_mlt");
148  if ( A == OUT || B == OUT )
149  error(E_INSITU,"zmma_mlt");
150  if ( A->n != B->n )
151  error(E_SIZES,"zmma_mlt");
152  if ( ! OUT || OUT->m != A->m || OUT->n != B->m )
153  OUT = zm_resize(OUT,A->m,B->m);
154 
155  limit = A->n;
156  for ( i = 0; i < A->m; i++ )
157  for ( j = 0; j < B->m; j++ )
158  {
159  OUT->me[i][j] = __zip__(B->me[j],A->me[i],(int)limit,Z_CONJ);
160  /**************************************************
161  sum = 0.0;
162  A_row = A->me[i];
163  B_row = B->me[j];
164  for ( k = 0; k < limit; k++ )
165  sum += (*A_row++)*(*B_row++);
166  OUT->me[i][j] = sum;
167  **************************************************/
168  }
169 
170  return OUT;
171 }
172 
173 /* zmam_mlt -- matrix adjoint-matrix multiplication
174  -- A*.B is returned, result stored in OUT */
176 ZMAT *A, *B, *OUT;
177 {
178  int i, k, limit;
179  /* complex *B_row, *OUT_row, multiplier; */
180  complex tmp;
181 
182  if ( ! A || ! B )
183  error(E_NULL,"zmam_mlt");
184  if ( A == OUT || B == OUT )
185  error(E_INSITU,"zmam_mlt");
186  if ( A->m != B->m )
187  error(E_SIZES,"zmam_mlt");
188  if ( ! OUT || OUT->m != A->n || OUT->n != B->n )
189  OUT = zm_resize(OUT,A->n,B->n);
190 
191  limit = B->n;
192  zm_zero(OUT);
193  for ( k = 0; k < A->m; k++ )
194  for ( i = 0; i < A->n; i++ )
195  {
196  tmp.re = A->me[k][i].re;
197  tmp.im = - A->me[k][i].im;
198  if ( ! is_zero(tmp) )
199  __zmltadd__(OUT->me[i],B->me[k],tmp,(int)limit,Z_NOCONJ);
200  }
201 
202  return OUT;
203 }
204 
205 /* zmv_mlt -- matrix-vector multiplication
206  -- Note: b is treated as a column vector */
207 ZVEC *zmv_mlt(A,b,out)
208 ZMAT *A;
209 ZVEC *b,*out;
210 {
211  u_int i, m, n;
212  complex **A_v, *b_v /*, *A_row */;
213  /* register complex sum; */
214 
215  if ( A==ZMNULL || b==ZVNULL )
216  error(E_NULL,"zmv_mlt");
217  if ( A->n != b->dim )
218  error(E_SIZES,"zmv_mlt");
219  if ( b == out )
220  error(E_INSITU,"zmv_mlt");
221  if ( out == ZVNULL || out->dim != A->m )
222  out = zv_resize(out,A->m);
223 
224  m = A->m; n = A->n;
225  A_v = A->me; b_v = b->ve;
226  for ( i=0; i<m; i++ )
227  {
228  /* for ( j=0; j<n; j++ )
229  sum += A_v[i][j]*b_v[j]; */
230  out->ve[i] = __zip__(A_v[i],b_v,(int)n,Z_NOCONJ);
231  /**************************************************
232  A_row = A_v[i]; b_v = b->ve;
233  for ( j=0; j<n; j++ )
234  sum += (*A_row++)*(*b_v++);
235  out->ve[i] = sum;
236  **************************************************/
237  }
238 
239  return out;
240 }
241 
242 /* zsm_mlt -- scalar-matrix multiply -- may be in-situ */
243 ZMAT *zsm_mlt(scalar,matrix,out)
244 complex scalar;
245 ZMAT *matrix,*out;
246 {
247  u_int m,n,i;
248 
249  if ( matrix==ZMNULL )
250  error(E_NULL,"zsm_mlt");
251  if ( out==ZMNULL || out->m != matrix->m || out->n != matrix->n )
252  out = zm_resize(out,matrix->m,matrix->n);
253  m = matrix->m; n = matrix->n;
254  for ( i=0; i<m; i++ )
255  __zmlt__(matrix->me[i],scalar,out->me[i],(int)n);
256  /**************************************************
257  for ( j=0; j<n; j++ )
258  out->me[i][j] = scalar*matrix->me[i][j];
259  **************************************************/
260  return (out);
261 }
262 
263 /* zvm_mlt -- vector adjoint-matrix multiplication */
264 ZVEC *zvm_mlt(A,b,out)
265 ZMAT *A;
266 ZVEC *b,*out;
267 {
268  u_int j,m,n;
269  /* complex sum,**A_v,*b_v; */
270 
271  if ( A==ZMNULL || b==ZVNULL )
272  error(E_NULL,"zvm_mlt");
273  if ( A->m != b->dim )
274  error(E_SIZES,"zvm_mlt");
275  if ( b == out )
276  error(E_INSITU,"zvm_mlt");
277  if ( out == ZVNULL || out->dim != A->n )
278  out = zv_resize(out,A->n);
279 
280  m = A->m; n = A->n;
281 
282  zv_zero(out);
283  for ( j = 0; j < m; j++ )
284  if ( b->ve[j].re != 0.0 || b->ve[j].im != 0.0 )
285  __zmltadd__(out->ve,A->me[j],b->ve[j],(int)n,Z_CONJ);
286  /**************************************************
287  A_v = A->me; b_v = b->ve;
288  for ( j=0; j<n; j++ )
289  {
290  sum = 0.0;
291  for ( i=0; i<m; i++ )
292  sum += b_v[i]*A_v[i][j];
293  out->ve[j] = sum;
294  }
295  **************************************************/
296 
297  return out;
298 }
299 
300 /* zm_adjoint -- adjoint matrix */
301 ZMAT *zm_adjoint(in,out)
302 ZMAT *in, *out;
303 {
304  int i, j;
305  int in_situ;
306  complex tmp;
307 
308  if ( in == ZMNULL )
309  error(E_NULL,"zm_adjoint");
310  if ( in == out && in->n != in->m )
311  error(E_INSITU2,"zm_adjoint");
312  in_situ = ( in == out );
313  if ( out == ZMNULL || out->m != in->n || out->n != in->m )
314  out = zm_resize(out,in->n,in->m);
315 
316  if ( ! in_situ )
317  {
318  for ( i = 0; i < in->m; i++ )
319  for ( j = 0; j < in->n; j++ )
320  {
321  out->me[j][i].re = in->me[i][j].re;
322  out->me[j][i].im = - in->me[i][j].im;
323  }
324  }
325  else
326  {
327  for ( i = 0 ; i < in->m; i++ )
328  {
329  for ( j = 0; j < i; j++ )
330  {
331  tmp.re = in->me[i][j].re;
332  tmp.im = in->me[i][j].im;
333  in->me[i][j].re = in->me[j][i].re;
334  in->me[i][j].im = - in->me[j][i].im;
335  in->me[j][i].re = tmp.re;
336  in->me[j][i].im = - tmp.im;
337  }
338  in->me[i][i].im = - in->me[i][i].im;
339  }
340  }
341 
342  return out;
343 }
344 
345 /* zswap_rows -- swaps rows i and j of matrix A upto column lim */
346 ZMAT *zswap_rows(A,i,j,lo,hi)
347 ZMAT *A;
348 int i, j, lo, hi;
349 {
350  int k;
351  complex **A_me, tmp;
352 
353  if ( ! A )
354  error(E_NULL,"swap_rows");
355  if ( i < 0 || j < 0 || i >= A->m || j >= A->m )
356  error(E_SIZES,"swap_rows");
357  lo = max(0,lo);
358  hi = min(hi,A->n-1);
359  A_me = A->me;
360 
361  for ( k = lo; k <= hi; k++ )
362  {
363  tmp = A_me[k][i];
364  A_me[k][i] = A_me[k][j];
365  A_me[k][j] = tmp;
366  }
367  return A;
368 }
369 
370 /* zswap_cols -- swap columns i and j of matrix A upto row lim */
371 ZMAT *zswap_cols(A,i,j,lo,hi)
372 ZMAT *A;
373 int i, j, lo, hi;
374 {
375  int k;
376  complex **A_me, tmp;
377 
378  if ( ! A )
379  error(E_NULL,"swap_cols");
380  if ( i < 0 || j < 0 || i >= A->n || j >= A->n )
381  error(E_SIZES,"swap_cols");
382  lo = max(0,lo);
383  hi = min(hi,A->m-1);
384  A_me = A->me;
385 
386  for ( k = lo; k <= hi; k++ )
387  {
388  tmp = A_me[i][k];
389  A_me[i][k] = A_me[j][k];
390  A_me[j][k] = tmp;
391  }
392  return A;
393 }
394 
395 /* mz_mltadd -- matrix-scalar multiply and add
396  -- may be in situ
397  -- returns out == A1 + s*A2 */
398 ZMAT *mz_mltadd(A1,A2,s,out)
399 ZMAT *A1, *A2, *out;
400 complex s;
401 {
402  /* register complex *A1_e, *A2_e, *out_e; */
403  /* register int j; */
404  int i, m, n;
405 
406  if ( ! A1 || ! A2 )
407  error(E_NULL,"mz_mltadd");
408  if ( A1->m != A2->m || A1->n != A2->n )
409  error(E_SIZES,"mz_mltadd");
410 
411  if ( out != A1 && out != A2 )
412  out = zm_resize(out,A1->m,A1->n);
413 
414  if ( s.re == 0.0 && s.im == 0.0 )
415  return zm_copy(A1,out);
416  if ( s.re == 1.0 && s.im == 0.0 )
417  return zm_add(A1,A2,out);
418 
419  out = zm_copy(A1,out);
420 
421  m = A1->m; n = A1->n;
422  for ( i = 0; i < m; i++ )
423  {
424  __zmltadd__(out->me[i],A2->me[i],s,(int)n,Z_NOCONJ);
425  /**************************************************
426  A1_e = A1->me[i];
427  A2_e = A2->me[i];
428  out_e = out->me[i];
429  for ( j = 0; j < n; j++ )
430  out_e[j] = A1_e[j] + s*A2_e[j];
431  **************************************************/
432  }
433 
434  return out;
435 }
436 
437 /* zmv_mltadd -- matrix-vector multiply and add
438  -- may not be in situ
439  -- returns out == v1 + alpha*A*v2 */
440 ZVEC *zmv_mltadd(v1,v2,A,alpha,out)
441 ZVEC *v1, *v2, *out;
442 ZMAT *A;
443 complex alpha;
444 {
445  /* register int j; */
446  int i, m, n;
447  complex tmp, *v2_ve, *out_ve;
448 
449  if ( ! v1 || ! v2 || ! A )
450  error(E_NULL,"zmv_mltadd");
451  if ( out == v2 )
452  error(E_INSITU,"zmv_mltadd");
453  if ( v1->dim != A->m || v2->dim != A-> n )
454  error(E_SIZES,"zmv_mltadd");
455 
456  tracecatch(out = zv_copy(v1,out),"zmv_mltadd");
457 
458  v2_ve = v2->ve; out_ve = out->ve;
459  m = A->m; n = A->n;
460 
461  if ( alpha.re == 0.0 && alpha.im == 0.0 )
462  return out;
463 
464  for ( i = 0; i < m; i++ )
465  {
466  tmp = __zip__(A->me[i],v2_ve,(int)n,Z_NOCONJ);
467  out_ve[i].re += alpha.re*tmp.re - alpha.im*tmp.im;
468  out_ve[i].im += alpha.re*tmp.im + alpha.im*tmp.re;
469  /**************************************************
470  A_e = A->me[i];
471  sum = 0.0;
472  for ( j = 0; j < n; j++ )
473  sum += A_e[j]*v2_ve[j];
474  out_ve[i] = v1->ve[i] + alpha*sum;
475  **************************************************/
476  }
477 
478  return out;
479 }
480 
481 /* zvm_mltadd -- vector-matrix multiply and add a la zvm_mlt()
482  -- may not be in situ
483  -- returns out == v1 + v2*.A */
484 ZVEC *zvm_mltadd(v1,v2,A,alpha,out)
485 ZVEC *v1, *v2, *out;
486 ZMAT *A;
487 complex alpha;
488 {
489  int /* i, */ j, m, n;
490  complex tmp, /* *A_e, */ *out_ve;
491 
492  if ( ! v1 || ! v2 || ! A )
493  error(E_NULL,"zvm_mltadd");
494  if ( v2 == out )
495  error(E_INSITU,"zvm_mltadd");
496  if ( v1->dim != A->n || A->m != v2->dim )
497  error(E_SIZES,"zvm_mltadd");
498 
499  tracecatch(out = zv_copy(v1,out),"zvm_mltadd");
500 
501  out_ve = out->ve; m = A->m; n = A->n;
502  for ( j = 0; j < m; j++ )
503  {
504  /* tmp = zmlt(v2->ve[j],alpha); */
505  tmp.re = v2->ve[j].re*alpha.re - v2->ve[j].im*alpha.im;
506  tmp.im = v2->ve[j].re*alpha.im + v2->ve[j].im*alpha.re;
507  if ( tmp.re != 0.0 || tmp.im != 0.0 )
508  __zmltadd__(out_ve,A->me[j],tmp,(int)n,Z_CONJ);
509  /**************************************************
510  A_e = A->me[j];
511  for ( i = 0; i < n; i++ )
512  out_ve[i] += A_e[i]*tmp;
513  **************************************************/
514  }
515 
516  return out;
517 }
518 
519 /* zget_col -- gets a specified column of a matrix; returned as a vector */
520 ZVEC *zget_col(mat,col,vec)
521 int col;
522 ZMAT *mat;
523 ZVEC *vec;
524 {
525  u_int i;
526 
527  if ( mat==ZMNULL )
528  error(E_NULL,"zget_col");
529  if ( col < 0 || col >= mat->n )
530  error(E_RANGE,"zget_col");
531  if ( vec==ZVNULL || vec->dim<mat->m )
532  vec = zv_resize(vec,mat->m);
533 
534  for ( i=0; i<mat->m; i++ )
535  vec->ve[i] = mat->me[i][col];
536 
537  return (vec);
538 }
539 
540 /* zget_row -- gets a specified row of a matrix and retruns it as a vector */
541 ZVEC *zget_row(mat,row,vec)
542 int row;
543 ZMAT *mat;
544 ZVEC *vec;
545 {
546  int /* i, */ lim;
547 
548  if ( mat==ZMNULL )
549  error(E_NULL,"zget_row");
550  if ( row < 0 || row >= mat->m )
551  error(E_RANGE,"zget_row");
552  if ( vec==ZVNULL || vec->dim<mat->n )
553  vec = zv_resize(vec,mat->n);
554 
555  lim = min(mat->n,vec->dim);
556 
557  /* for ( i=0; i<mat->n; i++ ) */
558  /* vec->ve[i] = mat->me[row][i]; */
559  MEMCOPY(mat->me[row],vec->ve,lim,complex);
560 
561  return (vec);
562 }
563 
564 /* zset_col -- sets column of matrix to values given in vec (in situ) */
565 ZMAT *zset_col(mat,col,vec)
566 ZMAT *mat;
567 ZVEC *vec;
568 int col;
569 {
570  u_int i,lim;
571 
572  if ( mat==ZMNULL || vec==ZVNULL )
573  error(E_NULL,"zset_col");
574  if ( col < 0 || col >= mat->n )
575  error(E_RANGE,"zset_col");
576  lim = min(mat->m,vec->dim);
577  for ( i=0; i<lim; i++ )
578  mat->me[i][col] = vec->ve[i];
579 
580  return (mat);
581 }
582 
583 /* zset_row -- sets row of matrix to values given in vec (in situ) */
584 ZMAT *zset_row(mat,row,vec)
585 ZMAT *mat;
586 ZVEC *vec;
587 int row;
588 {
589  u_int /* j, */ lim;
590 
591  if ( mat==ZMNULL || vec==ZVNULL )
592  error(E_NULL,"zset_row");
593  if ( row < 0 || row >= mat->m )
594  error(E_RANGE,"zset_row");
595  lim = min(mat->n,vec->dim);
596  /* for ( j=j0; j<lim; j++ ) */
597  /* mat->me[row][j] = vec->ve[j]; */
598  MEMCOPY(vec->ve,mat->me[row],lim,complex);
599 
600  return (mat);
601 }
602 
603 /* zm_rand -- randomise a complex matrix; uniform in [0,1)+[0,1)*i */
605 ZMAT *A;
606 {
607  int i;
608 
609  if ( ! A )
610  error(E_NULL,"zm_rand");
611 
612  for ( i = 0; i < A->m; i++ )
613  mrandlist((Real *)(A->me[i]),2*A->n);
614 
615  return A;
616 }
#define alpha
Definition: bkpfacto.c:43
#define error(err_num, fn_name)
Definition: err.h:73
#define tracecatch(ok_part, function)
Definition: err.h:166
#define E_RANGE
Definition: err.h:104
#define E_NULL
Definition: err.h:102
#define E_INSITU
Definition: err.h:106
#define E_SIZES
Definition: err.h:95
#define E_INSITU2
Definition: err.h:105
void mrandlist(a, int len)
Definition: init.c:171
#define Real
Definition: machine.h:189
uint32_t u_int
Definition: machine.h:38
#define MEMCOPY(from, to, n_items, type)
Definition: matrix.h:147
#define min(a, b)
Definition: matrix.h:157
#define OUT
Definition: matrix.h:51
#define max(a, b)
Definition: matrix.h:154
#define i
Definition: md1redef.h:12
#define A(i)
Definition: multisplit.cpp:63
#define B(i)
Definition: multisplit.cpp:64
static unsigned row
Definition: nonlin.cpp:85
int const size_t const size_t n
Definition: nrngsl.h:11
size_t p
size_t j
static philox4x32_key_t k
Definition: nrnran123.cpp:11
Definition: zmatrix.h:50
complex ** me
Definition: zmatrix.h:54
u_int n
Definition: zmatrix.h:51
u_int m
Definition: zmatrix.h:51
Definition: zmatrix.h:44
complex * ve
Definition: zmatrix.h:46
u_int dim
Definition: zmatrix.h:45
Real re
Definition: zmatrix.h:40
Real im
Definition: zmatrix.h:40
void __zsub__(complex *zp1, complex *zp2, complex *out, int len)
Definition: zmachine.c:147
void __zadd__(complex *zp1, complex *zp2, complex *out, int len)
Definition: zmachine.c:134
complex __zip__(complex *zp1, complex *zp2, int len, int flag)
Definition: zmachine.c:56
void __zmltadd__(complex *zp1, complex *zp2, complex s, int len, int flag)
Definition: zmachine.c:87
void __zmlt__(complex *zp, complex s, complex *out, int len)
Definition: zmachine.c:117
ZMAT * zsm_mlt(complex scalar, ZMAT *matrix, ZMAT *out)
Definition: zmatop.c:243
ZVEC * zmv_mltadd(ZVEC *v1, ZVEC *v2, ZMAT *A, complex alpha, ZVEC *out)
Definition: zmatop.c:440
ZMAT * zm_adjoint(ZMAT *in, ZMAT *out)
Definition: zmatop.c:301
ZMAT * zswap_cols(ZMAT *A, int i, int j, int lo, int hi)
Definition: zmatop.c:371
ZMAT * zset_col(ZMAT *mat, int col, ZVEC *vec)
Definition: zmatop.c:565
ZMAT * zmma_mlt(ZMAT *A, ZMAT *B, ZMAT *OUT)
Definition: zmatop.c:140
ZVEC * zmv_mlt(ZMAT *A, ZVEC *b, ZVEC *out)
Definition: zmatop.c:207
ZVEC * zget_col(ZMAT *mat, int col, ZVEC *vec)
Definition: zmatop.c:520
ZMAT * zm_add(ZMAT *mat1, ZMAT *mat2, ZMAT *out)
Definition: zmatop.c:38
ZVEC * zvm_mltadd(ZVEC *v1, ZVEC *v2, ZMAT *A, complex alpha, ZVEC *out)
Definition: zmatop.c:484
ZVEC * zvm_mlt(ZMAT *A, ZVEC *b, ZVEC *out)
Definition: zmatop.c:264
#define is_zero(z)
Definition: zmatop.c:35
ZMAT * zm_rand(ZMAT *A)
Definition: zmatop.c:604
ZMAT * zswap_rows(ZMAT *A, int i, int j, int lo, int hi)
Definition: zmatop.c:346
ZMAT * mz_mltadd(ZMAT *A1, ZMAT *A2, complex s, ZMAT *out)
Definition: zmatop.c:398
ZMAT * zset_row(ZMAT *mat, int row, ZVEC *vec)
Definition: zmatop.c:584
ZVEC * zget_row(ZMAT *mat, int row, ZVEC *vec)
Definition: zmatop.c:541
ZMAT * zm_mlt(ZMAT *A, ZMAT *B, ZMAT *OUT)
Definition: zmatop.c:94
static char rcsid[]
Definition: zmatop.c:32
ZMAT * zmam_mlt(ZMAT *A, ZMAT *B, ZMAT *OUT)
Definition: zmatop.c:175
ZMAT * zm_sub(ZMAT *mat1, ZMAT *mat2, ZMAT *out)
Definition: zmatop.c:63
ZVEC * zv_zero(ZVEC *x)
Definition: zmemory.c:39
#define Z_CONJ
Definition: zmatrix.h:60
ZMAT * zm_zero(ZMAT *A)
Definition: zmemory.c:51
#define zm_copy(A, B)
Definition: zmatrix.h:264
ZVEC * zv_resize(ZVEC *x, int new_dim)
Definition: zmemory.c:362
#define zv_copy(x, y)
Definition: zmatrix.h:263
ZMAT * zm_resize(ZMAT *A, int new_m, int new_n)
Definition: zmemory.c:227
#define ZVNULL
Definition: zmatrix.h:57
#define ZMNULL
Definition: zmatrix.h:58
#define Z_NOCONJ
Definition: zmatrix.h:61