NEURON
matrix.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 #include "classreg.h"
3 
4 #include <stdio.h>
5 #include <math.h>
6 #include "ocmatrix.h"
7 #include "oc2iv.h"
8 #include "parse.hpp"
9 #include "ivocvect.h"
10 
11 #define EPS hoc_epsilon
12 static Symbol* smat_;
13 
14 extern int hoc_return_type_code;
15 
16 extern double hoc_scan(FILE*);
17 extern "C" FILE* hoc_obj_file_arg(int i);
18 extern Object** hoc_temp_objptr(Object*);
19 
20 #if 0
21  extern void install_matrix_method(const char* name, double (*)(...));
22  extern void* matrix_arg(int);
23  extern double* matrix_pelm(void*, int i, int j);
24  extern int matrix_nrow(void*);
25  extern int matrix_ncol(void*);
26  extern int matrix_type(void*); // FULL 1, SPARSE 2, BAND 3
27  extern MAT* matrix_full(void*); // hoc_execerror if void* not right type
28  extern SPMAT* matrix_sparse(void*);
29 #endif
30 
31 static void check_domain(int i, int j) {
32  if (i > j || i < 0) {
33  char buf[256];
34  sprintf(buf, "index=%d max_index=%d\n", i, j);
35  hoc_execerror("Matrix index out of range:", buf);
36  }
37 }
38 
39 static void check_capac(int i, int j) {
40  if (i != j) {
41  hoc_execerror("wrong size for Matrix or Vector operation", 0);
42  }
43 }
44 
46  Object* ob = *hoc_objgetarg(i);
47  if (!ob || ob->ctemplate != smat_->u.ctemplate) {
48  check_obj_type(ob, "Matrix");
49  }
50  return (Matrix*)(ob->u.this_pointer);
51 }
52 
54  Matrix* m = (Matrix*)this;
55  Object** po;
56  if (m->obj_) {
57  po = hoc_temp_objptr(m->obj_);
58  }else{
59  po = hoc_temp_objvar(smat_, (void*)m);
60  obj_ = *po;
61  }
62  return po;
63 }
64 
65 static double m_nrow(void* v) {
66  hoc_return_type_code = 1; // integer
67  Matrix* m = (Matrix*)v;
68  return (double)m->nrow();
69 }
70 
71 static double m_ncol(void* v) {
72  hoc_return_type_code = 1; // integer
73  Matrix* m = (Matrix*)v;
74  return (double)m->ncol();
75 }
76 
77 static double m_setval(void* v) {
78  Matrix* m = (Matrix*)v;
79  int i, j;
80  double val, *pval;
81  i = (int)chkarg(1, 0, m->nrow()-1);
82  j = (int)chkarg(2, 0, m->ncol()-1);
83  val = *getarg(3);
84  pval =m->mep(i, j);
85  *pval = val;
86  return val;
87 }
88 
89 static double m_getval(void* v) {
90  Matrix* m = (Matrix*)v;
91  int i, j;
92  i = (int)chkarg(1, 0, m->nrow()-1);
93  j = (int)chkarg(2, 0, m->ncol()-1);
94  return m->getval(i, j);
95 }
96 
97 static double m_sprowlen(void* v) {
98  Matrix* m = (Matrix*)v;
99  int i;
100  hoc_return_type_code = 1; // integer
101  i = (int)chkarg(1, 0, m->nrow()-1);
102  return double(m->sprowlen(i));
103 }
104 
105 static double m_spgetrowval(void* v) {
106  Matrix* m = (Matrix*)v;
107  int i, jx, j;
108  double x;
109  i = (int)chkarg(1, 0, m->nrow()-1);
110  jx = (int)chkarg(2, 0, m->sprowlen(i)-1);
111  x = m->spgetrowval(i, jx, &j);
112  if (ifarg(3)) {
113  *hoc_pgetarg(3) = double(j);
114  }
115  return x;
116 }
117 
118 static double m_printf(void* v) {
119  Matrix* m = (Matrix*)v;
120  int i, j, nrow = m->nrow(), ncol = m->ncol();
121  const char* f1 = " %-8.3g";
122  const char* f2 = "\n";
123  if (ifarg(1)) {
124  f1 = gargstr(1);
125  }
126  if (ifarg(2)) {
127  f2 = gargstr(2);
128  }
129  for (i=0; i < nrow; ++i) {
130  for (j=0; j < ncol; ++j) {
131  Printf(f1, m->getval(i, j));
132  }
133  Printf("%s", f2);
134  }
135  return 0.;
136 }
137 
138 static double m_fprint(void* v) {
139  Matrix* m = (Matrix*)v;
140  int i, j, nrow = m->nrow(), ncol = m->ncol();
141  int ia = 1;
142  bool pr_size = true;
143  const char* f1 = " %-8.3g";
144  const char* f2 = "\n";
145  if (hoc_is_double_arg(ia)) {
146  pr_size = ((int)chkarg(ia, 0, 1) == 1) ? true : false;
147  ++ia;
148  }
149  FILE* f = hoc_obj_file_arg(ia);
150  if (ifarg(ia+1)) {
151  f1 = gargstr(ia+1);
152  }
153  if (ifarg(ia+2)) {
154  f2 = gargstr(ia+2);
155  }
156  if (pr_size) {
157  fprintf(f, "%d %d\n", nrow, ncol);
158  }
159  for (i=0; i < nrow; ++i) {
160  for (j=0; j < ncol; ++j) {
161  fprintf(f, f1, m->getval(i, j));
162  }
163  fprintf(f, "%s", f2);
164  }
165  return 0.;
166 }
167 
168 static double m_scanf(void* v) {
169  // file assumed to be an array of numbers. Numbers in rows
170  // are contiguous in the stream.
171  // first two numbers are nrow and ncol unless
172  // arguments 2 and 3 specify them
173  Matrix* m = (Matrix*)v;
174  FILE* f = hoc_obj_file_arg(1);
175  int i, j, nrow, ncol;
176  if (ifarg(2)) {
177  nrow = (int)chkarg(2, 1, 1e9);
178  ncol = (int)chkarg(3, 1, 1e9);
179  }else{
180  nrow = (int)hoc_scan(f);
181  ncol = (int)hoc_scan(f);
182  }
183  m->resize(nrow, ncol);
184  for (i=0; i < nrow; ++i) for (j=0; j < ncol; ++j) {
185  *(m->mep(i, j)) = hoc_scan(f);
186  }
187  return 0.;
188 }
189 
190 static Object** m_resize(void* v) {
191  Matrix* m = (Matrix*)v;
192  m->resize((int)(chkarg(1, 1., 1e9) + EPS), (int)(chkarg(2, 1., 1e9) + EPS));
193  return m->temp_objvar();
194 }
195 
196 static Object** m_mulv(void* v) {
197  Matrix* m = (Matrix*)v;
198  Vect* vin = vector_arg(1);
199  Vect* vout;
200  bool f = false;
201  if (ifarg(2)) {
202  vout = vector_arg(2);
203  }else{
204 #ifdef WIN32
205  vout = vector_new1(m->nrow());
206 #else
207  vout = new Vect(m->nrow());
208 #endif
209  }
210  if (vin == vout) {
211  f = true;
212 #ifdef WIN32
213  vin = vector_new2(vin);
214 #else
215  vin = new Vect(*vin);
216 #endif
217  }
218 #ifdef WIN32
219  check_capac(vector_capacity(vin), m->ncol());
220  vector_resize(vout, m->nrow());
221 #else
222  check_capac(vin->size(), m->ncol());
223  vout->resize(m->nrow());
224 #endif
225  m->mulv(vin, vout);
226  if (f) {
227 #ifdef WIN32
228  vector_delete(vin);
229 #else
230  delete vin;
231 #endif
232  }
233 #ifdef WIN32
234  return vector_temp_objvar(vout);
235 #else
236  return vout->temp_objvar();
237 #endif
238 }
239 
240 
241 static Matrix* get_out_mat(Matrix* mat, int n, int m, int i, const char* mes = NULL);
242 
243 static Matrix* get_out_mat(Matrix* mat, int n, int m, int i, const char* mes) {
244  Matrix* out;
245  if (ifarg(i)) {
246  out = matrix_arg(i);
247  }else{
248  out = Matrix::instance(n, m, Matrix::MFULL);
249  out->obj_ = NULL;
250  }
251  if (mat == out && mes) {
252  hoc_execerror(mes, " matrix operation cannot be done in place");
253  }
254  return out;
255 }
256 
257 static Matrix* get_out_mat(Matrix* m, int i , const char* mes = NULL) {
258  return get_out_mat(m, m->nrow(), m->ncol(), i, mes);
259 }
260 
261 static Object** m_add(void* v) {
262  Matrix* m = (Matrix*)v;
263  Matrix *out;
264  out = m;
265  if (ifarg(2)) {
266  out = matrix_arg(2);
267  }
268  m->add(matrix_arg(1), out);
269  return out->temp_objvar();
270 }
271 
272 static Object** m_bcopy(void* v) {
273  Matrix* m = (Matrix*)v;
274  Matrix* out;
275  int i0, j0, m0, n0, i1, j1, i;
276  i0 = (int)chkarg(1, 0, m->nrow()-1);
277  j0 = (int)chkarg(2, 0, m->ncol()-1);
278  m0 = (int)chkarg(3, 1, m->nrow()-i0);
279  n0 = (int)chkarg(4, 1, m->ncol()-j0);
280  if (ifarg(5) && hoc_is_double_arg(5)) {
281  i1 = (int)chkarg(5, 0, 1e9);
282  j1 = (int)chkarg(6, 0, 1e9);
283  i = 7;
284  }else{
285  i1 = 0;
286  j1 = 0;
287  i = 5;
288  }
289  out = get_out_mat(m, m0, n0, i);
290  m->bcopy(out, i0, j0, m0, n0, i1, j1);
291  return out->temp_objvar();
292 }
293 
294 static Object** m_mulm(void* v) {
295  Matrix* m = (Matrix*)v;
296  Matrix* in, *out;
297  in = matrix_arg(1);
298  if (ifarg(2)) {
299  out = matrix_arg(2);
300  }else{
301  out = Matrix::instance(m->nrow(), in->ncol(), Matrix::MFULL);
302  }
303  if (in == out || m == out) {
304  hoc_execerror("matrix multiplication cannot be done in place", 0);
305  }
306  out->resize(m->nrow(), in->ncol());
307  check_domain(m->ncol(), in->nrow());
308  m->mulm(in, out);
309  return out->temp_objvar();
310 }
311 
312 static Object** m_c(void* v) {
313  Matrix* m = (Matrix*)v;
314  Matrix* out = get_out_mat(m, 1);
315  m->copy(out);
316  return out->temp_objvar();
317 }
318 
319 static Object** m_transpose(void* v) {
320  Matrix* m = (Matrix*)v;
321  Matrix* out = get_out_mat(m, 1);
322  out->resize(m->ncol(), m->nrow());
323  m->transpose(out);
324  return out->temp_objvar();
325 }
326 
327 static Object** m_symmeig(void* v) {
328  Matrix* m = (Matrix*)v;
329  Matrix* out = matrix_arg(1);
330  Object** p;
331  out->resize(m->nrow(), m->ncol());
332  Vect* vout;
333 #ifdef WIN32
334  vout = vector_new1(m->nrow());
335  p = vector_temp_objvar(vout);
336 #else
337  vout = new Vect(m->nrow());
338  p = vout->temp_objvar();
339 #endif
340  m->symmeigen(out, vout);
341  return p;
342 }
343 
344 static Object** m_svd(void* vv) {
345  Matrix* m = (Matrix*)vv;
346  Matrix *u=NULL, *v=NULL;
347  if (ifarg(2)) {
348  u = matrix_arg(1);
349  v = matrix_arg(2);
350  u->resize(m->nrow(), m->nrow());
351  v->resize(m->ncol(), m->ncol());
352  }
353  Object** p;
354  Vect* d;
355  int dsize = m->nrow() < m->ncol() ? m->nrow() : m->ncol();
356 #ifdef WIN32
357  d = vector_new1(dsize);
358  p = vector_temp_objvar(d);
359 #else
360  d = new Vect(dsize);
361  p = d->temp_objvar();
362 #endif
363  m->svd1(u, v, d);
364  return p;
365 }
366 
367 static Object** m_muls(void* v) {
368  Matrix* m = (Matrix*)v;
369  Matrix *out;
370  out = m;
371  if (ifarg(2)) {
372  out = matrix_arg(2);
373  }
374 // I believe meschach does this for us
375 // if (out != m) {
376 // out->resize(...
377 // }
378  m->muls(*getarg(1), out);
379  return out->temp_objvar();
380 }
381 
382 static Object** m_getrow(void* v) {
383  Matrix* m = (Matrix*)v;
384  int k = (int)chkarg(1, 0, m->nrow()-1);
385  Vect* vout;
386  if (ifarg(2)) {
387  vout = vector_arg(2);
388 #ifdef WIN32
389  vector_resize(vout, m->ncol());
390 #else
391  vout->resize(m->ncol());
392 #endif
393  }else{
394 #ifdef WIN32
395  vout = vector_new1(m->ncol());
396 #else
397  vout = new Vect(m->ncol());
398 #endif
399  }
400  m->getrow(k, vout);
401 #ifdef WIN32
402  return vector_temp_objvar(vout);
403 #else
404  return vout->temp_objvar();
405 #endif
406 }
407 
408 static Object** m_getcol(void* v) {
409  Matrix* m = (Matrix*)v;
410  int k = (int)chkarg(1, 0, m->ncol()-1);
411  Vect* vout;
412  if (ifarg(2)) {
413  vout = vector_arg(2);
414 #ifdef WIN32
415  vector_resize(vout, m->nrow());
416 #else
417  vout->resize(m->nrow());
418 #endif
419  }else{
420 #ifdef WIN32
421  vout = vector_new1(m->nrow());
422 #else
423  vout = new Vect(m->nrow());
424 #endif
425  }
426  m->getcol(k, vout);
427 #ifdef WIN32
428  return vector_temp_objvar(vout);
429 #else
430  return vout->temp_objvar();
431 #endif
432 }
433 
434 static Object** m_setrow(void* v) {
435  Matrix* m = (Matrix*)v;
436  int k = (int)chkarg(1, 0, m->nrow()-1);
437  if (hoc_is_double_arg(2)) {
438  m->setrow(k, *getarg(2));
439  }else{
440  Vect* in = vector_arg(2);
441 #ifdef WIN32
442  check_domain(vector_capacity(in), m->ncol());
443 #else
444  check_domain(in->size(), m->ncol());
445 #endif
446  m->setrow(k, in);
447  }
448  return m->temp_objvar();
449 }
450 
451 static Object** m_setcol(void* v) {
452  Matrix* m = (Matrix*)v;
453  int k = (int)chkarg(1, 0, m->ncol()-1);
454  if (hoc_is_double_arg(2)) {
455  m->setcol(k, *getarg(2));
456  }else{
457  Vect* in = vector_arg(2);
458 #ifdef WIN32
459  check_domain(vector_capacity(in), m->nrow());
460 #else
461  check_domain(in->size(), m->nrow());
462 #endif
463  m->setcol(k, in);
464  }
465  return m->temp_objvar();
466 }
467 
468 static Object** m_setdiag(void* v) {
469  Matrix* m = (Matrix*)v;
470  int k = (int)chkarg(1, -(m->nrow() - 1), m->ncol()-1);
471  if (hoc_is_double_arg(2)) {
472  m->setdiag(k, *getarg(2));
473  }else{
474  Vect* in = vector_arg(2);
475 #ifdef WIN32
476  check_domain(vector_capacity(in), m->nrow());
477 #else
478  check_domain(in->size(), m->nrow());
479 #endif
480  m->setdiag(k, in);
481  }
482  return m->temp_objvar();
483 }
484 
485 static Object** m_getdiag(void* v) {
486  Matrix* m = (Matrix*)v;
487  int k = (int)chkarg(1, -(m->nrow()-1), m->ncol()-1);
488  Vect* vout;
489  if (ifarg(2)) {
490  vout = vector_arg(2);
491 #ifdef WIN32
492  vector_resize(vout, m->nrow());
493 #else
494  vout->resize(m->nrow());
495 #endif
496  }else{
497 #ifdef WIN32
498  vout = vector_new1(m->nrow());
499 #else
500  vout = new Vect(m->nrow());
501 #endif
502  }
503  m->getdiag(k, vout);
504 #ifdef WIN32
505  return vector_temp_objvar(vout);
506 #else
507  return vout->temp_objvar();
508 #endif
509 }
510 
511 static Object** m_zero(void* v) {
512  Matrix* m = (Matrix*)v;
513  m->zero();
514  return m->temp_objvar();
515 }
516 
517 static Object** m_ident(void* v) {
518  Matrix* m = (Matrix*)v;
519  m->ident();
520  return m->temp_objvar();
521 }
522 
523 static Object** m_exp(void* v) {
524  Matrix* m = (Matrix*)v;
525  Matrix* out = get_out_mat(m, 1, "exponentiation");
526  m->exp(out);
527  return out->temp_objvar();
528 }
529 
530 static Object** m_pow(void* v) {
531  Matrix* m = (Matrix*)v;
532  int k = (int)chkarg(1, 0., 100.);
533  Matrix* out = get_out_mat(m, 2, "raising to a power");
534  m->pow(k, out);
535  return out->temp_objvar();
536 }
537 
538 static Object** m_inverse(void* v) {
539  Matrix* m = (Matrix*)v;
540  Matrix* out = get_out_mat(m, 1);
541  m->inverse(out);
542  return out->temp_objvar();
543 }
544 
545 static double m_det(void* v) {
546  Matrix* m = (Matrix*)v;
547  int e;
548  double a = m->det(&e);
549  double* pe = hoc_pgetarg(1);
550  *pe = double(e);
551  return a;
552 }
553 
554 static Object** m_solv(void* v) {
555  Matrix* m = (Matrix*)v;
556  check_capac(m->nrow(), m->ncol());
557  Vect* vin = vector_arg(1);
558 #ifdef WIN32
559  check_capac(vector_capacity(vin), m->ncol());
560 #else
561  check_capac(vin->size(), m->ncol());
562 #endif
563  Vect* vout = NULL;
564  bool f = false;
565  bool use_lu = false;
566  // args 2 and 3 are optional [vout, use previous LU factorization]
567  // and in either order
568  for (int i=2; i <=3; ++i) {
569  if (ifarg(i)) {
570  if (hoc_is_object_arg(i)) {
571  if (vout) {
572  }
573  vout = vector_arg(i);
574  }else{
575  use_lu = ((int)(*getarg(i))) ? true : false;
576  }
577  }
578  }
579  if (!vout) {
580 #ifdef WIN32
581  vout = vector_new1(m->nrow());
582 #else
583  vout = new Vect(m->nrow());
584 #endif
585  }
586 #ifdef WIN32
587  vector_resize(vout, m->ncol());
588 #else
589  vout->resize(m->ncol());
590 #endif
591  if (vin == vout) {
592  f = true;
593 #ifdef WIN32
594  vin = vector_new2(vin);
595 #else
596  vin = new Vect(*vin);
597 #endif
598  }
599  m->solv(vin, vout, use_lu);
600  if (f) {
601 #ifdef WIN32
602  vector_delete(vin);
603 #else
604  delete vin;
605 #endif
606  }
607 #ifdef WIN32
608  return vector_temp_objvar(vout);
609 #else
610  return vout->temp_objvar();
611 #endif
612 }
613 
614 static Object** m_set(void* v) {
615  Matrix* m = (Matrix*)v;
616  int i, j, nrow = m->nrow(), ncol = m->ncol();
617  int k;
618  for (k=0, i=0; i < nrow; ++i) {
619  for (j=0; j < ncol; ++j) {
620  *(m->mep(i, j)) = *getarg(++k);
621  }
622  }
623  return m->temp_objvar();
624 }
625 
626 static Object** m_to_vector(void* v) {
627  Matrix* m = (Matrix*)v;
628  Vect* vout;
629  int i, j, k;
630  int nrow = m->nrow();
631  int ncol = m->ncol();
632  if (ifarg(1)) {
633  vout = vector_arg(1);
634  vector_resize(vout, nrow*ncol);
635  }else{
636  vout = vector_new1(nrow*ncol);
637  }
638  k = 0;
639  double* ve = vector_vec(vout);
640  for (j=0; j < ncol; ++j) for (i=0; i < nrow; ++i) {
641  ve[k++] = m->getval(i, j);
642  }
643  return vector_temp_objvar(vout);
644 }
645 
646 static Object** m_from_vector(void* v) {
647  Matrix* m = (Matrix*)v;
648  Vect* vout;
649  int i, j, k;
650  int nrow = m->nrow();
651  int ncol = m->ncol();
652  vout = vector_arg(1);
653  check_capac(nrow*ncol, vector_capacity(vout));
654  k = 0;
655  double* ve = vector_vec(vout);
656  for (j=0; j < ncol; ++j) for (i=0; i < nrow; ++i) {
657  *(m->mep(i, j)) = ve[k++];
658  }
659  return m->temp_objvar();
660 }
661 
662 static Member_func m_members[] = {
663  // returns double scalar
664  "x", m_nrow, // will be changed below
665  "nrow", m_nrow,
666  "ncol", m_ncol,
667  "getval", m_getval,
668  "setval", m_setval,
669  "sprowlen", m_sprowlen,
670  "spgetrowval", m_spgetrowval,
671  "det", m_det,
672 
673  "printf", m_printf,
674  "fprint", m_fprint,
675  "scanf", m_scanf,
676  0, 0
677 };
678 
680  // returns Vector
681  "mulv", m_mulv,
682  "getrow", m_getrow,
683  "getcol", m_getcol,
684  "getdiag", m_getdiag,
685  "solv", m_solv,
686  "symmeig", m_symmeig,
687  "svd", m_svd,
688  // returns Matrix
689  "c", m_c,
690  "add", m_add,
691  "bcopy", m_bcopy,
692  "resize", m_resize,
693  "mulm", m_mulm,
694  "muls", m_muls,
695  "setrow", m_setrow,
696  "setcol", m_setcol,
697  "setdiag", m_setdiag,
698  "zero", m_zero,
699  "ident", m_ident,
700  "exp", m_exp,
701  "pow", m_pow,
702  "inverse", m_inverse,
703  "transpose", m_transpose,
704  "set", m_set,
705  "to_vector", m_to_vector,
706  "from_vector", m_from_vector,
707  0, 0
708 };
709 
710 static void* m_cons(Object* o) {
711  int i=1, j=1, storage_type = Matrix::MFULL;
712  if (ifarg(1)) i = int(chkarg(1, 1, 1e10) + EPS);
713  if (ifarg(2)) j = int(chkarg(2, 1, 1e10) + EPS);
714  if (ifarg(3)) storage_type = int(chkarg(3, 1, 3));
715  Matrix* m = Matrix::instance(i, j, storage_type);
716  m->obj_ = o;
717  return m;
718 }
719 
720 static void m_destruct(void* v) {
721  // supposed to notify freed val array here.
722 //printf("Matrix deleted\n");
723  delete (Matrix*)v;
724 }
725 
726 static void steer_x(void* v) {
727  Matrix* m = (Matrix*)v;
728  int i1, i2;
729  Symbol* s = hoc_spop();
730  i2 = (int)(hoc_xpop() + EPS);
731  i1 = (int)(hoc_xpop() + EPS);
732  check_domain(i1, m->nrow()-1);
733  check_domain(i2, m->ncol()-1);
734  hoc_pushpx(m->mep(i1, i2));
735 }
736 
737 
738 #if WIN32 && !USEMATRIX
739 void Matrix_reg();
740 #endif
741 
742 void Matrix_reg() {
743  class2oc("Matrix", m_cons, m_destruct, m_members, NULL, m_retobj_members, NULL);
744  smat_ = hoc_lookup("Matrix");
745  // now make the x variable an actual double
746  Symbol* sx = hoc_table_lookup("x", smat_->u.ctemplate->symtable);
747  sx->type = VAR;
748  sx->arayinfo = (Arrayinfo *)hoc_Emalloc(sizeof(Arrayinfo) + 2*sizeof(int));
749  sx->arayinfo->refcount = 1;
750  sx->arayinfo->a_varn = NULL;
751  sx->arayinfo->nsub = 2;
752  sx->arayinfo->sub[0] = 1;
753  sx->arayinfo->sub[1] = 1;
754  smat_->u.ctemplate->steer = steer_x;
755 }
756 
o
Definition: seclist.cpp:180
static Matrix * get_out_mat(Matrix *mat, int n, int m, int i, const char *mes=NULL)
Definition: matrix.cpp:243
static Object ** m_getdiag(void *v)
Definition: matrix.cpp:485
#define Printf
Definition: model.h:252
static double m_spgetrowval(void *v)
Definition: matrix.cpp:105
Matrix * matrix_arg(int i)
Definition: matrix.cpp:45
return true
Definition: savstate.cpp:357
Vect * vector_new1(int n)
Definition: ivocvect.cpp:264
static Member_ret_obj_func m_retobj_members[]
Definition: matrix.cpp:679
static Object ** m_c(void *v)
Definition: matrix.cpp:312
#define Vect
Definition: ivocvect.h:14
static Symbol * smat_
Definition: matrix.cpp:12
short type
Definition: model.h:58
int nsub
Definition: hocdec.h:70
static Object ** m_inverse(void *v)
Definition: matrix.cpp:538
static Object ** m_getcol(void *v)
Definition: matrix.cpp:408
int hoc_is_double_arg(int narg)
Definition: code.cpp:733
Symbol * hoc_lookup(const char *)
Symlist * symtable
Definition: hocdec.h:196
void * this_pointer
Definition: hocdec.h:231
size_t p
static double m_ncol(void *v)
Definition: matrix.cpp:71
static Object ** m_solv(void *v)
Definition: matrix.cpp:554
static double m_nrow(void *v)
Definition: matrix.cpp:65
check_obj_type(o, "SectionList")
#define v
Definition: md1redef.h:4
static Object ** m_mulm(void *v)
Definition: matrix.cpp:294
static Object ** m_set(void *v)
Definition: matrix.cpp:614
int hoc_return_type_code
Definition: code.cpp:41
static philox4x32_key_t k
Definition: nrnran123.cpp:11
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
static void steer_x(void *v)
Definition: matrix.cpp:726
static Object ** m_exp(void *v)
Definition: matrix.cpp:523
#define e
Definition: passive0.cpp:24
#define gargstr
Definition: hocdec.h:14
int refcount
Definition: hocdec.h:71
static double m_det(void *v)
Definition: matrix.cpp:545
double * hoc_pgetarg(int narg)
Definition: code.cpp:1604
void(* steer)(void *)
Definition: hocdec.h:208
Vect * vector_new2(Vect *v)
Definition: ivocvect.cpp:265
void vector_delete(Vect *v)
Definition: ivocvect.cpp:266
static Object ** m_add(void *v)
Definition: matrix.cpp:261
Object ** hoc_temp_objvar(Symbol *symtemp, void *v)
Definition: hoc_oop.cpp:503
static void * m_cons(Object *o)
Definition: matrix.cpp:710
static void check_domain(int i, int j)
Definition: matrix.cpp:31
int sub[1]
Definition: hocdec.h:72
Definition: sparse.h:54
int const size_t const size_t n
Definition: nrngsl.h:12
Symbol * hoc_spop(void)
_CONST char * s
Definition: system.cpp:74
static double m_fprint(void *v)
Definition: matrix.cpp:138
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
Definition: hoc_oop.cpp:1581
int val
Definition: dll.cpp:167
static double m_printf(void *v)
Definition: matrix.cpp:118
Arrayinfo * arayinfo
Definition: hocdec.h:158
void Matrix_reg()
Definition: matrix.cpp:742
int
Definition: nrnmusic.cpp:71
static Object ** m_to_vector(void *v)
Definition: matrix.cpp:626
static Object ** m_svd(void *vv)
Definition: matrix.cpp:344
double hoc_xpop(void)
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:741
size_t j
fprintf(stderr, "Don't know the location of params at %p\, pp)
Definition: model.h:57
static Object ** m_bcopy(void *v)
Definition: matrix.cpp:272
char * name
Definition: init.cpp:16
static Object ** m_pow(void *v)
Definition: matrix.cpp:530
static void m_destruct(void *v)
Definition: matrix.cpp:720
static Object ** m_setrow(void *v)
Definition: matrix.cpp:434
int ifarg(int)
Definition: code.cpp:1562
void vector_resize(Vect *v, int n)
Definition: ivocvect.cpp:269
double hoc_scan(FILE *)
Definition: fileio.cpp:363
static double m_sprowlen(void *v)
Definition: matrix.cpp:97
static Object ** m_mulv(void *v)
Definition: matrix.cpp:196
Vect * vector_arg(int i)
Definition: ivocvect.cpp:332
int vector_capacity(Vect *v)
Definition: ivocvect.cpp:268
static double m_scanf(void *v)
Definition: matrix.cpp:168
static Object ** m_muls(void *v)
Definition: matrix.cpp:367
Definition: hocdec.h:226
HocStruct cTemplate * ctemplate
Definition: hocdec.h:151
static Object ** m_resize(void *v)
Definition: matrix.cpp:190
#define getarg
Definition: hocdec.h:15
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:60
static Object ** temp_objvar(const char *name, void *v, Object **obp)
Definition: kschan.cpp:328
static Object ** m_transpose(void *v)
Definition: matrix.cpp:319
#define i
Definition: md1redef.h:12
static Object ** m_zero(void *v)
Definition: matrix.cpp:511
double * vector_vec(Vect *v)
Definition: ivocvect.cpp:271
static Object ** m_from_vector(void *v)
Definition: matrix.cpp:646
FILE * hoc_obj_file_arg(int i)
Definition: ocfile.cpp:56
char buf[512]
Definition: init.cpp:13
void hoc_pushpx(double *d)
Definition: code.cpp:702
int hoc_is_object_arg(int narg)
Definition: code.cpp:745
Object ** vector_temp_objvar(Vect *v)
Definition: ivocvect.cpp:270
union Symbol::@18 u
union Object::@54 u
Object ** hoc_temp_objptr(Object *)
Definition: code.cpp:209
static Object ** m_getrow(void *v)
Definition: matrix.cpp:382
static Object ** m_setdiag(void *v)
Definition: matrix.cpp:468
static double m_getval(void *v)
Definition: matrix.cpp:89
Object ** hoc_objgetarg(int)
Definition: code.cpp:1568
#define pval
Definition: md1redef.h:32
unsigned * a_varn
Definition: hocdec.h:69
static Object ** m_symmeig(void *v)
Definition: matrix.cpp:327
#define EPS
Definition: matrix.cpp:11
return NULL
Definition: cabcode.cpp:461
double chkarg(int, double low, double high)
Definition: code2.cpp:608
static void check_capac(int i, int j)
Definition: matrix.cpp:39
MatrixPtr Matrix
Definition: sputils.c:601
Definition: matrix.h:73
void * hoc_Emalloc(size_t size)
Definition: symbol.cpp:194
static Object ** m_ident(void *v)
Definition: matrix.cpp:517
static double m_setval(void *v)
Definition: matrix.cpp:77
static Object ** m_setcol(void *v)
Definition: matrix.cpp:451
static Member_func m_members[]
Definition: matrix.cpp:662