void MCNeuronSim::setupSingleNeuronParms(int grpRowId, int neurId, bool coupledComp){ for(unsigned int c = 0; c < compCount; c++) // each neuron has compCount compartments { network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "C", getCm(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "k", getK(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "vr", getVr(neurId)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "vt", getVt(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "a", getA(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "b", getB(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "vpeak", getVpeak(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "c", getVmin(neurId, c)); network->setIzhikevichParameter(excGroup[grpRowId][c], neurId, "d", getD(neurId, c)); if(coupledComp){ if(c>0){ double G = getG(neurId, c); //parameters[neurId][G_idx[c-1]]; double P = getP(neurId, c);//parameters[neurId][P_idx[c-1]]; float fwd = G * P; float bwd = G * (1-P); /* * generally, fwd is carlsim 'down', bwd is carlsim 'up' for the purpose of coupling constant assignment, but, * when there is a dendrite 'below' soma: ****cases 3c2 and 4c2*** * up and down are reversed. */ if(compCount>2 && c==1 && connLayout[c]==connLayout[c+1]){ //meaning 2 dendrites (dend 1 and dend2 ) connecting to the same point network->setCouplingConstant(excGroup[grpRowId][connLayout[c]], neurId, "down", bwd); network->setCouplingConstant(excGroup[grpRowId][c], neurId, "up", fwd); }else{ network->setCouplingConstant(excGroup[grpRowId][c], neurId, "down", fwd); network->setCouplingConstant(excGroup[grpRowId][connLayout[c]], neurId, "up", bwd); } } } } }
bool SymBandSVDiv<T>::checkDecomp( const BaseMatrix<T>& m, std::ostream* fout) const { Matrix<T> mm = m; if (fout) { *fout << "SymBandSVDiv:\n"; *fout << "M = "<<mm<<std::endl; *fout << "U = "<<getU()<<std::endl; *fout << "S = "<<getS()<<std::endl; *fout << "Vt = "<<getVt()<<std::endl; } Matrix<T> usv = getU()*getS()*getVt(); RT nm = Norm(usv-mm); nm /= Norm(getU())*Norm(getS())*Norm(getVt()); RT cond = condition(); if (fout) { *fout << "USVt = "<<usv<<std::endl; *fout << "Norm(M-USVt)/Norm(USVt) = "<<nm; *fout <<" "<<cond<<" * "<<TMV_Epsilon<T>()<<std::endl; } return nm < cond*RT(mm.colsize())*TMV_Epsilon<T>(); }