22 "Number of divisions.",
28 "Minimum value in table.",
34 "Maximum value in table.",
40 "Maximum value in table.",
53 "Lookup function that performs interpolation to return a value.",
60 "Lookup function that returns value by index.",
64 static Finfo* vectorTableFinfos[] =
77 "Name",
"VectorTable",
78 "Author",
"Vishaka Datta S, 2011, NCBS",
79 "Description",
"This is a minimal 1D equivalent of the Interpol2D class. "
80 "Provides simple functions for getting and setting up the table, along "
81 "with a lookup function. This class is to be used while supplying lookup "
82 "tables to the MarkovChannel class, in cases where the transition rate "
83 "varies with either membrane voltage or ligand concentration."
87 static Cinfo VectorTableCinfo(
91 sizeof( vectorTableFinfos )/
sizeof(
Finfo* ),
94 sizeof( doc ) /
sizeof(
string )
97 return &VectorTableCinfo;
103 invDx_(-1), table_(0)
117 unsigned int index =
static_cast< unsigned int>( ( x -
xMin_ ) *
invDx_ );
118 double frac = ( x -
xMin_ - index /
invDx_ ) * invDx_;
119 return table_[ index ] * ( 1 - frac ) +
table_[ index + 1 ] * frac;
136 if ( index >=
table_.size() )
137 index =
table_.size() - 1;
146 cerr <<
"VectorTable::getTable : Warning : Table is empty\n";
159 cerr <<
"VectorTable::setTable : Error : xmin and xmax cannot be the same when there are more than "
160 "two entries in the table!\n";
166 cerr <<
"VectorTable::setTable : Error : Cannot set with empty table!\n";
171 xDivs_ = table.size() - 1;
175 if ( table.size() > 1 )
224 in >> vecTable.
xMin_;
225 in >> vecTable.
xMax_;
228 for (
unsigned int i = 0; i < vecTable.
table_.size(); ++i )
239 vector< double > data;
241 double arr[11] = {0.0, 0.23, 0.41, 0.46, 0.42, 0.52, 0.49, 0.43, 0.38, 0.43, 0.44};
245 for (
int i = 0; i < 11; i++ )
246 data.push_back( arr[i] );
248 unInitedTable.
setMin( -0.5 );
249 unInitedTable.
setMax( 0.5 );
265 cout <<
"." << flush;
double lookupByValue(double) const
vector< double > getTable() const
bool tableIsEmpty() const
void setTable(vector< double >)
static const Cinfo * vectorTableCinfo
bool doubleEq(double x, double y)
unsigned int getDiv() const
istream & operator>>(istream &in, VectorTable &vecTable)
static const Cinfo * initCinfo()
static const Cinfo * initCinfo()
void setDiv(unsigned int)
double lookupByIndex(unsigned int) const