25 #include <queso/VectorSet.h>
26 #include <queso/VectorSpace.h>
27 #include <queso/ConcatenationSubset.h>
28 #include <queso/GslVector.h>
29 #include <queso/GslMatrix.h>
34 template<
class V,
class M>
39 :
VectorSubset<V,M>(prefix, vectorSpace, set1.volume()*set2.volume()),
47 template<
class V,
class M>
55 for (
unsigned int i = 0; i <
m_sets.size(); ++i) {
61 template<
class V,
class M>
67 template<
class V,
class M>
72 std::vector<V*> vecs(m_sets.size(),(V*) NULL);
73 for (
unsigned int i = 0; i < vecs.size(); ++i) {
74 vecs[i] =
new V(m_sets[i]->vectorSpace().zeroVector());
77 unsigned int cummulativeSize = 0;
78 for (
unsigned int i = 0; i < vecs.size(); ++i) {
79 vec.cwExtract(cummulativeSize,*(vecs[i]));
80 cummulativeSize += vecs[i]->sizeLocal();
85 for (
unsigned int i = 0; i < m_sets.size(); ++i) {
86 result = result && m_sets[i]->contains(*(vecs[i]));
88 for (
unsigned int i = 0; i < vecs.size(); ++i) {
95 template<
class V,
class M>
98 unsigned int cumulativeSize = 0;
99 for (
unsigned int i = 0; i < m_sets.size(); ++i) {
100 V subvec(m_sets[i]->vectorSpace().zeroVector());
101 m_sets[i]->centroid(subvec);
102 vec.cwSet(cumulativeSize,subvec);
104 cumulativeSize += subvec.sizeLocal();
110 template<
class V,
class M>
113 unsigned int cumulativeSize = 0;
114 for (
unsigned int i = 0; i < m_sets.size(); ++i) {
115 const Map & map = m_sets[i]->vectorSpace().map();
117 M submat(m_sets[i]->vectorSpace().env(),
119 m_sets[i]->moments(submat);
120 mat.cwSet(cumulativeSize,cumulativeSize,submat);
122 cumulativeSize += n_columns;
129 template <
class V,
class M>
132 os <<
"In ConcatenationSubset<V,M>::print()"
133 <<
": m_sets.size() = " << m_sets.size()
135 for (
unsigned int i = 0; i < m_sets.size(); ++i) {
136 os <<
"m_sets[" << i <<
"] = " << *(m_sets[i]);
137 if (i < (m_sets.size()-1)) {
virtual void moments(M &mat) const
Returns the set moments of inertia in the matrix mat.
bool contains(const V &vec) const
Determines whether each one of the subsets m_sets (class' private attributes) contains vector vec...
A class for partitioning vectors and matrices.
A class representing a vector space.
A templated class representing the concatenation of two vector subsets.
ConcatenationSubset(const char *prefix, const VectorSpace< V, M > &vectorSpace, const VectorSet< V, M > &set1, const VectorSet< V, M > &set2)
Constructor - two sets only.
A templated class for handling subsets.
virtual void centroid(V &vec) const
Returns the set centroid in the vector vec.
A templated class for handling sets.
~ConcatenationSubset()
Destructor.
void print(std::ostream &os) const
Prints the subsets (via protected attribute m_sets).
int NumGlobalElements() const
Returns the total number of elements across all processors.
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"))
std::vector< const VectorSet< V, M > * > m_sets