Dakota  Version 6.15
Explore and Predict with Confidence
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ExperimentResponse Class Reference

Container class for response functions and their derivatives. ExperimentResponse provides the body class. More...

Inheritance diagram for ExperimentResponse:
Response

Public Member Functions

 ExperimentResponse ()
 default constructor
 
 ExperimentResponse (const Variables &vars, const ProblemDescDB &problem_db)
 standard constructor built from problem description database
 
 ExperimentResponse (const SharedResponseData &srd, const ActiveSet &set)
 alternate constructor that shares a SharedResponseData instance
 
 ExperimentResponse (const SharedResponseData &srd)
 alternate constructor that shares a SharedResponseData instance
 
 ExperimentResponse (const ActiveSet &set)
 alternate constructor using limited data
 
 ~ExperimentResponse ()
 destructor
 
void set_scalar_covariance (RealVector &scalars) override
 method to set the covariance matrix defined for ExperimentResponse
 
const ExperimentCovariance & experiment_covariance () const override
 retrieve the ExperimentCovariance structure
 
void set_full_covariance (std::vector< RealMatrix > &matrices, std::vector< RealVector > &diagonals, RealVector &scalars, IntVector matrix_map_indices, IntVector diagonal_map_indices, IntVector scalar_map_indices) override
 method to set the full covariance matrices for ExperimentResponse
 
Real apply_covariance (const RealVector &residual) const override
 method to compute the triple product v'*inv(C)*v.
 
