Some 'improvements' added
This commit is contained in:
parent
00780d785a
commit
49ee190e10
4 changed files with 45 additions and 41 deletions
|
|
@ -40,7 +40,7 @@ class eoFixedLength : public EO<FitT>, public std::vector<GeneType>
|
|||
{
|
||||
public :
|
||||
|
||||
typedef typename GeneType Type;
|
||||
typedef GeneType Type;
|
||||
|
||||
/// to avoid conflicts between EO::operator< and vector<double>::operator<
|
||||
bool operator<(const eoFixedLength<FitT, GeneType>& _eo) const
|
||||
|
|
@ -48,6 +48,31 @@ class eoFixedLength : public EO<FitT>, public std::vector<GeneType>
|
|||
return EO<FitT>::operator<(_eo);
|
||||
}
|
||||
|
||||
/// printing...
|
||||
void printOn(ostream& os) const
|
||||
{
|
||||
EO<FitT>::printOn(os);
|
||||
os << ' ';
|
||||
|
||||
os << size() << ' ';
|
||||
|
||||
std::copy(begin(), end(), ostream_iterator<double>(os));
|
||||
}
|
||||
|
||||
/// reading...
|
||||
void readFrom(istream& is)
|
||||
{
|
||||
EO<FitT>::readFrom(is);
|
||||
|
||||
unsigned sz;
|
||||
is >> sz;
|
||||
|
||||
resize(sz);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sz; ++i)
|
||||
is >> operator[](i);
|
||||
}
|
||||
};
|
||||
|
||||
/// to avoid conflicts between EO::operator< and vector<double>::operator<
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ template <class Fit>
|
|||
class eoEsFull : public eoFixedLength<Fit, double>
|
||||
{
|
||||
public :
|
||||
typedef double Type;
|
||||
|
||||
eoEsFull(void) : eoFixedLength<Fit, double>() {}
|
||||
|
||||
|
|
@ -47,10 +48,8 @@ class eoEsFull : public eoFixedLength<Fit, double>
|
|||
|
||||
void printOn(std::ostream& os) const
|
||||
{
|
||||
os << size() << ' ';
|
||||
eoFixedLength<Fit,double>::printOn(os);
|
||||
|
||||
std::copy(begin(), end(), std::ostream_iterator<double>(os));
|
||||
|
||||
os << ' ';
|
||||
std::copy(stdevs.begin(), stdevs.end(), std::ostream_iterator<double>(os));
|
||||
|
||||
|
|
@ -63,21 +62,15 @@ class eoEsFull : public eoFixedLength<Fit, double>
|
|||
|
||||
void readFrom(istream& is)
|
||||
{
|
||||
unsigned sz;
|
||||
is >> sz;
|
||||
eoFixedLength<Fit,double>::readFrom(is);
|
||||
|
||||
stdevs.resize(size());
|
||||
|
||||
resize(sz);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sz; ++i)
|
||||
is >> operator[](i);
|
||||
|
||||
stdevs.resize(sz);
|
||||
|
||||
for (i = 0; i < sz; ++i)
|
||||
for (i = 0; i < size(); ++i)
|
||||
is >> stdevs[i];
|
||||
|
||||
correlations.resize(sz*(sz - 1) / 2);
|
||||
correlations.resize(size()*(size() - 1) / 2);
|
||||
|
||||
for (i = 0; i < correlations.size(); ++i)
|
||||
is >> correlations[i];
|
||||
|
|
|
|||
|
|
@ -48,29 +48,22 @@ class eoEsSimple : public eoFixedLength<Fit, double>
|
|||
{
|
||||
public :
|
||||
|
||||
typedef double Type;
|
||||
|
||||
eoEsSimple(void) : eoFixedLength<Fit, double>() {}
|
||||
|
||||
std::string className(void) const { return "eoEsSimple"; }
|
||||
|
||||
void printOn(ostream& os) const
|
||||
void printOn(std::ostream& os) const
|
||||
{
|
||||
os << size() << ' ';
|
||||
eoFixedLength<Fit,double>::printOn(os);
|
||||
|
||||
std::copy(begin(), end(), ostream_iterator<double>(os));
|
||||
|
||||
os << ' ' << stdev << ' ';
|
||||
}
|
||||
|
||||
void readFrom(istream& is)
|
||||
{
|
||||
unsigned sz;
|
||||
is >> sz;
|
||||
|
||||
resize(sz);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sz; ++i)
|
||||
is >> operator[](i);
|
||||
eoFixedLength<Fit,double>::readFrom(is);
|
||||
|
||||
is >> stdev;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@ template <class Fit>
|
|||
class eoEsStdev : public eoFixedLength<Fit, double>
|
||||
{
|
||||
public :
|
||||
|
||||
|
||||
typedef double Type;
|
||||
|
||||
eoEsStdev(void) : eoFixedLength<Fit, double>() {}
|
||||
|
||||
std::string className(void) const { return "eoEsStdev"; }
|
||||
|
||||
void printOn(std::ostream& os) const
|
||||
{
|
||||
os << size() << ' ';
|
||||
|
||||
std::copy(begin(), end(), std::ostream_iterator<double>(os));
|
||||
eoFixedLength<Fit,double>::printOn(os);
|
||||
|
||||
os << ' ';
|
||||
std::copy(stdevs.begin(), stdevs.end(), std::ostream_iterator<double>(os));
|
||||
|
|
@ -59,18 +59,11 @@ class eoEsStdev : public eoFixedLength<Fit, double>
|
|||
|
||||
void readFrom(istream& is)
|
||||
{
|
||||
unsigned sz;
|
||||
is >> sz;
|
||||
eoFixedLength<Fit,double>::readFrom(is);
|
||||
stdevs.resize(size());
|
||||
|
||||
resize(sz);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sz; ++i)
|
||||
is >> operator[](i);
|
||||
|
||||
stdevs.resize(sz);
|
||||
|
||||
for (i = 0; i < sz; ++i)
|
||||
for (i = 0; i < size(); ++i)
|
||||
is >> stdevs[i];
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue