1 // -*- C++ -*- 2 /** 3 * @brief The result of a tensor approximation 4 * 5 * Copyright 2005-2021 Airbus-EDF-IMACS-ONERA-Phimeca 6 * 7 * This library is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with this library. If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 #ifndef OPENTURNS_TENSORAPPROXIMATIONRESULT_HXX 22 #define OPENTURNS_TENSORAPPROXIMATIONRESULT_HXX 23 24 #include "openturns/MetaModelResult.hxx" 25 #include "openturns/Point.hxx" 26 #include "openturns/Sample.hxx" 27 #include "openturns/Indices.hxx" 28 #include "openturns/Collection.hxx" 29 #include "openturns/PersistentCollection.hxx" 30 #include "openturns/Function.hxx" 31 #include "openturns/Distribution.hxx" 32 #include "openturns/OrthogonalBasis.hxx" 33 #include "openturns/CanonicalTensorEvaluation.hxx" 34 35 BEGIN_NAMESPACE_OPENTURNS 36 37 38 39 /** 40 * @class TensorApproximationResult 41 * 42 * The result of a tensor approximation 43 */ 44 45 class OT_API TensorApproximationResult 46 : public MetaModelResult 47 { 48 CLASSNAME 49 50 public: 51 52 typedef Collection<Function> FunctionCollection; 53 typedef PersistentCollection<Function> FunctionPersistentCollection; 54 55 /** Default constructor */ 56 TensorApproximationResult(); 57 58 /** Parameter constructor */ 59 TensorApproximationResult(const Distribution & distribution, 60 const Function & transformation, 61 const Function & inverseTransformation, 62 const Function & composedModel, 63 const Collection<CanonicalTensorEvaluation> & tensorCollection, 64 const Point & residuals, 65 const Point & relativeErrors); 66 67 /** Virtual constructor */ 68 TensorApproximationResult * clone() const override; 69 70 /** String converter */ 71 String __repr__() const override; 72 String __str__(const String & offset = "") const override; 73 74 /** Distribution accessor */ 75 virtual Distribution getDistribution() const; 76 77 /** IsoProbabilisticTransformation accessor */ 78 virtual Function getTransformation() const; 79 80 /** InverseIsoProbabilisticTransformation accessor */ 81 virtual Function getInverseTransformation() const; 82 83 /** Composed model accessor */ 84 virtual Function getComposedModel() const; 85 86 /** Composed meta model accessor */ 87 virtual Function getComposedMetaModel() const; 88 89 CanonicalTensorEvaluation getTensor(const UnsignedInteger marginalIndex = 0) const; 90 91 /** Method save() stores the object through the StorageManager */ 92 void save(Advocate & adv) const override; 93 94 /** Method load() reloads the object from the StorageManager */ 95 void load(Advocate & adv) override; 96 97 98 protected: 99 100 private: 101 /** The input vector distribution */ 102 Distribution distribution_; 103 104 /** The isoprobabilistic transformation maps the distribution into the orthogonal measure */ 105 Function transformation_; 106 107 /** The inverse isoprobabilistic transformation */ 108 Function inverseTransformation_; 109 110 /** The composed model */ 111 Function composedModel_; 112 113 PersistentCollection<CanonicalTensorEvaluation> tensorCollection_; 114 115 /** Composed meta model */ 116 Function composedMetaModel_; 117 118 } ; /* class TensorApproximationResult */ 119 120 121 END_NAMESPACE_OPENTURNS 122 123 #endif /* OPENTURNS_TENSORAPPROXIMATIONRESULT_HXX */ 124