flag=0 proc err () { xpanel("**** ERROR ****") xlabel($s1) xpanel() } strdef tstr if (unix_mac_pc() == 3) { chdir(neuronhome()) if (chdir("fctb")==0) flag=1 if (chdir("..\fctb")==0) flag=1 if (flag==0) { sprint(tstr,"ERROR: FCTB directory not found; should be in %s or %s/..\n",neuronhome(),neuronhome()) err(tstr) } else if (default_dll_loaded_== 0) { flag = nrn_load_dll("nrnmech.dll") if (flag==1) { default_dll_loaded_ = 1 } else { sprint(tstr,"ERROR loading %s/nrnmech.dll; remake with mknrndll.\n",getcwd()) err(tstr) } } } objref helpbox, helpdeck proc help_list() { helpbox=new HBox(2) helpbox.intercept(1) xpanel("") xbutton("General","helpdeck.flip_to(0)") xbutton("Button actions","helpdeck.flip_to(1)") xbutton("Exercises","helpdeck.flip_to(2)") xpanel() helpdeck=new Deck() helpdeck.intercept(1) xpanel("") xlabel("Model for Fig. 10-1 shows a rudimentary Hopfield network with only 4") xlabel("units. 3 vectors are stored: (1,1,1,1); (-1,1,1,-1); (-1,-1,1,1).") xlabel("") xpanel() xpanel("") xlabel("Run: Initialize and run from iteration #0 to maximum iteration in") xlabel(" \"Run till\"") xlabel("Single step: Go step by step") xlabel("Show values: check box to produce a text box showing intermediate") xlabel(" values -- total summed inputs into each unit") xlabel("Iteration #: button re-initializes simulation") xlabel(" also shows iteration number -- normally do not need to set") xlabel("Run till: maximum iteration when hitting \"Run\" button") xlabel("Weights: pull-down menu to change or view weights") xlabel(" Draw weights") xlabel(" Clear drawing") xlabel(" Show weight matrix: pops up a read-only version of the weight matrix") xlabel(" Edit weight matrix: editable spread sheet of weights") xlabel(" Reset weight matrix: put back initial values") xlabel(" Clear weight matrix\": set all weights to zero") xlabel(" Save/Read weight matrix: save/read file") xlabel("Units") xlabel(" there are two ways to set the units") xlabel(" clicking on a unit will set it if clear or clear it if set") xlabel(" \"Table set\" allows you to enter the values textually") xlabel("") xpanel() xpanel("") xlabel("1. Make a list of starting points in state space (there are 2^4=16") xlabel("of them) and record where each gets mapped by the network. Identify") xlabel("each end-point as an attractor or a spurious (mirror) attractor.") xlabel("") xlabel("2. A state space map in this case would be a 4-dimensional graph.") xlabel("Come up with a way to record the map in two-dimensional space (ie on a") xlabel("piece of paper). Does this help you visualize the mapping?") xlabel("") xlabel("3. Find another two or three orthogonal matrices and work out the") xlabel("network weights. Load them into the network. Confirm that the") xlabel("source vectors are attractors.") xlabel("") xpanel() helpdeck.intercept(0) helpdeck.map() helpdeck.flip_to(0) helpbox.intercept(0) helpbox.map() } // Created 07/24/09 17:50:29 by "/usr/site/scripts/loadfiles -q -a MEM_stick.hoc" //================================================================ // INSERTED MEM_stick.hoc // =Id= MEM_stick.hoc,v 1.4 2002/10/03 12:20:47 billl Exp // load_file("MEM_stick.hoc") //================================================================ // INSERTED ncirc.hoc // =Id= ncirc.hoc,v 1.36 2002/10/02 13:41:02 billl Exp // load_file("ncirc.hoc") // eg // objref nc // nc = new NCIRC(10,10,90,10,10,90,90,90) // vec.resize(4) // for ii=0,20 { vec.fill(1) vec.x[ii%4]=0 nc.disp(vec) system("sleep .3") nc.g.flush doEvents()} // nc.gcmap(-1,1) // rdm.uniform(-1,1) // for ii=0,20 { vec.setrand(rdm) vec.printf nc.dispcol(vec) system("sleep .2") nc.g.flush doEvents()} ncview=1 begintemplate NCIRC public vals,g,disp,sz,coord,clrsym,symsz,setsym,clrcol,setcol,colr,labl,line,clrall,clkset public low,high,gcmap,dispcol,lscale,which,mapg external ncview objref vals[3], xloc[3], yloc[3], g, mapg strdef clrsym,setsym,symb,tstr double low[1],high[1] proc init () { local i g=new Graph(0) g.menu_tool("Set units", "clkset") g.size(0,100,0,100) g.xaxis(3) for ii=0,2 { vals[ii]=new Vector(0) xloc[ii]=vals.c yloc[ii]=vals.c } clrcol=1 setcol=2 colr=1 symsz=40 lscale=2 clrsym="o" setsym="O" sz = numarg() i=1 vals.resize(sz/2) xloc.resize(0) yloc.resize(0) while (i=high) return maxcol+10-1 return int(maxcol*(y-low)/(high-low))+10 } // put labels in each circle proc labl () { local i,j if (numarg()==0) { // label all units with values in val for ii=0,sz-1 { sprint(tstr,"%0.1f",vals.x[ii]) g.label(xloc.x[ii],yloc.x[ii],tstr,1,lscale,.5,.5,colr) } } else if (numarg()==2 && xloc.size!=2) { // label one unit g.label(xloc.x[$1],yloc.x[$1],$s2,1,lscale,.5,.5,colr) } else { for i=1,numarg() { // label all the units with consecutive arg strings j=i-1 g.label(xloc.x[j],yloc.x[j],$si,1,lscale,.5,.5,colr) } } } // draw a lines btwn units with a spot on the end // line(from,to[,color,symbol,symbol_size,x_offset,y_offset)] func min () { if ($1<$2) return $1 else return $2 } proc line () { local i,b,e,ssz,offx,offy b=$1 e=$2 if (numarg()>2) colr=$3 // else as set if (numarg()>3) symb=$s4 else symb="O" if (numarg()>4) ssz=$5 else ssz=15 if (numarg()>5) {offx=$6 offy=$7} else {offx=0 offy=0} if (numarg()>7) wth=$8 else wth=0 g.color(colr) g.beginline() g.line(xloc.x[b]+offx,yloc.x[b]+offy) g.line(xloc.x[e]+offx,yloc.x[e]+offy) g.color(1) g.mark(xloc.x[e]+offx,yloc.x[e]+offy, symb , ssz, colr, 1) if (wth) { // weight label xa=min(xloc.x[b],xloc.x[e]) ya=min(yloc.x[b],yloc.x[e]) sprint(tstr,"%1.1f",wth) g.label(xa+offx+abs(xloc.x[e]-xloc.x[b])/2,ya+offy+abs(yloc.x[e]-yloc.x[b])/2,tstr,1,1,.5,.5,colr) } } //** clkset() binary change unit state which click proc clkset () { local min,dist,whc,x,y if ($1==2) { // mouse down only min=1e10 x=$2 y=$3 for ii=0,sz-1 { dist=abs((xloc.x[ii]-x)*(xloc.x[ii]-x) + (yloc.x[ii]-y)*(yloc.x[ii]-y)) if (dist3) key=$4 if (numarg()>4) label=$s5 else label="TABLE" if (numarg()>5) arrow=$6 else arrow=0 boxl=new List() boxl.remove_all bxv=new VBox() boxl.append(bxv) bxv.intercept(1) for ii=0,rows-1 { bxh=new HBox() boxl.append(bxh) bxh.intercept(1) for jj=0,cols-1 { bxv=new VBox() boxl.append(bxv) bxv.intercept(1) xpanel("") if (rows==1) sprint(tstr,"%d",jj) else if (cols==1) sprint(tstr,"%d",ii) else { sprint(tstr,"%d,%d",ii,jj) } sprint(tstr2,"notify(%s,%d,%d,%d,%d)",this.mapdv,ii*cols+jj,ii,jj,key) xpvalue(tstr,&mapdv.x(ii*cols+jj),arrow,tstr2) xpanel() bxv.intercept(0) bxv.map() } bxh.intercept(0) bxh.map() } boxl.object(0).intercept(0) boxl.object(0).map(label) } endtemplate XTABL // proc notify () { $o1.x[$2] *= 2 } // eg -- multiply any new input by 2 // proc notify () { printf("Table#%d:%s %d,%d CHANGED TO %g BY USER\n",$5,$o1,$3,$4,$o1.x[$2]) } // objref a // vec.resize(15) // a=new XTABL(5,3,vec,0,"hello") // vec.indgen(3) // END xtabl.hoc //================================================================ //================================================================ // INSERTED string2.hoc // =Id= string2.hoc,v 1.1 2002/09/07 12:55:06 billl Exp //*String2 template begintemplate String2 public s,t strdef s,t proc init() { if (numarg() == 1) { s=$s1 } if (numarg() == 2) { s=$s1 t=$s2 } } endtemplate String2 // END string2.hoc //================================================================ //================================================================ // INSERTED bkutils.hoc // =Id= bkutils.hoc,v 1.73 2004/04/30 15:35:32 billl Exp // load_file("stdgui.hoc") // load_file("setup.hoc") load_file("stdrun.hoc") if (name_declared("install_matrix")) execute("install_matrix()") if (name_declared("install_vecst")) execute("install_vecst()") //* objects objref g[4], stim[2], nc, gp, sns, ind, vec0, vec[2], rdm[2], XO, YO, cvode objref st,wt,scr,smat,box[4],insr,nil,sref,tmpfile,tmpobj,tmpvec,tmplist,sfunc,deck strdef mesg,tstr,tstr2,temp_string_,filename,section tmpfile = new File() tmplist = new List() fchooser_flag = 0 graph_flag = 1 double x[4],y[4] rdm = new Random() cvode = new CVode() sfunc = new StringFunctions() { ind=new Vector() vec[0]=ind.c vec[1]=ind.c vec0=ind.c} //* iterators and templates //** string iterator iterator case() { local i i1 = 0 for i = 2, numarg() { $&1 = $i iterator_statement i1+=1 } } iterator scase() { local i i1 = 0 for i = 1, numarg() { temp_string_ = $si iterator_statement i1+=1 } } // eg for scase2("a","b","c","d","e","f") print temp_string_,temp_string2_ iterator scase2() { local i i1 = 0 if (numarg()%2==1) {print "ERROR: scase2 needs even number of args" return } for i = 1, numarg() { tmpobj=new String2() tmpobj.s=$si i+=1 tmpobj.t=$si iterator_statement i1+=1 } } // like perl chop -- removes the last character proc chop () { sfunc.left($s1,sfunc.len($s1)-1) } //** list iterator ltr // usage 'for ltr(XO, tmplist) { print XO }' iterator ltr() { local i if (numarg()==3) {$&3=0} else {i1 = 0} for i = 0, $o2.count() - 1 { $o1 = $o2.object(i) iterator_statement if (numarg()==3) { $&3+=1 } else { i1+=1 } } $o1 = nil } //** list pairwise iterator ltrp // usage 'for ltrp(XO, YO, list) { print XO,YO }' takes them pairwise iterator ltrp() { local i if (numarg()==4) {$&4=0} else {i1 = 0} for (i=0;i<$o3.count()-1;i+=2) { $o1 = $o3.object(i) $o2 = $o3.object(i+1) iterator_statement if (numarg()==4) { $&4+=1 } else { i1+=1 } } $o1=nil $o2=nil } //** vector iterator vtr // usage 'for vtr(&x, vec) { print x }' iterator vtr() { local i if (numarg()==3) {$&3=0} else {i1 = 0} for i = 0, $o2.size() - 1 { $&1 = $o2.x[i] iterator_statement if (numarg()==3) { $&3+=1 } else { i1+=1 } } } //* vlk(vec) -- display vector slice -- more flexible than vec.printf // vlk(vec,max) // vlk(vec,min,max) // prints out a segment of a vector vlk_width=20 proc vlk () { local i,j,min,max,dual,wdh,nonl,nl j=dual=0 nl=1 wdh=vlk_width if (numarg()==1) { min=0 max=$o1.size-1 } if (numarg()==2) if ($2==0) { nl=min=0 max=$o1.size-1 // vlk(vec,0) flag to suppress new lines } else if ($2>0) { min=0 max=$2-1 } else { min=$o1.size+$2 max=$o1.size-1 } if (numarg()==3) if ($3>-1) { min=$2 max=$3 } else { min=0 max=$o1.size-1 dual=1 } if (numarg()==4) { min=$3 max=$4 dual=1 } if (min<0) min=0 if (max>$o1.size-1) max=$o1.size-1 if (dual) if (max>$o2.size-1) max=$o2.size-1 for i=min,max { if (dual) printf("%g:%g ",$o1.x[i],$o2.x[i]) else printf("%g ",$o1.x[i]) if ((j=j+1)%vlk_width==0 && nl) { print "" } } if (nl) print "" } //** savevec([list,]vec1[,vec2,...]) add vector onto veclist or other list if given as 1st arg objref veclist veclist = new List() proc savevec () { local i,flag,beg if (isobj($o1,"List")) beg=2 else beg=1 for i=beg, numarg() { tmpvec = new Vector($oi.size) tmpvec.copy($oi) if (beg==2) $o1.append(tmpvec) else veclist.append(tmpvec) tmpvec = nil } } //* graphics; symbols and colors {symnum = 7 colnum = 9} objectvar cl[colnum], sym[symnum] for ii=0,colnum-1 cl[ii]=new String() { cl[0].s ="white" cl[1].s ="black" cl[2].s ="red" cl[3].s ="blue" cl[4].s ="green" cl[5].s ="orange" cl[6].s ="brown" cl[7].s ="violet" cl[8].s ="yellow" } for ii=0,symnum-1 sym[ii]=new String() { sym[0].s = "o" sym[1].s = "t" sym[2].s = "s" sym[3].s = "O" sym[4].s = "T" sym[5].s = "S" sym[6].s = "+"} gcl=0 // graph color func color () { gcl = (gcl+1)%colnum if (gcl==0) gcl=1 // throw out white if (numarg()==1) $o1.color(gcl) return gcl } //** qhp() basic buttons proc qhp () { if (numarg()==1) xpanel("CONTROLS",1) xbutton("Quit","quit()") xbutton("Help","help_list()") xbutton("Print panel","pwman_place(50,50)") xbutton("Reset","reset()") if (numarg()==1) xvarlabel(mesg) if (numarg()==1) xpanel(0,0) mesg="" } //** allgraphs() proc remgrs () { local ii for ii=0,3 graphList[ii].remove_all() objref graphItem } proc allgraphs () { for ii=0,3 for ltr(XO,graphList[ii]) XO.exec_menu($s1) } proc vp() { allgraphs("View = plot") } proc allgrop () { for ii=0,3 for ltr(XO,graphList[ii]) { sprint(tstr,"%s.%s",XO,$s1) execute(tstr) } } //** grrtsize() use view=plot and then pad a little proc grrtsize () { local h,w,frac if (numarg()>=1) tmpobj=$o1 else tmpobj=graphItem if (numarg()>=2) frac = $2 else frac=.05 tmpobj.exec_menu("View = plot") tmpobj.size(&x) w=frac*(x[1]-x[0]) h=frac*(x[3]-x[2]) x[0]-=2*w x[1]+=w x[2]-=4*h x[3]+=h // need extra padding on bottom tmpobj.size(x[0],x[1],x[2],x[3]) } //** isobj(o1,s2) checks whether object $o1 is of type $s2 func isobj () { sprint(temp_string_,"%s",$o1) if (sfunc.substr(temp_string_,$s2)==0) { return 1 } else { return 0 } } // cbin(min,max): binary colormap proc cbin () { $o1.colormap(2) $o1.colormap(0, 255, 0, 0) $o1.colormap(1, 255, 255, 0) $o1.scale($2, $3) } // my version of newPlotV() leaves off the label proc newplotv () { newplot() graphItem.addvar("","v(.5)",1,3) } proc redraw0 () { plrdrf=0 } // stub with flag proc plcback () { } // callback objref oxv,oyv // coordinates: 0,1 line start; 2,3 last loc oxv=new Vector(2) oyv=new Vector(2) plrdrf=1 // flag will be unset if using redraw stub plhorz=0 // 1 for horizontal, 2 for verticle lines proc pl () { if ($1==2) { // mouse down -- new line redraw0() // unset plrdrf if redraw0() not overwritten oxv.x[0]=oxv.x[1]=$2 oyv.x[0]=oyv.x[1]=$3 } else { if (plrdrf) graphItem.erase_all oyv.line(graphItem,oxv,0,2) oxv.x[1]=$2 oyv.x[1]=$3 if (plhorz==1) oyv.x[1]=oyv.x[0] if (plhorz==2) oxv.x[1]=oxv.x[0] oyv.line(graphItem,oxv,2,2) redraw0() // will redraw if defined if ($1==3) plcback(oxv,oyv) } } // newplot([width,height,pointer]) OR newplot([pointer]) proc newplot () { local wd,ht graphItem = new Graph(0) if (numarg()==1) $o1=graphItem // make a pointer if (numarg()==3) $o3=graphItem if (numarg()>1) { wd=$1 ht=$2 } else { wd=500 ht=300 } graphItem.save_name("graphList[0].") graphList[0].append(graphItem) graphItem.view(0,-90,tstop,150,600,200,wd,ht) } //* cbw(min,max): b/w binary colormap proc cbw () { $o1.colormap(2) $o1.colormap(0, 0, 0, 0) $o1.colormap(1, 255, 255, 255) $o1.scale($2, $3) } //* I/O //** svrd(0/1,name,file_ext[,fflag]) save-0 and read-1 // eg svrd(1,"Image","img") will look for file.img files to read // fflag -- return filename only -- don't call parser proc svrd () { local ii,num,cnt,fflag rdflag=$1 if (numarg()==4) fflag=$4 else fflag=0 sprint(tstr2,"*.%s",$s3) if (rdflag==0) { // write sprint(tstr,"Write %s",$s2) tmpfile.chooser("w",tstr,tstr2,"WRITE","","") if (tmpfile.chooser()==1) { tmpfile.getname(filename) if (!fflag) parsr(rdflag) } } else if (rdflag==1) { // read sprint(tstr,"Read %s",$s2) tmpfile.chooser("r",tstr,tstr2,"READ","","") if (tmpfile.chooser()==1) { tmpfile.getname(filename) if (!fflag) parsr(rdflag) } } mesg=filename tmpfile.close } //* xgetargs, d2b //** range(val,min,max) -- return val only if in proper range // eg stim.noise=range(stim.noise,0,1) func range () { if ($1<$2) return $2 if ($1>$3) return $3 return $1 } //** err() proc err () { if (numarg()==1) mesg=$s1 print mesg } //** xvarstr(): display a list of strings in an xpanel using xvarlabel proc xvarstr () { local ii,cnt // ivoc_style("*font", "fixed") if (unix_mac_pc() == 1) { ivoc_style("*font", "*helvetica-bold-r-normal*--14*") } xpanel($s1) for ltr(XO,$o2) xvarlabel(XO.s) xpanel() } //** xgetargs(panel_name,command,arg1[,arg2,...],defaults) // xgetargs("Random session","newrand","# of patts","patt size ","overlap ","5,33,7") objref argv argv = new Vector() proc xgetargs () { local i,args args=numarg()-3 i=numarg() argv.resize(0) sprint(temp_string_,"argv.append(%s)",$si) execute(temp_string_) if (argv.size!=args) argv.resize(args) xpanel($s1) mesg=$s1 xvarlabel(mesg) for i=3,numarg()-1 { sprint(temp_string_,"argv.x[%d]",i-3) xvalue($si,temp_string_) } sprint(temp_string_,"xgetexec(\"%s\",%d)",$s2,args) xbutton("Execute",temp_string_) xpanel() } proc xgetexec () { local i,args args = $2 if (argv.size!=args) { mesg="Error-close & relaunch panel" return } sprint(temp_string_,"%s(",$s1) for i=0,args-2 sprint(temp_string_,"%s%g,",temp_string_,argv.x[i]) sprint(temp_string_,"%s%g)",temp_string_,argv.x[i]) print temp_string_ execute(temp_string_) } //** d2b(): decimal to binary, gives a binary appearing number for showing // eg for ii=0,100 printf("%010d\n",d2b(ii)) func d2b () { local num,ii,rem,res num=$1 ii=0 res=0 while (num>0) { rem = int(2*(num/2-int(num/2))) // right digit num=int(num/2) // remove right digit res+=rem*10^ii ii+=1 } return res } //* matrix stuff //** cvec(),rvec() put out col bzw row vecs in latex format proc cvec () { local i printf("\\bpm ") for vtr(&x,$o1) if (i1<$o1.size-1) printf("%g \\\\ ",x) printf("%g \\epm\n",x) } proc rvec () { local i printf("\\bpm ") for vtr(&x,$o1) if (i1<$o1.size-1) printf("%g & ",x) printf("%g \\epm\n",x) } //** matp(mat,rows,cols) prints out matrix in latex format proc matp () { local i,j,rows,cols rows=$2 cols=$3 if ($o1.size!=rows*cols) {print "ERR: matp - mat.size != rows*cols" return} printf("\\bpm\n") for (i=0;irows) for i=rows,cols-1 printf("%70.04g \n",$o2.x[i]) } //** mmlt(mdest,m1,m2,r2) matrix mult between 2 mats // r2==c1 gives shared dimension proc mmlt () { local i,j,r1,c1,r2,c2 c1 = r2 = $4 // shared dimension (cols of 1st/rows of second) r1=$o2.size/c1 c2=$o3.size/r2 printf("%dx%d * %dx%d = %dx%d\n",r1,c1,r2,c2,r1,c2) $o1.resize(r1*c2) vec[0].resize(c1) // length of a row of mat A vec[1].resize(r2) // length of a col of mat B for i=0,r1-1 for j=0,c2-1 { vec[0].mrow($o2,i,c1) vec[1].mcol($o3,j,c2) $o1.x[i*c2+j]=vec[0].dot(vec[1]) } $o1.mprintf(r1,c2) dealloc(a) } //* membrane and pp's //** runbutton running_ = 1 proc runbutton () { if (running_ == 0) { stoprun = 1 return } if (t>0 && t0) { nc.line($3,$4,2,"O",8,-lmv*rdm.repick,mvmax*lmv-2*lmv*rdm.repick,wth) } else { nc.line($3,$4,3,"S",8, lmv*rdm.repick,mvmax*lmv-2*lmv*rdm.repick,wth) } } //** shmat() edit weight matrix, labels units, draws connections proc shmat () { local num,ii,wht num=$1 if (num==0) { } else if (num==1) { // show wt matrix in xlabels tb[0]=new XTABL(in,in,mat,0,"WEIGHT MATRIX") } else if (num==2) { // excitatory connections for ii=0,in-1 for jj=0,in-1 if ((wht=mat.mget(jj,ii,in)) > 0) { nc.line(ii,jj,2,"O",8,-lmv*rdm.repick,mvmax*lmv-2*lmv*rdm.repick,wht) } } else if (num==3) { for ii=0,in-1 for jj=0,in-1 if ((wht=mat.mget(jj,ii,in)) < 0) { nc.line(ii,jj,3,"S",8,lmv*rdm.repick,mvmax*lmv-2*lmv*rdm.repick,wht) } } else if (num==4) { nc.g.erase_all nc.disp() } else if (num==5) { nc.g.exec_menu("Set units") xpanel("Set units") xlabel("Click on units or enter below") for ii=1,in { sprint(tstr,"Input #%d",ii) sprint(tstr2,"nc.vals.x[%d]",ii-1) xvalue(tstr,tstr2,1,"nc.disp()") } xpanel() } else if (num==6) { } } //** shwtmat() -- show wt matrix textually proc shwtmat () { local ii if (matflag==1 && isobj(tb[1],"VBox")) { tb[1].unmap tb[1].dismiss_action("") } matflag=1 // flag set if this window is present -- in case needs updating tb[1]=new VBox() tb[1].intercept(1) vec.resize(in) xpanel("") mesg = "FROM > a" for ii=1,in-1 sprint(mesg,"%s %c",mesg,ii+97) xlabel(mesg) mesg = "TO " xlabel(mesg) for ii=0,in-1 { // just show the matrix vec.mrow(mat,ii,in) // 'f' and 'i' are skinny letters if (ii==5 || ii==8) { sprint(mesg,"%d %-7c ",ii,ii+97) } else { sprint(mesg,"%d %-6c ",ii,ii+97) } sprvec(mesg,vec) xlabel(mesg) } xpanel() tb[1].intercept(0) tb[1].map("Weight matrix") sprint(tstr,"matflag=0 %s.unmap",tb[1]) tb[1].dismiss_action(tstr) } //*** sprintf from a vector to a string proc sprvec () { for ii=0,$o2.size-1 sprint($s1,"%s %-4.1f ",$s1,$o2.x[ii]) } //** initvals() initialize or clear weight matrix, also clears graphic proc initvals () { local flag flag=$1 mat.fill(0) if (flag==1) setmat() nc.clrall nc.disp label() iter=0 if (matflag) shwtmat() } //* run -- upd(), etc. from fdfwd -- need rewriting pflag = 0 BVBASE=0 iter=0 maxiter=6 proc run () { stp=iter=0 if (pflag) dispwait("Initial values: ",nc.vals) for ii=0,maxiter-1 {sleep() upd(-1) doNotify()} } slplp=5e4 // empty loops to run through proc sleep () { local ii // system("sleep .1") // not generally available for (ii=0;ii