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)
185  for (j = 0; j < ncol; ++j) {
186  *(m->mep(i, j)) = hoc_scan(f);
187  }
188  return 0.;
189 }
190 
191 static Object** m_resize(void* v) {
192  Matrix* m = (Matrix*) v;
193  m->resize((int) (chkarg(1, 1., 1e9) + EPS), (int) (chkarg(2, 1., 1e9) + EPS));
194  return m->temp_objvar();
195 }
196 
197 static Object** m_mulv(void* v) {
198  Matrix* m = (Matrix*) v;
199  Vect* vin = vector_arg(1);
200  Vect* vout;
201  bool f = false;
202  if (ifarg(2)) {
203  vout = vector_arg(2);
204  } else {
205 #ifdef WIN32
206  vout = vector_new1(m->nrow());
207 #else
208  vout = new Vect(m->nrow());
209 #endif
210  }
211  if (vin == vout) {
212  f = true;
213 #ifdef WIN32
214  vin = vector_new2(vin);
215 #else
216  vin = new Vect(*vin);
217 #endif
218  }
219 #ifdef WIN32
220  check_capac(vector_capacity(vin), m->ncol());
221  vector_resize(vout, m->nrow());
222 #else
223  check_capac(vin->size(), m->ncol());
224  vout->resize(m->nrow());
225 #endif
226  m->mulv(vin, vout);
227  if (f) {
228 #ifdef WIN32
229  vector_delete(vin);
230 #else
231  delete vin;
232 #endif
233  }
234 #ifdef WIN32
235  return vector_temp_objvar(vout);
236 #else
237  return vout->temp_objvar();
238 #endif
239 }
240 
241 
242 static Matrix* get_out_mat(Matrix* mat, int n, int m, int i, const char* mes = NULL);
243 
244 static Matrix* get_out_mat(Matrix* mat, int n, int m, int i, const char* mes) {
245  Matrix* out;
246  if (ifarg(i)) {
247  out = matrix_arg(i);
248  } else {
249  out = Matrix::instance(n, m, Matrix::MFULL);
250  out->obj_ = NULL;
251  }
252  if (mat == out && mes) {
253  hoc_execerror(mes, " matrix operation cannot be done in place");
254  }
255  return out;
256 }
257 
258 static Matrix* get_out_mat(Matrix* m, int i, const char* mes = NULL) {
259  return get_out_mat(m, m->nrow(), m->ncol(), i, mes);
260 }
261 
262 static Object** m_add(void* v) {
263  Matrix* m = (Matrix*) v;
264  Matrix* out;
265  out = m;
266  if (ifarg(2)) {
267  out = matrix_arg(2);
268  }
269  m->add(matrix_arg(1), out);
270  return out->temp_objvar();
271 }
272 
273 static Object** m_bcopy(void* v) {
274  Matrix* m = (Matrix*) v;
275  Matrix* out;
276  int i0, j0, m0, n0, i1, j1, i;
277  i0 = (int) chkarg(1, 0, m->nrow() - 1);
278  j0 = (int) chkarg(2, 0, m->ncol() - 1);
279  m0 = (int) chkarg(3, 1, m->nrow() - i0);
280  n0 = (int) chkarg(4, 1, m->ncol() - j0);
281  if (ifarg(5) && hoc_is_double_arg(5)) {
282  i1 = (int) chkarg(5, 0, 1e9);
283  j1 = (int) chkarg(6, 0, 1e9);
284  i = 7;
285  } else {
286  i1 = 0;
287  j1 = 0;
288  i = 5;
289  }
290  out = get_out_mat(m, m0, n0, i);
291  m->bcopy(out, i0, j0, m0, n0, i1, j1);
292  return out->temp_objvar();
293 }
294 
295 static Object** m_mulm(void* v) {
296  Matrix* m = (Matrix*) v;
297  Matrix *in, *out;
298  in = matrix_arg(1);
299  if (ifarg(2)) {
300  out = matrix_arg(2);
301  } else {
302  out = Matrix::instance(m->nrow(), in->ncol(), Matrix::MFULL);
303  }
304  if (in == out || m == out) {
305  hoc_execerror("matrix multiplication cannot be done in place", 0);
306  }
307  out->resize(m->nrow(), in->ncol());
308  check_domain(m->ncol(), in->nrow());
309  m->mulm(in, out);
310  return out->temp_objvar();
311 }
312 
313 static Object** m_c(void* v) {
314  Matrix* m = (Matrix*) v;
315  Matrix* out = get_out_mat(m, 1);
316  m->copy(out);
317  return out->temp_objvar();
318 }
319 
320 static Object** m_transpose(void* v) {
321  Matrix* m = (Matrix*) v;
322  Matrix* out = get_out_mat(m, 1);
323  out->resize(m->ncol(), m->nrow());
324  m->transpose(out);
325  return out->temp_objvar();
326 }
327 
328 static Object** m_symmeig(void* v) {
329  Matrix* m = (Matrix*) v;
330  Matrix* out = matrix_arg(1);
331  Object** p;
332  out->resize(m->nrow(), m->ncol());
333  Vect* vout;
334 #ifdef WIN32
335  vout = vector_new1(m->nrow());
336  p = vector_temp_objvar(vout);
337 #else
338  vout = new Vect(m->nrow());
339  p = vout->temp_objvar();
340 #endif
341  m->symmeigen(out, vout);
342  return p;
343 }
344 
345 static Object** m_svd(void* vv) {
346  Matrix* m = (Matrix*) vv;
347  Matrix *u = NULL, *v = NULL;
348  if (ifarg(2)) {
349  u = matrix_arg(1);
350  v = matrix_arg(2);
351  u->resize(m->nrow(), m->nrow());
352  v->resize(m->ncol(), m->ncol());
353  }
354  Object** p;
355  Vect* d;
356  int dsize = m->nrow() < m->ncol() ? m->nrow() : m->ncol();
357 #ifdef WIN32
358  d = vector_new1(dsize);
359  p = vector_temp_objvar(d);
360 #else
361  d = new Vect(dsize);
362  p = d->temp_objvar();
363 #endif
364  m->svd1(u, v, d);
365  return p;
366 }
367 
368 static Object** m_muls(void* v) {
369  Matrix* m = (Matrix*) v;
370  Matrix* out;
371  out = m;
372  if (ifarg(2)) {
373  out = matrix_arg(2);
374  }
375  // I believe meschach does this for us
376  // if (out != m) {
377  // out->resize(...
378  // }
379  m->muls(*getarg(1), out);
380  return out->temp_objvar();
381 }
382 
383 static Object** m_getrow(void* v) {
384  Matrix* m = (Matrix*) v;
385  int k = (int) chkarg(1, 0, m->nrow() - 1);
386  Vect* vout;
387  if (ifarg(2)) {
388  vout = vector_arg(2);
389 #ifdef WIN32
390  vector_resize(vout, m->ncol());
391 #else
392  vout->resize(m->ncol());
393 #endif
394  } else {
395 #ifdef WIN32
396  vout = vector_new1(m->ncol());
397 #else
398  vout = new Vect(m->ncol());
399 #endif
400  }
401  m->getrow(k, vout);
402 #ifdef WIN32
403  return vector_temp_objvar(vout);
404 #else
405  return vout->temp_objvar();
406 #endif
407 }
408 
409 static Object** m_getcol(void* v) {
410  Matrix* m = (Matrix*) v;
411  int k = (int) chkarg(1, 0, m->ncol() - 1);
412  Vect* vout;
413  if (ifarg(2)) {
414  vout = vector_arg(2);
415 #ifdef WIN32
416  vector_resize(vout, m->nrow());
417 #else
418  vout->resize(m->nrow());
419 #endif
420  } else {
421 #ifdef WIN32
422  vout = vector_new1(m->nrow());
423 #else
424  vout = new Vect(m->nrow());
425 #endif
426  }
427  m->getcol(k, vout);
428 #ifdef WIN32
429  return vector_temp_objvar(vout);
430 #else
431  return vout->temp_objvar();
432 #endif
433 }
434 
435 static Object** m_setrow(void* v) {
436  Matrix* m = (Matrix*) v;
437  int k = (int) chkarg(1, 0, m->nrow() - 1);
438  if (hoc_is_double_arg(2)) {
439  m->setrow(k, *getarg(2));
440  } else {
441  Vect* in = vector_arg(2);
442 #ifdef WIN32
443  check_domain(vector_capacity(in), m->ncol());
444 #else
445  check_domain(in->size(), m->ncol());
446 #endif
447  m->setrow(k, in);
448  }
449  return m->temp_objvar();
450 }
451 
452 static Object** m_setcol(void* v) {
453  Matrix* m = (Matrix*) v;
454  int k = (int) chkarg(1, 0, m->ncol() - 1);
455  if (hoc_is_double_arg(2)) {
456  m->setcol(k, *getarg(2));
457  } else {
458  Vect* in = vector_arg(2);
459 #ifdef WIN32
460  check_domain(vector_capacity(in), m->nrow());
461 #else
462  check_domain(in->size(), m->nrow());
463 #endif
464  m->setcol(k, in);
465  }
466  return m->temp_objvar();
467 }
468 
469 static Object** m_setdiag(void* v) {
470  Matrix* m = (Matrix*) v;
471  int k = (int) chkarg(1, -(m->nrow() - 1), m->ncol() - 1);
472  if (hoc_is_double_arg(2)) {
473  m->setdiag(k, *getarg(2));
474  } else {
475  Vect* in = vector_arg(2);
476 #ifdef WIN32
477  check_domain(vector_capacity(in), m->nrow());
478 #else
479  check_domain(in->size(), m->nrow());
480 #endif
481  m->setdiag(k, in);
482  }
483  return m->temp_objvar();
484 }
485 
486 static Object** m_getdiag(void* v) {
487  Matrix* m = (Matrix*) v;
488  int k = (int) chkarg(1, -(m->nrow() - 1), m->ncol() - 1);
489  Vect* vout;
490  if (ifarg(2)) {
491  vout = vector_arg(2);
492 #ifdef WIN32
493  vector_resize(vout, m->nrow());
494 #else
495  vout->resize(m->nrow());
496 #endif
497  } else {
498 #ifdef WIN32
499  vout = vector_new1(m->nrow());
500 #else
501  vout = new Vect(m->nrow());
502 #endif
503  }
504  m->getdiag(k, vout);
505 #ifdef WIN32
506  return vector_temp_objvar(vout);
507 #else
508  return vout->temp_objvar();
509 #endif
510 }
511 
512 static Object** m_zero(void* v) {
513  Matrix* m = (Matrix*) v;
514  m->zero();
515  return m->temp_objvar();
516 }
517 
518 static Object** m_ident(void* v) {
519  Matrix* m = (Matrix*) v;
520  m->ident();
521  return m->temp_objvar();
522 }
523 
524 static Object** m_exp(void* v) {
525  Matrix* m = (Matrix*) v;
526  Matrix* out = get_out_mat(m, 1, "exponentiation");
527  m->exp(out);
528  return out->temp_objvar();
529 }
530 
531 static Object** m_pow(void* v) {
532  Matrix* m = (Matrix*) v;
533  int k = (int) chkarg(1, 0., 100.);
534  Matrix* out = get_out_mat(m, 2, "raising to a power");
535  m->pow(k, out);
536  return out->temp_objvar();
537 }
538 
539 static Object** m_inverse(void* v) {
540  Matrix* m = (Matrix*) v;
541  Matrix* out = get_out_mat(m, 1);
542  m->inverse(out);
543  return out->temp_objvar();
544 }
545 
546 static double m_det(void* v) {
547  Matrix* m = (Matrix*) v;
548  int e;
549  double a = m->det(&e);
550  double* pe = hoc_pgetarg(1);
551  *pe = double(e);
552  return a;
553 }
554 
555 static Object** m_solv(void* v) {
556  Matrix* m = (Matrix*) v;
557  check_capac(m->nrow(), m->ncol());
558  Vect* vin = vector_arg(1);
559 #ifdef WIN32
560  check_capac(vector_capacity(vin), m->ncol());
561 #else
562  check_capac(vin->size(), m->ncol());
563 #endif
564  Vect* vout = NULL;
565  bool f = false;
566  bool use_lu = false;
567  // args 2 and 3 are optional [vout, use previous LU factorization]
568  // and in either order
569  for (int i = 2; i <= 3; ++i) {
570  if (ifarg(i)) {
571  if (hoc_is_object_arg(i)) {
572  if (vout) {
573  }
574  vout = vector_arg(i);
575  } else {
576  use_lu = ((int) (*getarg(i))) ? true : false;
577  }
578  }
579  }
580  if (!vout) {
581 #ifdef WIN32
582  vout = vector_new1(m->nrow());
583 #else
584  vout = new Vect(m->nrow());
585 #endif
586  }
587 #ifdef WIN32
588  vector_resize(vout, m->ncol());
589 #else
590  vout->resize(m->ncol());
591 #endif
592  if (vin == vout) {
593  f = true;
594 #ifdef WIN32
595  vin = vector_new2(vin);
596 #else
597  vin = new Vect(*vin);
598 #endif
599  }
600  m->solv(vin, vout, use_lu);
601  if (f) {
602 #ifdef WIN32
603  vector_delete(vin);
604 #else
605  delete vin;
606 #endif
607  }
608 #ifdef WIN32
609  return vector_temp_objvar(vout);
610 #else
611  return vout->temp_objvar();
612 #endif
613 }
614 
615 static Object** m_set(void* v) {
616  Matrix* m = (Matrix*) v;
617  int i, j, nrow = m->nrow(), ncol = m->ncol();
618  int k;
619  for (k = 0, i = 0; i < nrow; ++i) {
620  for (j = 0; j < ncol; ++j) {
621  *(m->mep(i, j)) = *getarg(++k);
622  }
623  }
624  return m->temp_objvar();
625 }
626 
627 static Object** m_to_vector(void* v) {
628  Matrix* m = (Matrix*) v;
629  Vect* vout;
630  int i, j, k;
631  int nrow = m->nrow();
632  int ncol = m->ncol();
633  if (ifarg(1)) {
634  vout = vector_arg(1);
635  vector_resize(vout, nrow * ncol);
636  } else {
637  vout = vector_new1(nrow * ncol);
638  }
639  k = 0;
640  double* ve = vector_vec(vout);
641  for (j = 0; j < ncol; ++j)
642  for (i = 0; i < nrow; ++i) {
643  ve[k++] = m->getval(i, j);
644  }
645  return vector_temp_objvar(vout);
646 }
647 
648 static Object** m_from_vector(void* v) {
649  Matrix* m = (Matrix*) v;
650  Vect* vout;
651  int i, j, k;
652  int nrow = m->nrow();
653  int ncol = m->ncol();
654  vout = vector_arg(1);
655  check_capac(nrow * ncol, vector_capacity(vout));
656  k = 0;
657  double* ve = vector_vec(vout);
658  for (j = 0; j < ncol; ++j)
659  for (i = 0; i < nrow; ++i) {
660  *(m->mep(i, j)) = ve[k++];
661  }
662  return m->temp_objvar();
663 }
664 
665 static Member_func m_members[] = {
666  // returns double scalar
667  "x", m_nrow, // will be changed below
668  "nrow", m_nrow, "ncol", m_ncol, "getval", m_getval, "setval", m_setval,
669  "sprowlen", m_sprowlen, "spgetrowval", m_spgetrowval, "det", m_det,
670 
671  "printf", m_printf, "fprint", m_fprint, "scanf", m_scanf, 0, 0};
672 
674  // returns Vector
675  "mulv",
676  m_mulv,
677  "getrow",
678  m_getrow,
679  "getcol",
680  m_getcol,
681  "getdiag",
682  m_getdiag,
683  "solv",
684  m_solv,
685  "symmeig",
686  m_symmeig,
687  "svd",
688  m_svd,
689  // returns Matrix
690  "c",
691  m_c,
692  "add",
693  m_add,
694  "bcopy",
695  m_bcopy,
696  "resize",
697  m_resize,
698  "mulm",
699  m_mulm,
700  "muls",
701  m_muls,
702  "setrow",
703  m_setrow,
704  "setcol",
705  m_setcol,
706  "setdiag",
707  m_setdiag,
708  "zero",
709  m_zero,
710  "ident",
711  m_ident,
712  "exp",
713  m_exp,
714  "pow",
715  m_pow,
716  "inverse",
717  m_inverse,
718  "transpose",
719  m_transpose,
720  "set",
721  m_set,
722  "to_vector",
723  m_to_vector,
724  "from_vector",
726  0,
727  0};
728 
729 static void* m_cons(Object* o) {
730  int i = 1, j = 1, storage_type = Matrix::MFULL;
731  if (ifarg(1))
732  i = int(chkarg(1, 1, 1e10) + EPS);
733  if (ifarg(2))
734  j = int(chkarg(2, 1, 1e10) + EPS);
735  if (ifarg(3))
736  storage_type = int(chkarg(3, 1, 3));
737  Matrix* m = Matrix::instance(i, j, storage_type);
738  m->obj_ = o;
739  return m;
740 }
741 
742 static void m_destruct(void* v) {
743  // supposed to notify freed val array here.
744  // printf("Matrix deleted\n");
745  delete (Matrix*) v;
746 }
747 
748 static void steer_x(void* v) {
749  Matrix* m = (Matrix*) v;
750  int i1, i2;
751  Symbol* s = hoc_spop();
752  i2 = (int) (hoc_xpop() + EPS);
753  i1 = (int) (hoc_xpop() + EPS);
754  check_domain(i1, m->nrow() - 1);
755  check_domain(i2, m->ncol() - 1);
756  hoc_pushpx(m->mep(i1, i2));
757 }
758 
759 
760 #if WIN32 && !USEMATRIX
761 void Matrix_reg();
762 #endif
763 
764 void Matrix_reg() {
766  smat_ = hoc_lookup("Matrix");
767  // now make the x variable an actual double
769  sx->type = VAR;
770  sx->arayinfo = (Arrayinfo*) hoc_Emalloc(sizeof(Arrayinfo) + 2 * sizeof(int));
771  sx->arayinfo->refcount = 1;
772  sx->arayinfo->a_varn = NULL;
773  sx->arayinfo->nsub = 2;
774  sx->arayinfo->sub[0] = 1;
775  sx->arayinfo->sub[1] = 1;
777 }
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:61
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
double chkarg(int, double low, double high)
Definition: code2.cpp:638
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:754
char buf[512]
Definition: init.cpp:13
int hoc_is_object_arg(int narg)
Definition: code.cpp:756
Object ** hoc_temp_objvar(Symbol *symtemp, void *v)
Definition: hoc_oop.cpp:491
void hoc_pushpx(double *d)
Definition: code.cpp:716
int hoc_is_double_arg(int narg)
Definition: code.cpp:744
Vect * vector_arg(int i)
Definition: ivocvect.cpp:397
Symbol * hoc_lookup(const char *)
Vect * vector_new1(int n)
Definition: ivocvect.cpp:307
double hoc_xpop(void)
double * hoc_pgetarg(int narg)
Definition: code.cpp:1623
Symbol * hoc_spop(void)
#define getarg
Definition: hocdec.h:15
#define gargstr
Definition: hocdec.h:14
Object ** hoc_objgetarg(int)
Definition: code.cpp:1587
int ifarg(int)
Definition: code.cpp:1581
Object ** vector_temp_objvar(Vect *v)
Definition: ivocvect.cpp:325
int vector_capacity(Vect *v)
Definition: ivocvect.cpp:319
void vector_resize(Vect *v, int n)
Definition: ivocvect.cpp:322
Vect * vector_new2(Vect *v)
Definition: ivocvect.cpp:310
double * vector_vec(Vect *v)
Definition: ivocvect.cpp:328
void vector_delete(Vect *v)
Definition: ivocvect.cpp:313
#define Vect
Definition: ivocvect.h:14
static Object ** temp_objvar(const char *name, void *v, Object **obp)
Definition: kschan.cpp:317
static double m_fprint(void *v)
Definition: matrix.cpp:138
void Matrix_reg()
Definition: matrix.cpp:764
static double m_printf(void *v)
Definition: matrix.cpp:118
static double m_scanf(void *v)
Definition: matrix.cpp:168
static void * m_cons(Object *o)
Definition: matrix.cpp:729
static void m_destruct(void *v)
Definition: matrix.cpp:742
static void steer_x(void *v)
Definition: matrix.cpp:748
static double m_det(void *v)
Definition: matrix.cpp:546
static Member_func m_members[]
Definition: matrix.cpp:665
static Object ** m_pow(void *v)
Definition: matrix.cpp:531
static Object ** m_symmeig(void *v)
Definition: matrix.cpp:328
static Matrix * get_out_mat(Matrix *mat, int n, int m, int i, const char *mes=NULL)
Definition: matrix.cpp:244
static Object ** m_getcol(void *v)
Definition: matrix.cpp:409
static Object ** m_setcol(void *v)
Definition: matrix.cpp:452
static Object ** m_mulm(void *v)
Definition: matrix.cpp:295
static double m_spgetrowval(void *v)
Definition: matrix.cpp:105
static double m_ncol(void *v)
Definition: matrix.cpp:71
static Object ** m_from_vector(void *v)
Definition: matrix.cpp:648
static Object ** m_zero(void *v)
Definition: matrix.cpp:512
static double m_nrow(void *v)
Definition: matrix.cpp:65
static Object ** m_setrow(void *v)
Definition: matrix.cpp:435
#define EPS
Definition: matrix.cpp:11
static Object ** m_exp(void *v)
Definition: matrix.cpp:524
static Object ** m_getdiag(void *v)
Definition: matrix.cpp:486
static double m_setval(void *v)
Definition: matrix.cpp:77
static Object ** m_getrow(void *v)
Definition: matrix.cpp:383
Object ** hoc_temp_objptr(Object *)
Definition: code.cpp:216
static Object ** m_bcopy(void *v)
Definition: matrix.cpp:273
static Symbol * smat_
Definition: matrix.cpp:12
static Object ** m_setdiag(void *v)
Definition: matrix.cpp:469
static double m_sprowlen(void *v)
Definition: matrix.cpp:97
static Object ** m_set(void *v)
Definition: matrix.cpp:615
static Object ** m_solv(void *v)
Definition: matrix.cpp:555
int hoc_return_type_code
Definition: code.cpp:42
FILE * hoc_obj_file_arg(int i)
Definition: ocfile.cpp:56
static Object ** m_to_vector(void *v)
Definition: matrix.cpp:627
static void check_domain(int i, int j)
Definition: matrix.cpp:31
static Object ** m_c(void *v)
Definition: matrix.cpp:313
static Object ** m_ident(void *v)
Definition: matrix.cpp:518
static Object ** m_mulv(void *v)
Definition: matrix.cpp:197
static Object ** m_svd(void *vv)
Definition: matrix.cpp:345
Matrix * matrix_arg(int i)
Definition: matrix.cpp:45
static Object ** m_transpose(void *v)
Definition: matrix.cpp:320
static Object ** m_resize(void *v)
Definition: matrix.cpp:191
static Object ** m_muls(void *v)
Definition: matrix.cpp:368
static Object ** m_add(void *v)
Definition: matrix.cpp:262
static void check_capac(int i, int j)
Definition: matrix.cpp:39
double hoc_scan(FILE *)
Definition: fileio.cpp:339
static Object ** m_inverse(void *v)
Definition: matrix.cpp:539
static double m_getval(void *v)
Definition: matrix.cpp:89
static Member_ret_obj_func m_retobj_members[]
Definition: matrix.cpp:673
#define pval
Definition: md1redef.h:32
#define v
Definition: md1redef.h:4
#define i
Definition: md1redef.h:12
#define Printf
Definition: model.h:237
char * name
Definition: init.cpp:16
#define fprintf
Definition: mwprefix.h:30
int const size_t const size_t n
Definition: nrngsl.h:11
size_t p
size_t j
void * hoc_Emalloc(size_t size)
Definition: symbol.cpp:190
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:1560
static philox4x32_key_t k
Definition: nrnran123.cpp:11
#define e
Definition: passive0.cpp:22
check_obj_type(o, "SectionList")
o
Definition: seclist.cpp:175
#define NULL
Definition: sptree.h:16
MatrixPtr Matrix
Definition: sputils.c:601
unsigned * a_varn
Definition: hocdec.h:69
int nsub
Definition: hocdec.h:70
int refcount
Definition: hocdec.h:71
int sub[1]
Definition: hocdec.h:72
Definition: matrix.h:73
Definition: hocdec.h:227
void * this_pointer
Definition: hocdec.h:232
union Object::@39 u
Definition: sparse.h:54
Definition: model.h:57
short type
Definition: model.h:58
union Symbol::@18 u
HocStruct cTemplate * ctemplate
Definition: hocdec.h:152
Arrayinfo * arayinfo
Definition: hocdec.h:159
Symlist * symtable
Definition: hocdec.h:197
void(* steer)(void *)
Definition: hocdec.h:209