25 #include <queso/VectorSpace.h>
26 #include <queso/BoxSubset.h>
27 #include <queso/GslVector.h>
28 #include <queso/GslMatrix.h>
33 template<
class V,
class M>
39 m_minValues(minValues),
40 m_maxValues(maxValues)
42 queso_require_equal_to_msg(minValues.sizeLocal(), maxValues.sizeLocal(),
"vectors 'minValues' and 'maxValues' should have the same size");
43 queso_require_equal_to_msg(minValues.sizeLocal(), vectorSpace.
dimLocal(),
"sizes of vectors 'minValues' and 'maxValues' should be equal to dimension of the vector space");
44 for (
unsigned int i = 0; i <
m_vectorSpace->dimLocal(); ++i) {
45 queso_require_less_equal_msg(minValues[i], maxValues[i],
"it should happen minValue <= maxValue for all dimensions");
49 for (
unsigned int i = 0; i <
m_vectorSpace->dimLocal(); ++i) {
55 template<
class V,
class M>
61 template<
class V,
class M>
67 return (!vec.atLeastOneComponentSmallerThan(m_minValues) &&
68 !vec.atLeastOneComponentBiggerThan (m_maxValues));
72 template<
class V,
class M>
82 template<
class V,
class M>
87 for (
unsigned int i = 0; i < m_vectorSpace->dimLocal(); ++i) {
88 double length_i = (m_maxValues[i] - m_minValues[i]);
89 mat(i,i) = length_i*length_i*length_i/12;
94 template<
class V,
class M>
100 template<
class V,
class M>
107 template <
class V,
class M>
110 os <<
"In BoxSubset<V,M>::print()"
111 <<
": m_minValues = " << m_minValues
112 <<
", m_maxValues = " << m_maxValues
113 <<
", m_volume = " << m_volume
void centroid(V &vec) const
Returns the centroid of this box subset in the vector vec.
void moments(M &mat) const
Returns the moments of inertia of this box subset in the matrix mat.
A class representing a vector space.
A templated class for handling subsets.
const VectorSpace< V, M > * m_vectorSpace
const V & minValues() const
Vector of the minimum values of the box subset.
Class representing a subset of a vector space shaped like a hypercube.
void print(std::ostream &os) const
Prints the volume, the minimum and the maximum values of this.
V m_minValues
Vector of templated type V to store the minimum values of the box subset class.
V m_maxValues
Vector of templated type V to store the maximum values of the box subset class.
unsigned int dimLocal() const
BoxSubset(const char *prefix, const VectorSpace< V, M > &vectorSpace, const V &minValues, const V &maxValues)
Shaped, default constructor.
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
bool contains(const V &vec) const
Checks whether this box subset contains vector vec.
const V & maxValues() const
Vector of the maximum values of the box subset.