Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
USOGFunc.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/scoring/constraints/USOGFunc.hh
11 /// @author Christopher Miles (cmiles@uw.edu)
12 
13 #ifndef CORE_SCORING_CONSTRAINTS_USOGFUNC_HH_
14 #define CORE_SCORING_CONSTRAINTS_USOGFUNC_HH_
15 
16 // Package headers
19 
20 // Project headers
21 #include <core/types.hh>
22 
23 // Utility headers
24 #include <utility/exit.hh>
25 #include <utility/vector1.hh>
26 
27 // C/C++ headers
28 #include <iostream>
29 
30 namespace core {
31 namespace scoring {
32 namespace constraints {
33 
34 /// @brief Unnormalized, unbounded sum of Gaussians constraint
35 class USOGFunc : public Func {
36  public:
39 
40  /// @brief Used in conjunction with read_data() to initialize a new instance
41  USOGFunc() {};
42 
43  /// @brief Constructs a new instance from the specified lists of means,
44  /// standard deviations, and weights. Assumes that all lists have equal
45  /// length and weights sum to 1.
47  const utility::vector1<core::Real>& std_devs,
48  const utility::vector1<core::Real>& weights);
49 
50  /// @brief No-op virtual destructor
51  ~USOGFunc() {}
52 
53  FuncOP clone() const;
54 
55  /// @brief Returns a value representing this function evaluated at a given point
56  core::Real func(const core::Real x) const;
57 
58  /// @brief Returns a value representing the derivative of this function evaluated at a given point
59  core::Real dfunc(const core::Real x) const;
60 
61  /// @brief Initializes this function from the given input stream
62  void read_data(std::istream& in);
63 
64  /// @brief Writes the definition of this function to the specific output stream
65  void show_definition(std::ostream& out) const;
66 
67  /// @brief Returns the number of Gaussian components
68  core::Size numGaussians() const;
69 
70 private:
71  /// @brief Resets all information associated with this instance
72  void resetInstance();
73 
74  /// @brief Computes and returns the sum of Gaussians score.
75  /// Responsible for ensuring that the resulting value will not
76  /// cause domain errors when provided to log().
77  core::Real gaussianScore(const core::Real x) const;
78 
82 };
83 
84 
85 /// @brief Reads and returns a single floating point value from the specified
86 /// input stream, aborting if either the failbit or badbit is flipped.
87 core::Real readValueOrDie(std::istream& in);
88 
89 } // namespace constraints
90 } // namespace scoring
91 } // namespace core
92 
93 #endif // CORE_SCORING_CONSTRAINTS_USOGFUNC_HH_