1.8.0
CCC
 
Loading...
Searching...
No Matches
Reset the contents of an already existing Db

Functions

Id gstlrn::Db::resetFromSamples (Id nech, const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const 1 &tab=1(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true)
 
Id gstlrn::Db::resetFromCSV (const String &filename, bool verbose, const CSVformat &csvfmt, Id ncol_max=-1, Id nrow_max=-1, bool flagAddSampleRank=true)
 
Id gstlrn::Db::resetFromBox (Id nech, const 1 &coormin, const 1 &coormax, Id ndim=2, double extend=0., Id seed=321415, bool flagAddSampleRank=true)
 
Id gstlrn::Db::resetFromOnePoint (const 1 &tab=1(), bool flagAddSampleRank=true)
 
Id gstlrn::Db::resetSamplingDb (const Db *dbin, double proportion=0, Id number=0, const VectorString &names=VectorString(), Id seed=23241, bool verbose=false, bool flagAddSampleRank=true)
 
Id gstlrn::Db::resetReduce (const Db *dbin, const VectorString &names=VectorString(), const 1 &ranks=1(), bool verbose=false)
 
Id gstlrn::Db::resetFromGridRandomized (const DbGrid *dbin, double randperc=0., bool flagAddSampleRank=true)
 

Detailed Description

All methods enabling to Reset the contents of an already existing Db.

They clean the initial contents and replace it by the new one.

Function Documentation

◆ resetFromBox()

Id gstlrn::Db::resetFromBox ( Id  nech,
const 1 &  coormin,
const 1 &  coormax,
Id  ndim = 2,
double  extend = 0.,
Id  seed = 321415,
bool  flagAddSampleRank = true 
)

Create a Db generating samples randomly

Parameters
nechNumber of samples to be generated
coorminVector giving the smallest values of the coordinates
coormaxVector giving the largest values for the coordinates
ndimSpace dimension (used if 'coormin' and 'coormax' are empty)
extendExtension of the bounding box (if positive)
seedSeed for the random number generator
flagAddSampleRanktrue if the Sample ranks must be generated

◆ resetFromCSV()

Id gstlrn::Db::resetFromCSV ( const String filename,
bool  verbose,
const CSVformat csvfmt,
Id  ncol_max = -1,
Id  nrow_max = -1,
bool  flagAddSampleRank = true 
)

Creating a Db by reading a CSV file

Parameters
filenameName of the CSV file
verboseVerbose flag
csvfmtDescription of the CSV format
ncol_maxMaximum number of columns
nrow_maxMaximum number of rows
flagAddSampleRanktrue if the sample rank must be generated

◆ resetFromGridRandomized()

Id gstlrn::Db::resetFromGridRandomized ( const DbGrid dbin,
double  randperc = 0.,
bool  flagAddSampleRank = true 
)

◆ resetFromOnePoint()

Id gstlrn::Db::resetFromOnePoint ( const 1 &  tab = 1(),
bool  flagAddSampleRank = true 
)

Create a Db from a single sample whose coordinates are provided in 'tab'

Parameters
tabArray containing the coordinates of the single sample
flagAddSampleRanktrue if the Sample ranks must be generated

◆ resetFromSamples()

Id gstlrn::Db::resetFromSamples ( Id  nech,
const ELoadBy &  order = ELoadBy::fromKey("SAMPLE"),
const 1 &  tab = 1(),
const VectorString names = VectorString(),
const VectorString locatorNames = VectorString(),
bool  flagAddSampleRank = true 
)

◆ resetReduce()

Id gstlrn::Db::resetReduce ( const Db dbin,
const VectorString names = VectorString(),
const 1 &  ranks = 1(),
bool  verbose = false 
)

◆ resetSamplingDb()

Id gstlrn::Db::resetSamplingDb ( const Db dbin,
double  proportion = 0,
Id  number = 0,
const VectorString names = VectorString(),
Id  seed = 23241,
bool  verbose = false,
bool  flagAddSampleRank = true 
)

Sampling an input Db to create the output Db by selecting a subset of samples

Parameters
dbinPointer to the input Db
proportionProportion of samples to be retained
numberNumber of samples to be retained
namesVector of Names to be copied (empty: all names)
seedSeed used for the random number generator
verboseVerbose flag
flagAddSampleRanktrue if the sample rank must be generated
Remarks
A possible selection in 'dbin' will not be taken into account
You can use either 'proportion' or 'number'