gstlearn  1.0.0
CCC
NeighBench Class Reference

#include <NeighBench.hpp>

Inheritance diagram for NeighBench:
ANeigh ASpaceObject ASerializable AStringable

Public Member Functions

 NeighBench (bool flag_xvalid=false, double width=0., const ASpace *space=nullptr)
 
 NeighBench (const NeighBench &r)
 
NeighBenchoperator= (const NeighBench &r)
 
virtual ~NeighBench ()
 
virtual int attach (const Db *dbin, const Db *dbout=nullptr) override
 Interface for ANeigh. More...
 
virtual VectorInt getNeigh (int iech_out) override
 
virtual bool hasChanged (int iech_out) const override
 
virtual int getMaxSampleNumber (const Db *db) const override
 
virtual ENeigh getType () const override
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface for AStringable. More...
 
double getWidth () const
 
- Public Member Functions inherited from ANeigh
 ANeigh (const ASpace *space=nullptr)
 
 ANeigh (const ANeigh &r)
 
ANeighoperator= (const ANeigh &r)
 
virtual ~ANeigh ()
 
virtual bool isConsistent (const ASpace *space) const override
 ASpaceObject Interface. More...
 
virtual VectorDouble summary (int iech_out)
 
virtual bool getFlagContinuous () const
 
VectorInt select (int iech_out)
 
bool isUnchanged () const
 
void setIsChanged ()
 
void reset ()
 
bool getFlagXvalid () const
 
bool getFlagKFold () const
 
void setFlagXvalid (bool flagXvalid)
 
void setFlagKFold (bool flagKFold)
 
void setFlagSimu (bool flagSimu)
 
void setRankColCok (const VectorInt &rankColCok)
 
- Public Member Functions inherited from ASpaceObject
 ASpaceObject (const ASpace *space=nullptr)
 
 ASpaceObject (const ASpace &space)
 
 ASpaceObject (const ASpaceObject &r)
 
ASpaceObjectoperator= (const ASpaceObject &r)
 
virtual ~ASpaceObject ()
 
const ASpacegetSpace () const
 Accessor to the current object space context. More...
 
bool isConsistent () const
 Indicate if I am consistent with my current space context. More...
 
VectorDouble getUnitaryVector () const
 Return unitary vector for the current space context. More...
 
unsigned int getNDim () const
 Shortcuts to ASpace methods. More...
 
const VectorDoublegetOrigin () const
 Return the current space context origin coordinates. More...
 
double getDistance (const SpacePoint &p1, const SpacePoint &p2) const
 Return the distance between two space points for the current space context. More...
 
double getDistance1D (const SpacePoint &p1, const SpacePoint &p2, int idim) const
 Return the distance along one direction between two space points. More...
 
VectorDouble getIncrement (const SpacePoint &p1, const SpacePoint &p2) const
 Return the increment vector between two space points for the current space context. More...
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 

Static Public Member Functions

static NeighBenchcreate (bool flag_xvalid=false, double width=0, const ASpace *space=nullptr)
 
static NeighBenchcreateFromNF (const String &neutralFilename, bool verbose=true)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Protected Member Functions

virtual bool _deserialize (std::istream &is, bool verbose=false) override
 Interface for ASerializable. More...
 
virtual bool _serialize (std::ostream &os, bool verbose=false) const override
 
String _getNFName () const override
 
- Protected Member Functions inherited from ANeigh
bool _isNbghMemoEmpty () const
 
void _neighCompress (VectorInt &ranks)
 
void _display (const VectorInt &ranks)
 
bool _discardUndefined (int iech)
 
int _xvalid (int iech_in, int iech_out, double eps=EPSILON9)
 
bool _isDimensionValid (int idim) const
 
- Protected Member Functions inherited from ASpaceObject
void setNDim (int ndim)
 Modify the Space dimension of an already created item (To be used only during creation ... in particular when reading NF) More...
 
- Protected Member Functions inherited from ASerializable
bool _fileOpenWrite (const String &filename, std::ofstream &os, bool verbose=false) const
 
bool _fileOpenRead (const String &filename, std::ifstream &is, bool verbose=false) const
 

Private Member Functions

bool _isSameTargetBench (int iech_out) const
 
void _bench (int iech_out, VectorInt &ranks)
 

Private Attributes

double _width
 
BiTargetCheckBench_biPtBench
 
SpaceTarget _T1
 
SpaceTarget _T2
 

Additional Inherited Members

- Static Protected Member Functions inherited from ASerializable
static bool _commentWrite (std::ostream &os, const String &comment)
 
template<typename T >
static bool _recordWrite (std::ostream &os, const String &title, const T &val)
 
template<typename T >
static bool _recordWriteVec (std::ostream &os, const String &title, const VectorT< T > &vec)
 
template<typename T >
static bool _recordRead (std::istream &is, const String &title, T &val)
 
template<typename T >
static bool _recordReadVec (std::istream &is, const String &title, VectorT< T > &vec, int nvalues)
 
static bool _onlyBlanks (char *string)
 
static bool _tableRead (std::istream &is, const String &string, int ntab, double *tab)
 
static bool _tableWrite (std::ostream &os, const String &string, int ntab, const VectorDouble &tab)
 
- Protected Attributes inherited from ANeigh
const Db_dbin
 
const Db_dbout
 
const DbGrid_dbgrid
 
VectorInt _rankColCok
 
int _iechMemo
 
bool _flagSimu
 
bool _flagXvalid
 
bool _flagKFold
 
- Protected Attributes inherited from ASpaceObject
const ASpace_space
 Current space context of the object. More...
 

Constructor & Destructor Documentation

◆ NeighBench() [1/2]

NeighBench::NeighBench ( bool  flag_xvalid = false,
double  width = 0.,
const ASpace space = nullptr 
)

◆ NeighBench() [2/2]

NeighBench::NeighBench ( const NeighBench r)

◆ ~NeighBench()

NeighBench::~NeighBench ( )
virtual

Member Function Documentation

◆ _bench()

void NeighBench::_bench ( int  iech_out,
VectorInt ranks 
)
private

Search for the bench neighborhood, according to the last coordinate

Parameters
[in]iech_outrank of the output sample
[out]ranksVector of samples elected in the Neighborhood

◆ _deserialize()

bool NeighBench::_deserialize ( std::istream &  is,
bool  verbose = false 
)
overrideprotectedvirtual

Interface for ASerializable.

Reimplemented from ANeigh.

◆ _getNFName()

String NeighBench::_getNFName ( ) const
inlineoverrideprotectedvirtual

Reimplemented from ANeigh.

◆ _isSameTargetBench()

bool NeighBench::_isSameTargetBench ( int  iech_out) const
private

◆ _serialize()

bool NeighBench::_serialize ( std::ostream &  os,
bool  verbose = false 
) const
overrideprotectedvirtual

Reimplemented from ANeigh.

◆ attach()

int NeighBench::attach ( const Db dbin,
const Db dbout = nullptr 
)
overridevirtual

Interface for ANeigh.

Reimplemented from ANeigh.

◆ create()

NeighBench * NeighBench::create ( bool  flag_xvalid = false,
double  width = 0,
const ASpace space = nullptr 
)
static

◆ createFromNF()

NeighBench * NeighBench::createFromNF ( const String neutralFilename,
bool  verbose = true 
)
static

Create a Neighborhood by loading the contents of a Neutral File

Parameters
neutralFilenameName of the Neutral File
verboseVerbose flag
Returns

◆ getMaxSampleNumber()

int NeighBench::getMaxSampleNumber ( const Db db) const
overridevirtual

Given a Db, returns the maximum number of samples per NeighBenchborhood

Parameters
dbPointer to the target Db
Returns

Implements ANeigh.

◆ getNeigh()

VectorInt NeighBench::getNeigh ( int  iech_out)
overridevirtual

Select the neighborhood

Returns
Vector of sample ranks in neighborhood (empty when error)
Parameters
[in]iech_outValid Rank of the sample in the output Db

Implements ANeigh.

◆ getType()

virtual ENeigh NeighBench::getType ( ) const
inlineoverridevirtual

Reimplemented from ANeigh.

◆ getWidth()

double NeighBench::getWidth ( ) const
inline

◆ hasChanged()

bool NeighBench::hasChanged ( int  iech_out) const
overridevirtual

Reimplemented from ANeigh.

◆ operator=()

NeighBench & NeighBench::operator= ( const NeighBench r)

◆ toString()

String NeighBench::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Interface for AStringable.

Reimplemented from ASpaceObject.

Member Data Documentation

◆ _biPtBench

BiTargetCheckBench* NeighBench::_biPtBench
private

◆ _T1

SpaceTarget NeighBench::_T1
mutableprivate

◆ _T2

SpaceTarget NeighBench::_T2
mutableprivate

◆ _width

double NeighBench::_width
private

The documentation for this class was generated from the following files: