NEURON
nvector_nrnthread.cpp
Go to the documentation of this file.
1 /*
2  * -----------------------------------------------------------------
3  * $Revision: 855 $
4  * $Date: 2005-02-09 18:15:46 -0500 (Wed, 09 Feb 2005) $
5  * -----------------------------------------------------------------
6  * Programmer(s): Scott D. Cohen, Alan C. Hindmarsh, Radu Serban,
7  * and Aaron Collier @ LLNL
8  * -----------------------------------------------------------------
9  * Copyright (c) 2002, The Regents of the University of California.
10  * Produced at the Lawrence Livermore National Laboratory.
11  * All rights reserved.
12  * For details, see sundials/shared/LICENSE.
13  * -----------------------------------------------------------------
14  * This is the implementation file for a nrnthread implementation
15  * of the NVECTOR package.
16  * -----------------------------------------------------------------
17  */
18 
19 #include <stdio.h>
20 #include <stdlib.h>
21 
22 #include "shared/nvector_serial.h"
23 #include "nvector_nrnthread.h"
24 #include "shared/sundialsmath.h"
25 #include "shared/sundialstypes.h"
26 #include "section.h"
27 #include "nrnmutdec.h"
28 
29 #define ZERO RCONST(0.0)
30 #define HALF RCONST(0.5)
31 #define ONE RCONST(1.0)
32 #define ONEPT5 RCONST(1.5)
33 
34 #if 0
35 #define mydebug(a) printf(a)
36 #define mydebug2(a, b) printf(a, b)
37 #else
38 #define mydebug(a) /**/
39 #define mydebug2(a, b) /**/
40 #endif
41 
42 #if NRN_ENABLE_THREADS
43 static MUTDEC
44 #endif
45 /* argument passing between NrnThread and Serial */
46 static N_Vector x_;
47 static N_Vector y_;
48 static N_Vector z_;
49 static N_Vector w_;
50 static N_Vector id_;
51 static realtype a_;
52 static realtype b_;
53 static realtype c_;
54 static realtype retval;
55 static booleantype bretval;
56 #define xpass x_ = x;
57 #define ypass y_ = y;
58 #define zpass z_ = z;
59 #define wpass w_ = w;
60 #define idpass id_ = id;
61 #define apass a_ = a;
62 #define bpass b_ = b;
63 #define cpass c_ = c;
64 #define xarg(i) NV_SUBVEC_NT(x_, i)
65 #define yarg(i) NV_SUBVEC_NT(y_, i)
66 #define zarg(i) NV_SUBVEC_NT(z_, i)
67 #define warg(i) NV_SUBVEC_NT(w_, i)
68 #define idarg(i) NV_SUBVEC_NT(id_, i)
69 #define aarg a_
70 #define barg b_
71 #define carg c_
72 #define lock MUTLOCK
73 #define unlock MUTUNLOCK
74 #define lockadd(arg) \
75  lock; \
76  retval += arg; \
77  unlock;
78 #define locklongdadd(arg) lockadd(arg)
79 #define lockmax(arg) \
80  lock; \
81  if (retval < arg) { \
82  retval = arg; \
83  }; \
84  unlock;
85 #define lockmin(arg) \
86  lock; \
87  if (retval > arg) { \
88  retval = arg; \
89  }; \
90  unlock;
91 #define lockfalse \
92  lock; \
93  bretval = FALSE; \
94  unlock;
95 
96 /*
97  * -----------------------------------------------------------------
98  * exported functions
99  * -----------------------------------------------------------------
100  */
101 
102 /* ----------------------------------------------------------------------------
103  * Function to create a new empty nrnthread vector
104  */
105 
106 N_Vector N_VNewEmpty_NrnThread(long int length, int nthread, long int* sizes) {
107  int i;
108  N_Vector v;
109  N_Vector_Ops ops;
111 
112  if (!MUTCONSTRUCTED) {
113  MUTCONSTRUCT(1)
114  }
115 
116  /* Create vector */
117  v = (N_Vector) malloc(sizeof *v);
118  if (v == NULL)
119  return (NULL);
120 
121  /* Create vector operation structure */
122  ops = (N_Vector_Ops) malloc(sizeof(struct _generic_N_Vector_Ops));
123  if (ops == NULL) {
124  free(v);
125  return (NULL);
126  }
127 
128  ops->nvclone = N_VClone_NrnThread;
129  ops->nvdestroy = N_VDestroy_NrnThread;
130  ops->nvspace = N_VSpace_NrnThread;
131  ops->nvgetarraypointer = N_VGetArrayPointer_NrnThread;
132  ops->nvsetarraypointer = N_VSetArrayPointer_NrnThread;
133  ops->nvlinearsum = N_VLinearSum_NrnThread;
134  ops->nvconst = N_VConst_NrnThread;
135  ops->nvprod = N_VProd_NrnThread;
136  ops->nvdiv = N_VDiv_NrnThread;
137  ops->nvscale = N_VScale_NrnThread;
138  ops->nvabs = N_VAbs_NrnThread;
139  ops->nvinv = N_VInv_NrnThread;
140  ops->nvaddconst = N_VAddConst_NrnThread;
141  ops->nvdotprod = N_VDotProd_NrnThread;
142  ops->nvmaxnorm = N_VMaxNorm_NrnThread;
143  ops->nvwrmsnormmask = N_VWrmsNormMask_NrnThread;
144  ops->nvwrmsnorm = N_VWrmsNorm_NrnThread;
145  ops->nvmin = N_VMin_NrnThread;
146  ops->nvwl2norm = N_VWL2Norm_NrnThread;
147  ops->nvl1norm = N_VL1Norm_NrnThread;
148  ops->nvcompare = N_VCompare_NrnThread;
149  ops->nvinvtest = N_VInvTest_NrnThread;
150  ops->nvconstrmask = N_VConstrMask_NrnThread;
151  ops->nvminquotient = N_VMinQuotient_NrnThread;
152 
153  /* Create content */
154  content = (N_VectorContent_NrnThread) malloc(sizeof(struct _N_VectorContent_NrnThread));
155  if (content == NULL) {
156  free(ops);
157  free(v);
158  return (NULL);
159  }
160 
161  content->length = length;
162  content->nt = nthread;
163  content->own_data = FALSE;
164  content->data = (N_Vector*) malloc(sizeof(N_Vector) * nthread);
165  if (content->data == NULL) {
166  free(ops);
167  free(v);
168  free(content);
169  return (NULL);
170  }
171  for (i = 0; i < nthread; ++i) {
172  content->data[i] = NULL;
173  }
174  /* Attach content and ops */
175  v->content = content;
176  v->ops = ops;
177 
178  return (v);
179 }
180 
181 /* ----------------------------------------------------------------------------
182  * Function to create a new nrnthread vector
183  */
184 
185 N_Vector N_VNew_NrnThread(long int length, int nthread, long int* sizes) {
186  int i;
187  N_Vector v;
188  N_Vector data;
189  N_VectorContent_NrnThread* content;
190 
191  v = N_VNewEmpty_NrnThread(length, nthread, sizes);
192  if (v == NULL)
193  return (NULL);
194 
195  /* Create data */
196  if (length > 0) {
197  /* Allocate memory */
198  NV_OWN_DATA_NT(v) = TRUE;
199  for (i = 0; i < nthread; ++i) {
200  data = N_VNew_Serial(sizes[i]);
201  if (data == NULL) {
203  return (NULL);
204  }
205  NV_SUBVEC_NT(v, i) = data;
206  }
207  }
208 
209  return (v);
210 }
211 
212 /* ----------------------------------------------------------------------------
213  * Function to clone from a template a new vector with empty (NULL) data array
214  */
215 
216 N_Vector N_VCloneEmpty_NrnThread(N_Vector w) {
217  int i;
218  N_Vector v;
219  N_Vector_Ops ops;
221  N_VectorContent_NrnThread wcontent;
222 
223  if (w == NULL)
224  return (NULL);
225 
226  /* Create vector */
227  v = (N_Vector) malloc(sizeof *v);
228  if (v == NULL)
229  return (NULL);
230 
231  /* Create vector operation structure */
232  ops = (N_Vector_Ops) malloc(sizeof(struct _generic_N_Vector_Ops));
233  if (ops == NULL) {
234  free(v);
235  return (NULL);
236  }
237 
238  ops->nvclone = w->ops->nvclone;
239  ops->nvdestroy = w->ops->nvdestroy;
240  ops->nvspace = w->ops->nvspace;
241  ops->nvgetarraypointer = w->ops->nvgetarraypointer;
242  ops->nvsetarraypointer = w->ops->nvsetarraypointer;
243  ops->nvlinearsum = w->ops->nvlinearsum;
244  ops->nvconst = w->ops->nvconst;
245  ops->nvprod = w->ops->nvprod;
246  ops->nvdiv = w->ops->nvdiv;
247  ops->nvscale = w->ops->nvscale;
248  ops->nvabs = w->ops->nvabs;
249  ops->nvinv = w->ops->nvinv;
250  ops->nvaddconst = w->ops->nvaddconst;
251  ops->nvdotprod = w->ops->nvdotprod;
252  ops->nvmaxnorm = w->ops->nvmaxnorm;
253  ops->nvwrmsnormmask = w->ops->nvwrmsnormmask;
254  ops->nvwrmsnorm = w->ops->nvwrmsnorm;
255  ops->nvmin = w->ops->nvmin;
256  ops->nvwl2norm = w->ops->nvwl2norm;
257  ops->nvl1norm = w->ops->nvl1norm;
258  ops->nvcompare = w->ops->nvcompare;
259  ops->nvinvtest = w->ops->nvinvtest;
260  ops->nvconstrmask = w->ops->nvconstrmask;
261  ops->nvminquotient = w->ops->nvminquotient;
262 
263  /* Create content */
264  content = (N_VectorContent_NrnThread) malloc(sizeof(struct _N_VectorContent_NrnThread));
265  if (content == NULL) {
266  free(ops);
267  free(v);
268  return (NULL);
269  }
270 
271  wcontent = NV_CONTENT_NT(w);
272  content->length = NV_LENGTH_NT(w);
273  content->own_data = FALSE;
274  content->nt = wcontent->nt;
275  content->data = (N_Vector*) malloc(sizeof(N_Vector) * content->nt);
276  if (content->data == NULL) {
277  free(ops);
278  free(v);
279  free(content);
280  return (NULL);
281  }
282  for (i = 0; i < content->nt; ++i) {
283  content->data[i] = NULL;
284  }
285 
286  /* Attach content and ops */
287  v->content = content;
288  v->ops = ops;
289 
290  return (v);
291 }
292 
293 /* ----------------------------------------------------------------------------
294  * Function to create a nrnthread N_Vector with user data component
295  */
296 
297 N_Vector N_VMake_NrnThread(long int length, realtype* v_data) {
298  N_Vector v = NULL;
299 
300  assert(0);
301 #if 0
302  v = N_VNewEmpty_NrnThread(length);
303  if (v == NULL) return(NULL);
304 
305  if (length > 0) {
306  /* Attach data */
308  NV_DATA_NT(v) = v_data;
309  }
310 
311 #endif
312  return (v);
313 }
314 
315 /* ----------------------------------------------------------------------------
316  * Function to create an array of new nrnthread vectors.
317  */
318 
319 N_Vector* N_VNewVectorArray_NrnThread(int count, long int length, int nthread, long int* sizes) {
320  N_Vector* vs;
321  int j;
322 
323  if (count <= 0)
324  return (NULL);
325 
326  vs = (N_Vector*) malloc(count * sizeof(N_Vector));
327  if (vs == NULL)
328  return (NULL);
329 
330  for (j = 0; j < count; j++) {
331  vs[j] = N_VNew_NrnThread(length, nthread, sizes);
332  if (vs[j] == NULL) {
334  return (NULL);
335  }
336  }
337 
338  return (vs);
339 }
340 
341 /* ----------------------------------------------------------------------------
342  * Function to create an array of new nrnthread vectors with NULL data array.
343  */
344 
346  long int length,
347  int nthread,
348  long int* sizes) {
349  N_Vector* vs;
350  int j;
351 
352  if (count <= 0)
353  return (NULL);
354 
355  vs = (N_Vector*) malloc(count * sizeof(N_Vector));
356  if (vs == NULL)
357  return (NULL);
358 
359  for (j = 0; j < count; j++) {
360  vs[j] = N_VNewEmpty_NrnThread(length, nthread, sizes);
361  if (vs[j] == NULL) {
363  return (NULL);
364  }
365  }
366 
367  return (vs);
368 }
369 
370 /* ----------------------------------------------------------------------------
371  * Function to free an array created with N_VNewVectorArray_NrnThread
372  */
373 
374 void N_VDestroyVectorArray_NrnThread(N_Vector* vs, int count) {
375  int j;
376 
377  for (j = 0; j < count; j++)
378  N_VDestroy_NrnThread(vs[j]);
379 
380  free(vs);
381 }
382 
383 /* ----------------------------------------------------------------------------
384  * Function to print the a nrnthread vector
385  */
386 
387 void N_VPrint_NrnThread(N_Vector x) {
388  int i;
389  int nt;
390 
391  nt = NV_NT_NT(x);
392 
393  for (i = 0; i < nt; i++) {
394  N_VPrint_Serial(NV_SUBVEC_NT(x, i));
395  }
396  printf("\n");
397 }
398 
399 static void pr(N_Vector x) {
401 }
402 /*
403  * -----------------------------------------------------------------
404  * implementation of vector operations
405  * -----------------------------------------------------------------
406  */
407 
408 N_Vector N_VClone_NrnThread(N_Vector w) {
409  N_Vector v;
410  N_Vector wdata;
411  N_Vector data;
412  long int length;
413  int i, nt;
414 
416  if (v == NULL)
417  return (NULL);
418 
419  length = NV_LENGTH_NT(w);
420  nt = NV_NT_NT(w);
421 
422  /* Create data */
423  if (length > 0) {
424  NV_OWN_DATA_NT(v) = TRUE;
425  for (i = 0; i < nt; ++i) {
426  wdata = NV_SUBVEC_NT(w, i);
427  data = N_VClone(wdata);
428  if (data == NULL) {
430  return (NULL);
431  }
432  NV_SUBVEC_NT(v, i) = data;
433  }
434  /* Attach data */
435  }
436 
437  return (v);
438 }
439 
440 void N_VDestroy_NrnThread(N_Vector v) {
441  int i, nt;
442  N_Vector data;
443  nt = NV_NT_NT(v);
444  if (NV_OWN_DATA_NT(v) == TRUE) {
445  if (NV_CONTENT_NT(v)->data) {
446  for (i = 0; i < nt; ++i) {
447  data = NV_SUBVEC_NT(v, i);
448  if (data) {
449  N_VDestroy(data);
450  }
451  }
452  free(NV_CONTENT_NT(v)->data);
453  }
454  }
455  free(v->content);
456  free(v->ops);
457  free(v);
458 }
459 
460 void N_VSpace_NrnThread(N_Vector v, long int* lrw, long int* liw) {
461  *lrw = NV_LENGTH_NT(v);
462  *liw = 1;
463 }
464 
465 /* NOTICE: the pointer returned is actually the NVector* data where
466 data is nthread NVector. so when you get the realtype* cast it back to
467 (NVector*)
468 */
469 realtype* N_VGetArrayPointer_NrnThread(N_Vector v) {
470  N_Vector* v_data;
471  v_data = NV_DATA_NT(v);
472 
473  return ((realtype*) v_data);
474 }
475 
476 void N_VSetArrayPointer_NrnThread(realtype* v_data, N_Vector v) {
477  assert(0);
478 #if 0
479  if (NV_LENGTH_NT(v) > 0) NV_DATA_NT(v) = v_data;
480 #endif
481 }
482 
483 static void* vlinearsum(NrnThread* nt) {
484  int i = nt->id;
485  N_VLinearSum_Serial(aarg, xarg(i), barg, yarg(i), zarg(i));
486  return nullptr;
487 }
488 void N_VLinearSum_NrnThread(realtype a, N_Vector x, realtype b, N_Vector y, N_Vector z) {
490  mydebug("vlinearsum\n");
491  /*pr(z);*/
492 }
493 
494 static void* vconst(NrnThread* nt) {
495  int i = nt->id;
496  N_VConst_Serial(carg, zarg(i));
497  return nullptr;
498 }
499 void N_VConst_NrnThread(realtype c, N_Vector z) {
501  mydebug("vconst\n");
502 }
503 
504 static void* vprod(NrnThread* nt) {
505  int i = nt->id;
506  N_VProd_Serial(xarg(i), yarg(i), zarg(i));
507  return nullptr;
508 }
509 void N_VProd_NrnThread(N_Vector x, N_Vector y, N_Vector z) {
511  mydebug("vprod\n");
512 }
513 
514 static void* vdiv(NrnThread* nt) {
515  int i = nt->id;
516  N_VDiv_Serial(xarg(i), yarg(i), zarg(i));
517  return nullptr;
518 }
519 void N_VDiv_NrnThread(N_Vector x, N_Vector y, N_Vector z) {
521  mydebug("vdiv\n");
522 }
523 
524 static void* vscale(NrnThread* nt) {
525  int i = nt->id;
526  N_VScale_Serial(carg, xarg(i), zarg(i));
527  return nullptr;
528 }
529 void N_VScale_NrnThread(realtype c, N_Vector x, N_Vector z) {
531  mydebug("vscale\n");
532  /*pr(z);*/
533 }
534 
535 static void* vabs(NrnThread* nt) {
536  int i = nt->id;
537  N_VAbs_Serial(xarg(i), zarg(i));
538  return nullptr;
539 }
540 void N_VAbs_NrnThread(N_Vector x, N_Vector z) {
542  mydebug("vabs\n");
543 }
544 
545 static void* vinv(NrnThread* nt) {
546  int i = nt->id;
547  N_VInv_Serial(xarg(i), zarg(i));
548  return nullptr;
549 }
550 void N_VInv_NrnThread(N_Vector x, N_Vector z) {
552  mydebug("vinv\n");
553 }
554 
555 static void* vaddconst(NrnThread* nt) {
556  int i = nt->id;
557  N_VAddConst_Serial(xarg(i), barg, zarg(i));
558  return nullptr;
559 }
560 void N_VAddConst_NrnThread(N_Vector x, realtype b, N_Vector z) {
562  mydebug("vaddconst\n");
563 }
564 
565 static void* vdotprod(NrnThread* nt) {
566  realtype s;
567  int i = nt->id;
568  s = N_VDotProd_Serial(xarg(i), yarg(i));
569  lockadd(s);
570  return nullptr;
571 }
572 realtype N_VDotProd_NrnThread(N_Vector x, N_Vector y) {
573  retval = ZERO;
575  mydebug2("vdotprod %.20g\n", retval);
576  return (retval);
577 }
578 
579 static void* vmaxnorm(NrnThread* nt) {
580  realtype max;
581  int i = nt->id;
582  max = N_VMaxNorm_Serial(xarg(i));
583  lockmax(max);
584  return nullptr;
585 }
586 realtype N_VMaxNorm_NrnThread(N_Vector x) {
587  retval = ZERO;
589  mydebug2("vmaxnorm %.20g\n", retval);
590  return (retval);
591 }
592 
593 
594 static realtype vwrmsnorm_help(N_Vector x, N_Vector w) {
595  long int i, N;
596  realtype sum = ZERO;
597  realtype prodi, *xd, *wd;
598 
599  N = NV_LENGTH_S(x);
600  xd = NV_DATA_S(x);
601  wd = NV_DATA_S(w);
602 
603  for (i = 0; i < N; i++) {
604  prodi = (*xd++) * (*wd++);
605  sum += prodi * prodi;
606  }
607 
608  return (sum);
609 }
610 static void* vwrmsnorm(NrnThread* nt) {
611  realtype s;
612  int i = nt->id;
613  s = vwrmsnorm_help(xarg(i), warg(i));
614  locklongdadd(s);
615  return nullptr;
616 }
617 realtype N_VWrmsNorm_NrnThread(N_Vector x, N_Vector w) {
618  long int N;
619  N = NV_LENGTH_NT(x);
620  retval = ZERO;
622  mydebug2("vwrmsnorm %.20g\n", RSqrt(retval / N));
623  return (RSqrt(retval / N));
624 }
625 
626 static realtype vwrmsnormmask_help(N_Vector x, N_Vector w, N_Vector id) {
627  long int i, N;
628  realtype sum = ZERO, prodi, *xd, *wd, *idd;
629 
630  N = NV_LENGTH_S(x);
631  xd = NV_DATA_S(x);
632  wd = NV_DATA_S(w);
633  idd = NV_DATA_S(id);
634 
635  for (i = 0; i < N; i++) {
636  if (idd[i] > ZERO) {
637  prodi = xd[i] * wd[i];
638  sum += prodi * prodi;
639  }
640  }
641 
642  return (sum);
643 }
644 static void* vwrmsnormmask(NrnThread* nt) {
645  realtype s;
646  int i = nt->id;
648  lockadd(s);
649  return nullptr;
650 }
651 realtype N_VWrmsNormMask_NrnThread(N_Vector x, N_Vector w, N_Vector id) {
652  long int N;
653  N = NV_LENGTH_NT(x);
654  retval = ZERO;
656  mydebug2("vwrmsnormmask %.20g\n", RSqrt(retval / N));
657  return (RSqrt(retval / N));
658 }
659 
660 static void* vmin(NrnThread* nt) {
661  realtype min;
662  int i = nt->id;
663  if (NV_LENGTH_S(xarg(i))) {
664  min = N_VMin_Serial(xarg(i));
665  lockmin(min);
666  }
667  return nullptr;
668 }
669 realtype N_VMin_NrnThread(N_Vector x) {
670  retval = BIG_REAL;
672  mydebug2("vmin %.20g\n", retval);
673  return (retval);
674 }
675 
676 static realtype N_VWL2Norm_helper(N_Vector x, N_Vector w) {
677  long int i, N;
678  realtype sum = ZERO, prodi, *xd, *wd;
679 
680  N = NV_LENGTH_S(x);
681  xd = NV_DATA_S(x);
682  wd = NV_DATA_S(w);
683 
684  for (i = 0; i < N; i++) {
685  prodi = (*xd++) * (*wd++);
686  sum += prodi * prodi;
687  }
688 
689  return sum;
690 }
691 static void* vwl2norm(NrnThread* nt) {
692  realtype sum;
693  int i = nt->id;
694  sum = N_VWL2Norm_helper(xarg(i), warg(i));
695  lockadd(sum);
696  return nullptr;
697 }
698 realtype N_VWL2Norm_NrnThread(N_Vector x, N_Vector w) {
699  long int N;
700  retval = ZERO;
702  N = NV_LENGTH_NT(x);
703  mydebug2("vwl2norm %.20g\n", RSqrt(retval));
704  return (RSqrt(retval));
705 }
706 
707 static void* vl1norm(NrnThread* nt) {
708  realtype sum;
709  int i = nt->id;
710  sum = N_VL1Norm_Serial(xarg(i));
711  lockadd(sum);
712  return nullptr;
713 }
714 realtype N_VL1Norm_NrnThread(N_Vector x) {
715  retval = ZERO;
717  mydebug2("vl1norm %.20g\n", retval);
718  return (retval);
719 }
720 
721 static void* v1mask(NrnThread* nt) {
722  int i = nt->id;
724  return nullptr;
725 }
726 void N_VOneMask_NrnThread(N_Vector x) {
728 }
729 
730 static void* vcompare(NrnThread* nt) {
731  int i = nt->id;
732  N_VCompare_Serial(carg, xarg(i), zarg(i));
733  return nullptr;
734 }
735 void N_VCompare_NrnThread(realtype c, N_Vector x, N_Vector z) {
737  mydebug("vcompare\n");
738 }
739 
740 static void* vinvtest(NrnThread* nt) {
741  booleantype b;
742  int i = nt->id;
743  b = N_VInvTest_Serial(xarg(i), zarg(i));
744  if (!b) {
745  lockfalse;
746  }
747  return nullptr;
748 }
749 booleantype N_VInvTest_NrnThread(N_Vector x, N_Vector z) {
750  bretval = TRUE;
752  mydebug2("vinvtest %d\n", bretval);
753  return (bretval);
754 }
755 
756 static void* vconstrmask(NrnThread* nt) {
757  booleantype b;
758  int i = nt->id;
759  b = N_VConstrMask_Serial(yarg(i), xarg(i), zarg(i));
760  if (!b) {
761  lockfalse;
762  }
763  return nullptr;
764 }
765 booleantype N_VConstrMask_NrnThread(N_Vector y, N_Vector x, N_Vector z) {
766  bretval = TRUE;
768  mydebug2("vconstrmask %d\n", bretval);
769  return (bretval);
770 }
771 
772 static void* vminquotient(NrnThread* nt) {
773  realtype min;
774  int i = nt->id;
775  min = N_VMinQuotient_Serial(xarg(i), yarg(i));
776  lockmin(min);
777  return nullptr;
778 }
779 realtype N_VMinQuotient_NrnThread(N_Vector x, N_Vector y) /* num, denom */
780 {
781  retval = BIG_REAL;
783  mydebug2("vminquotient %.20g\n", retval);
784  return (retval);
785 }
#define v
Definition: md1redef.h:11
#define data
Definition: md1redef.h:36
#define i
Definition: md1redef.h:19
#define TRUE
Definition: grids.h:22
#define FALSE
Definition: grids.h:23
static int c
Definition: hoc.cpp:169
#define assert(ex)
Definition: hocassrt.h:24
printf
Definition: extdef.h:5
void nrn_multithread_job(F &&job, Args &&... args)
Definition: multicore.hpp:161
size_t j
s
Definition: multisend.cpp:521
#define MUTCONSTRUCTED
Definition: nrnmutdec.h:32
#define MUTCONSTRUCT(mkmut)
Definition: nrnmutdec.h:33
#define MUTDEC
Definition: nrnmutdec.h:31
void N_VSetArrayPointer_NrnThread(realtype *v_data, N_Vector v)
booleantype N_VInvTest_NrnThread(N_Vector x, N_Vector z)
void N_VSpace_NrnThread(N_Vector v, long int *lrw, long int *liw)
#define xarg(i)
static booleantype bretval
void N_VConst_NrnThread(realtype c, N_Vector z)
#define idarg(i)
#define aarg
#define barg
static N_Vector y_
static void * v1mask(NrnThread *nt)
#define lockmin(arg)
static void * vconstrmask(NrnThread *nt)
#define apass
realtype N_VMin_NrnThread(N_Vector x)
N_Vector * N_VNewVectorArray_NrnThread(int count, long int length, int nthread, long int *sizes)
realtype N_VDotProd_NrnThread(N_Vector x, N_Vector y)
static N_Vector id_
void N_VLinearSum_NrnThread(realtype a, N_Vector x, realtype b, N_Vector y, N_Vector z)
static N_Vector w_
#define wpass
void N_VCompare_NrnThread(realtype c, N_Vector x, N_Vector z)
#define xpass
void N_VAbs_NrnThread(N_Vector x, N_Vector z)
N_Vector * N_VNewVectorArrayEmpty_NrnThread(int count, long int length, int nthread, long int *sizes)
static realtype vwrmsnormmask_help(N_Vector x, N_Vector w, N_Vector id)
static void * vaddconst(NrnThread *nt)
void N_VDiv_NrnThread(N_Vector x, N_Vector y, N_Vector z)
void N_VAddConst_NrnThread(N_Vector x, realtype b, N_Vector z)
static realtype N_VWL2Norm_helper(N_Vector x, N_Vector w)
static void * vscale(NrnThread *nt)
#define carg
void N_VScale_NrnThread(realtype c, N_Vector x, N_Vector z)
void N_VDestroyVectorArray_NrnThread(N_Vector *vs, int count)
#define zpass
N_Vector N_VCloneEmpty_NrnThread(N_Vector w)
static void * vwrmsnormmask(NrnThread *nt)
#define bpass
void N_VInv_NrnThread(N_Vector x, N_Vector z)
#define mydebug2(a, b)
#define locklongdadd(arg)
static void * vconst(NrnThread *nt)
static void * vabs(NrnThread *nt)
#define lockfalse
#define lockmax(arg)
static void * vlinearsum(NrnThread *nt)
N_Vector N_VMake_NrnThread(long int length, realtype *v_data)
void N_VDestroy_NrnThread(N_Vector v)
static void * vmin(NrnThread *nt)
void N_VOneMask_NrnThread(N_Vector x)
#define lockadd(arg)
static realtype retval
realtype N_VMinQuotient_NrnThread(N_Vector x, N_Vector y)
static void * vdiv(NrnThread *nt)
realtype N_VWL2Norm_NrnThread(N_Vector x, N_Vector w)
static void * vprod(NrnThread *nt)
static realtype c_
static void * vmaxnorm(NrnThread *nt)
N_Vector N_VNewEmpty_NrnThread(long int length, int nthread, long int *sizes)
static void * vminquotient(NrnThread *nt)
static void * vwl2norm(NrnThread *nt)
static void pr(N_Vector x)
#define ZERO
realtype N_VWrmsNormMask_NrnThread(N_Vector x, N_Vector w, N_Vector id)
booleantype N_VConstrMask_NrnThread(N_Vector y, N_Vector x, N_Vector z)
static void * vinv(NrnThread *nt)
#define ypass
#define zarg(i)
#define warg(i)
#define mydebug(a)
N_Vector N_VNew_NrnThread(long int length, int nthread, long int *sizes)
static realtype a_
realtype N_VWrmsNorm_NrnThread(N_Vector x, N_Vector w)
static void * vinvtest(NrnThread *nt)
static void * vl1norm(NrnThread *nt)
static realtype b_
void N_VProd_NrnThread(N_Vector x, N_Vector y, N_Vector z)
void N_VPrint_NrnThread(N_Vector x)
#define yarg(i)
realtype N_VL1Norm_NrnThread(N_Vector x)
realtype N_VMaxNorm_NrnThread(N_Vector x)
#define cpass
#define idpass
static void * vdotprod(NrnThread *nt)
static N_Vector z_
static void * vcompare(NrnThread *nt)
static N_Vector x_
N_Vector N_VClone_NrnThread(N_Vector w)
static realtype vwrmsnorm_help(N_Vector x, N_Vector w)
static void * vwrmsnorm(NrnThread *nt)
realtype * N_VGetArrayPointer_NrnThread(N_Vector v)
#define NV_OWN_DATA_NT(v)
#define NV_SUBVEC_NT(v, i)
void N_VOneMask_Serial(N_Vector x)
#define NV_CONTENT_NT(v)
#define NV_DATA_NT(v)
struct _N_VectorContent_NrnThread * N_VectorContent_NrnThread
#define NV_LENGTH_NT(v)
#define NV_NT_NT(v)
#define NULL
Definition: spdefs.h:105
Represent main neuron object computed by single thread.
Definition: multicore.h:58
int id
Definition: multicore.h:66