void apply_covariance_inv_sqrt (const RealVector &residuals, RealVector &weighted_residuals) const override
 method to compute (v'*inv(C)^1/2), to compute weighted residual
 
void apply_covariance_inv_sqrt (const RealMatrix &gradients, RealMatrix &weighted_gradients) const override
 
void apply_covariance_inv_sqrt (const RealSymMatrixArray &hessians, RealSymMatrixArray &weighted_hessians) const override
 
void get_covariance_diagonal (RealVector &diagonal) const override
 
Real covariance_determinant () const override
 covariance determinant for this experiment (default 1.0)
 
Real log_covariance_determinant () const override
 log covariance determinant for this experiment (default 0.0)
 
- Public Member Functions inherited from Response
 Response ()
 default constructor
 
 Response (short type, const Variables &vars, const ProblemDescDB &problem_db)
 standard constructor built from problem description database
 
 Response (const SharedResponseData &srd, const ActiveSet &set)
 alternate constructor that shares response data
 
 Response (short type, const ActiveSet &set)
 alternate constructor using limited data without sharing
 
 Response (const SharedResponseData &srd)
 alternate constructor using limited data (explicit disallows implicit type conversion)
 
 Response (const Response &response)
 copy constructor
 
virtual ~Response ()
 destructor
 
Response operator= (const Response &response)
 assignment operator
 
const SharedResponseDatashared_data () const
 return sharedRespData
 
SharedResponseDatashared_data ()
 return sharedRespData
 
size_t num_functions () const
 return the number of response functions
 
const ActiveSetactive_set () const
 return the active set
 
void active_set (const ActiveSet &set)
 set the active set
 
const ShortArray & active_set_request_vector () const
 return the active set request vector
 
ShortArray & active_set_request_vector ()
 return the active set request vector
 
void active_set_request_vector (const ShortArray &asrv)
 set the active set request vector and verify consistent number of response functions
 
const SizetArray & active_set_derivative_vector () const
 return the active set derivative vector
 
SizetArray & active_set_derivative_vector ()
 return the active set derivative vector
 
void active_set_derivative_vector (const SizetArray &asdv)
 set the active set derivative vector and reshape functionGradients/functionHessians if needed
 
const Real & function_value (size_t i) const
 return a function value
 
Real & function_value_view (size_t i)
 return a "view" of a function value for updating in place
 
const RealVector & function_values () const
 return all function values
 
RealVector function_values_view ()
 return all function values as a view for updating in place
 
RealVector function_values_view () const
 return all function values as a view for accessing the function values vector from a const response
 
void function_value (const Real &fn_val, size_t i)
 set a function value
 
void function_values (const RealVector &fn_vals)
 set all function values
 
const Real * function_gradient (int i) const
 return the i-th function gradient as a const Real*
 
RealVector function_gradient_view (int i)
 return the i-th function gradient as a SerialDenseVector view (shallow copy) for updating in place
 
RealVector function_gradient_view (int i) const
 return the i-th function gradient as a SerialDenseVector view (shallow copy) for accessing a column vector from a const matrix
 
RealVector function_gradient_copy (int i) const
 return the i-th function gradient as a SerialDenseVector Teuchos::Copy (deep copy)
 
const RealMatrix & function_gradients () const
 return all function gradients
 
RealMatrix function_gradients_view ()
 return all function gradients as a view for updating in place
 
RealMatrix function_gradients_view () const
 return all function gradients as a view for updating in place
 
void function_gradient (const RealVector &fn_grad, int i)
 set a function gradient
 
void function_gradients (const RealMatrix &fn_grads)
 set all function gradients
 
const RealSymMatrix & function_hessian (size_t i) const
 return the i-th function Hessian
 
RealSymMatrix function_hessian_view (size_t i)
 return the i-th function Hessian as a Teuchos::View (shallow copy) for updating in place
 
RealSymMatrix function_hessian_view (size_t i) const
 return the i-th function Hessian as a Teuchos::View (shallow copy) for accessing the i-th matrix within a const matrix array
 
const RealSymMatrixArray & function_hessians () const
 return all function Hessians
 
RealSymMatrixArray function_hessians_view ()
 return all function Hessians as Teuchos::Views (shallow copies) for updating in place
 
RealSymMatrixArray function_hessians_view () const
 return all function Hessians as Teuchos::Views (shallow copies) for updating in place
 
void function_hessian (const RealSymMatrix &fn_hessian, size_t i)
 set a function Hessian
 
void function_hessians (const RealSymMatrixArray &fn_hessians)
 set all function Hessians
 
const IntVector & field_lengths () const
 return the field lengths (from SharedResponseData)
 
void field_lengths (const IntVector &field_lens)
 set the field lengths (within SharedResponseData)
 
RealVector field_values_view (size_t i) const
 return const field values for the i-th field
 
RealVector field_values_view (size_t i)
 return a "view" of the i-th field values for updating in place
 
void field_values (const RealVector &field_val, size_t i)
 set the values for the i-th field
 
RealMatrix field_gradients_view (size_t i) const
 return a view of the gradients of each element of the i-th field
 
RealSymMatrixArray field_hessians_view (size_t i) const
 return a view of the hessians of each element of the i-th field
 
RealMatrix field_coords_view (size_t i)
 return a "view" of the i-th field's coordinates
 
const RealMatrix field_coords_view (size_t i) const
 return a const "view" of the i-th field's coordinates
 
void field_coords (const RealMatrix &field_coords, size_t i)
 set the i-th field's coordinates
 
const IntVector & num_coords_per_field () const
 return the number of coordinates each field has (from SharedResponseData)
 
const StringArray & function_labels () const
 return the fine-grained (unrolled) response function identifier strings from sharedRespData
 
void function_labels (const StringArray &labels)
 set the fine-grained (unrolled) response function identifier strings within sharedRespData
 
const StringArray & field_group_labels ()
 return the user-provided field group labels instead of the unrolled labels available through function_labels()
 
void read (std::istream &s, const unsigned short format=FLEXIBLE_RESULTS)
 read a response object of specified format from an std::istream
 
void write (std::ostream &s) const
 write a response object to an std::ostream
 
void read_annotated (std::istream &s)
 read a response object in annotated format from an std::istream
 
void write_annotated (std::ostream &s) const
 write a response object in annotated format to an std::ostream
 
void read_tabular (std::istream &s)
 read responseRep::functionValues in tabular format from an std::istream
 
void write_tabular (std::ostream &s) const
 write responseRep::functionValues in tabular format to an std::ostream
 
void write_tabular_labels (std::ostream &s) const
 write the labels to a tabular data stream
 
void read (MPIUnpackBuffer &s)
 read a response object from a packed MPI buffer
 
void write (MPIPackBuffer &s) const
 write a response object to a packed MPI buffer
 
Response copy (bool deep_srd=false) const
 return a deep response copy of the contained responseRep for use in history mechanisms (SharedResponseData uses a shallow copy by default)
 
int data_size ()
 return the number of doubles active in response. Used for sizing double* response_data arrays passed into read_data and write_data.
 
void read_data (double *response_data)
 read from an incoming double* array
 
void write_data (double *response_data)
 write to an incoming double* array
 
void overlay (const Response &response)
 add incoming response to functionValues/Gradients/Hessians
 
void update (const Response &response)
 Used in place of operator= when only results data updates are desired (functionValues/functionGradients/functionHessians are updated, ASV/labels/id's/etc. are not). Care is taken to allow different derivative array sizing between the two response objects.
 
void update (const RealVector &source_fn_vals, const RealMatrix &source_fn_grads, const RealSymMatrixArray &source_fn_hessians, const ActiveSet &source_set)
 Overloaded form which allows update from components of a response object. Care is taken to allow different derivative array sizing.
 
void update_partial (size_t start_index_target, size_t num_items, const Response &response, size_t start_index_source)
 partial update of this response object from another response object. The response objects may have different numbers of response functions.
 
void update_partial (size_t start_index_target, size_t num_items, const RealVector &source_fn_vals, const RealMatrix &source_fn_grads, const RealSymMatrixArray &source_fn_hessians, const ActiveSet &source_set, size_t start_index_source)
 Overloaded form which allows partial update from components of a response object. The response objects may have different numbers of response functions.
 
void reshape (size_t num_fns, size_t num_params, bool grad_flag, bool hess_flag)
 rehapes response data arrays
 
void reset ()
 resets all response data to zero
 
void reset_inactive ()
 resets all inactive response data to zero
 
bool is_null () const
 function to check responseRep (does this handle contain a body)
 

Protected Member Functions

void copy_rep (std::shared_ptr< Response > source_resp_rep) override
 Specialization of copy_rep; pulls base class data as well as derived specific data from the source rep into the this object.
 
- Protected Member Functions inherited from Response
 Response (BaseConstructor, const Variables &vars, const ProblemDescDB &problem_db)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
 Response (BaseConstructor, const SharedResponseData &srd, const ActiveSet &set)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
 Response (BaseConstructor, const ActiveSet &set)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
 Response (BaseConstructor, const SharedResponseData &srd)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 

Private Attributes

ExperimentCovariance expDataCovariance
 sigma terms...
 

Additional Inherited Members

- Protected Attributes inherited from Response
SharedResponseData sharedRespData
 reference-counted instance of shared response data: id's, labels
 
RealVector functionValues
 Abstract set of response functions. Ordered: [primary_scalar, primary_field, nonlinear_inequality, nonlinear_equality].
 
RealMatrix functionGradients
 first derivatives of the response functions More...
 
RealSymMatrixArray functionHessians
 second derivatives of the response functions
 
IntRealMatrixMap fieldCoords
 coordinates (independent vars like x,t) on which field values depend
 
ActiveSet responseActiveSet
 copy of the ActiveSet used by the Model to generate a Response instance
 

Detailed Description

Container class for response functions and their derivatives. ExperimentResponse provides the body class.

The ExperimentResponse class is the "representation" of the response container class. It is the "body" portion of the "handle-body idiom" (see Coplien "Advanced C++", p. 58). The handle class (Response) provides for memory efficiency in management of multiple response objects through reference counting and representation sharing. The body class (ExperimentResponse) actually contains the response data (functionValues, functionGradients, functionHessians, etc.). The representation is hidden in that an instance of ExperimentResponse may only be created by Response. Therefore, programmers create instances of the Response handle class, and only need to be aware of the handle/body mechanisms when it comes to managing shallow copies (shared representation) versus deep copies (separate representation used for history mechanisms).


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