con_closed.cpp
Go to the documentation of this file.
1/** @file con_closed.cpp Conditionalclosedness */
2
3/*
4 * Implementation of the conditionally clossed algorithm
5 *
6 * Copyright (C) 2011 Tomas Masopust
7 *
8 */
9
10
11#include "con_closed.h"
12#include <vector>
13
14namespace faudes {
15
16bool IsConditionalClosed(const GeneratorVector& specVect, const Generator& pk, const GeneratorVector& genVect, const Generator& gk) {
17 FD_DF("Conditionalclosedness checking...");
18
19 Idx i;
20
21 // there must be the same number of parameters
22 if (specVect.Size() != genVect.Size()) {
23 std::stringstream errstr;
24 errstr << "The sizes of specVect and genVect are different.";
25 throw Exception("ConditionalClosedness", errstr.str(), 201);
26 }
27
28 // the generators must be deterministic
29 for (i = 0; i < specVect.Size(); i++) {
30 if (specVect.At(i).IsDeterministic() == false) {
31 std::stringstream errstr;
32 errstr << "Generators of specVect must be deterministic, but there is a nondeterministic one";
33 throw Exception("ConditionalClosednes", errstr.str(), 201);
34 }
35 }
36
37 if (pk.IsDeterministic() == false) {
38 std::stringstream errstr;
39 errstr << "Generator pk must be deterministic, but is nondeterministic";
40 throw Exception("ConditionalClosedness", errstr.str(), 201);
41 }
42
43 for (i = 0; i < genVect.Size(); i++) {
44 if (genVect.At(i).IsDeterministic() == false) {
45 std::stringstream errstr;
46 errstr << "Generators of genVect must be deterministic, but there is a nondeterministic one";
47 throw Exception("ConditionalClosedness", errstr.str(), 201);
48 }
49 }
50
51 if (gk.IsDeterministic() == false) {
52 std::stringstream errstr;
53 errstr << "Generator gk must be deterministic, but is nondeterministic";
54 throw Exception("ConditionalClosedness", errstr.str(), 201);
55 }
56
57 // check if P_k(K) is Lm(G_k)-closed
58 if (IsRelativelyClosed(gk,pk) == false) {
59 return false;
60 }
61
62 // check if P_{i+k}(K) is Lm(G_i)||P_k(K)-closed
63 for (i = 0; i < specVect.Size(); i++) {
64 Generator helpPlant;
65 Parallel(genVect.At(i),pk,helpPlant);
66 if (IsRelativelyClosed(helpPlant,specVect.At(i)) == false) {
67 return false;
68 }
69 }
70
71 return true;
72}
73
74
75} // name space
76
77
78
#define FD_DF(message)
virtual const T & At(const Position &pos) const
bool IsDeterministic(void) const
bool IsConditionalClosed(const GeneratorVector &specVect, const Generator &pk, const GeneratorVector &genVect, const Generator &gk)
void Parallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
bool IsRelativelyClosed(const Generator &rGenPlant, const Generator &rGenCand)
uint32_t Idx

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen