/usr/include/openturns/NumericalSample.hxx is in libopenturns-dev 0.15-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | // -*- C++ -*-
/**
* @file NumericalSample.hxx
* @brief The class NumericalSample implements blank free samples
*
* (C) Copyright 2005-2011 EDF-EADS-Phimeca
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @author: $LastChangedBy: schueller $
* @date: $LastChangedDate: 2011-05-24 19:30:41 +0200 (Tue, 24 May 2011) $
* Id: $Id: NumericalSample.hxx 1910 2011-05-24 17:30:41Z schueller $
*/
#ifndef OPENTURNS_NUMERICALSAMPLE_HXX
#define OPENTURNS_NUMERICALSAMPLE_HXX
#include <iostream> // for std::ostream
#include "TypedInterfaceObject.hxx"
#include "NumericalPoint.hxx"
#include "Description.hxx"
#include "Pointer.hxx"
#include "NumericalSampleImplementation.hxx"
#include "Exception.hxx"
namespace OpenTURNS
{
namespace Base
{
namespace Stat
{
/**
* @class NumericalSample
*/
class NumericalSample
: public Common::TypedInterfaceObject<NumericalSampleImplementation>
{
CLASSNAME;
public:
/* Some typedefs for easy reading */
typedef Type::Description Description;
typedef Common::OutOfBoundException OutOfBoundException;
typedef Common::InvalidArgumentException InvalidArgumentException;
typedef NumericalSampleImplementation::NumericalPoint NumericalPoint;
typedef NumericalSampleImplementation::Indices Indices;
typedef NumericalSampleImplementation::CovarianceMatrix CovarianceMatrix;
typedef NumericalSampleImplementation::SquareMatrix SquareMatrix;
typedef NumericalSampleImplementation::CorrelationMatrix CorrelationMatrix;
public:
/** Factory of NumericalSample from CSV file */
static NumericalSample ImportFromCSVFile(const FileName & fileName);
/** Export NumericalSample into CSV file */
void exportToCSVFile(const FileName & fileName,
const Bool withDescription = false) const;
/** Export a sample as a matrix, one row by realization, in a format suitable to exchange with R. */
String streamToRFormat() const;
public:
/**
* Default constructor
* Build a NumericalSample of 1 dimension and with size equal to 0
*/
NumericalSample();
/** Constructor with size and dimension */
NumericalSample(const UnsignedLong size,
const UnsignedLong dim);
/** Constructor from a NumericalPoint (all elements are equal to the NumericalPoint) */
NumericalSample(const UnsignedLong size,
const NumericalPoint & point);
/** Constructor from implementation */
NumericalSample(const NumericalSampleImplementation & implementation);
private:
/** Constructor from implementation */
NumericalSample(const Implementation & implementation);
public:
/** Comparison operator */
Bool operator ==(const NumericalSample & other) const;
#ifndef SWIG
NSI_point operator [] (const UnsignedLong index);
NSI_const_point operator [] (const UnsignedLong index) const;
NSI_point at (const UnsignedLong index);
NSI_const_point at (const UnsignedLong index) const;
NumericalScalar & atLinearIndex (const UnsignedLong index);
const NumericalScalar & atLinearIndex (const UnsignedLong index) const;
NumericalScalar & operator () (const UnsignedLong i,
const UnsignedLong j);
const NumericalScalar & operator () (const UnsignedLong i,
const UnsignedLong j) const;
NumericalScalar & at (const UnsignedLong i,
const UnsignedLong j);
const NumericalScalar & at (const UnsignedLong i,
const UnsignedLong j) const;
void erase(NumericalSampleImplementation::iterator first, NumericalSampleImplementation::iterator last);
#endif
/* Method __len__() is for Python */
UnsignedLong __len__() const;
/* Method __contains__() is for Python */
Bool __contains__(const NumericalPoint & val) const;
const NumericalPoint __getitem__ (const UnsignedLong index) const;
void __setitem__ (const UnsignedLong index,
const NumericalPoint & val);
void erase(const UnsignedLong first,
const UnsignedLong last);
void erase(const UnsignedLong index);
/** erase the whole sample */
void clear();
/**
* String converter
* This method shows human readable information on the
* internal state of an NumericalSample. It is used when streaming
* the NumericalSample or for user information.
*/
String __repr__() const;
String __str__(const String & offset = "") const;
/** Description accessor */
void setDescription(const Description & description);
Description getDescription() const;
/** Dimension accessor */
UnsignedLong getDimension() const;
/** Size accessor */
UnsignedLong getSize() const;
/** Maximum accessor */
NumericalPoint getMax() const;
/** Minimum accessor */
NumericalPoint getMin() const;
/** Method add() appends an element to the collection */
void add(const NumericalPoint & point) /* throw(InvalidArgumentException) */;
/* Method add() appends another sample to the collection */
void add(const NumericalSample & sample) /* throw(InvalidArgumentException) */;
/**
* Method split() trunk the sample before the index passed as argument
* and returns the remainder as new sample. This method tries its best not for doubling
* memory usage.
*/
NumericalSample split(const UnsignedLong index)
/* throw (OutOfBoundException) */;
/**
* Method computeMean() gives the mean of the sample, based on the formula
* mean = sum of the elements in the sample / size of the sample
*/
NumericalPoint computeMean() const;
/**
* Method computeCovariance() gives the covariance of the sample
*/
CovarianceMatrix computeCovariance() const;
/**
* Method computeStandardDeviation() gives the standard deviation of the sample
*/
SquareMatrix computeStandardDeviation() const;
/**
* Method computeStandardDeviationPerComponent() gives the standard deviation of each component of the sample
*/
NumericalPoint computeStandardDeviationPerComponent() const;
/**
* Method computePearsonCorrelation() gives the Pearson correlation matrix of the sample
*/
CorrelationMatrix computePearsonCorrelation() const;
/**
* Method computeSpearmanCorrelation() gives the Spearman correlation matrix of the sample
*/
CorrelationMatrix computeSpearmanCorrelation() const;
/**
* Gives the Kendall correlation matrix of the sample
*/
CorrelationMatrix computeKendallTau() const;
/**
* Method computeRangePerComponent gives the range of the sample (by component)
*/
NumericalPoint computeRangePerComponent() const;
/**
* Method computeMedianPerComponent() gives the median of the sample (by component)
*/
NumericalPoint computeMedianPerComponent() const;
/**
* Method computeVariance() gives the variance of the sample (by component)
*/
NumericalPoint computeVariancePerComponent() const;
/**
* Method computeSkewness() gives the skewness of the sample (by component)
*/
NumericalPoint computeSkewnessPerComponent() const;
/**
* Method computeKurtosis() gives the kurtosis of the sample (by component)
*/
NumericalPoint computeKurtosisPerComponent() const;
/**
* Gives the centered moment of order k of the sample (by component)
*/
NumericalPoint computeCenteredMomentPerComponent(const UnsignedLong k) const;
/**
* Method computeQuantilePerComponent() gives the quantile per component of the sample
*/
NumericalPoint computeQuantilePerComponent(const NumericalScalar prob) const;
/**
* Method computeQuantile() gives the N-dimension quantile of the sample
*/
NumericalPoint computeQuantile(const NumericalScalar prob) const;
/**
* Get the empirical CDF of the sample
*/
NumericalScalar computeEmpiricalCDF(const NumericalPoint & point,
const Bool tail = false) const;
/**
* Get the position of a point in the sample.
* Returns size+1 if the point does not belong to the sample.
*/
UnsignedLong find(const NumericalPoint & point) const;
/**
* Translate realizations in-place
*/
void translate(const NumericalPoint & translation);
/**
* Scale realizations componentwise in-place
*/
void scale(const NumericalPoint & scaling);
/** Ranked sample */
NumericalSample rank() const;
/** Ranked component */
NumericalSample rank(const UnsignedLong index) const;
/** Sorted sample */
NumericalSample sort() const;
/** Sorted component */
NumericalSample sort(const UnsignedLong index) const;
/** Sorted according a component */
NumericalSample sortAccordingToAComponent(const UnsignedLong index) const;
/** Store a sample in a temporary text file, one realization by line. Returns the file name. */
virtual String storeToTemporaryFile() const;
/** Get the i-th marginal sample */
NumericalSample getMarginal(const UnsignedLong index) const /* throw(InvalidArgumentException) */;
/** Get the marginal sample corresponding to indices dimensions */
NumericalSample getMarginal(const Indices & indices) const /* throw(InvalidArgumentException) */;
/** Returns a pointer to the underlying implementation object */
virtual ImplementationAsPersistentObject getImplementationAsPersistentObject() const;
/** Sets the pointer to the underlying implementation object */
virtual void setImplementationAsPersistentObject(const ImplementationAsPersistentObject & obj);
}; /* class NumericalSample */
} /* namespace Stat */
} /* namespace Base */
} /* namespace OpenTURNS */
#endif /* OPENTURNS_NUMERICALSAMPLE_HXX */
|