2 #ifndef OPENGM_GRAPHICALMODEL_FACTOR_HXX 3 #define OPENGM_GRAPHICALMODEL_FACTOR_HXX 32 template<
class FACTOR,
class FUNCTOR>
41 typedef typename FACTOR::VariablesIteratorType
ViIterator;
43 template<
class FUNCTION>
45 functor_(factor_.variableIndicesBegin(),factor_.variableIndicesEnd(),
function);
58 class FUNCTION_TYPE_LIST,
62 template<
class GRAPHICAL_MODEL>
class Factor;
66 void save(
const GM&,
const std::string&,
const std::string&);
68 void load(GM_& gm,
const std::string&,
const std::string&);
71 namespace functionwrapper {
73 template<
size_t IX,
size_t DX,
bool END>
74 struct FactorInvariant;
75 template<
size_t IX,
size_t DX>
76 struct FactorInvariant<IX, DX, false> {
77 template<
class GM,
class FACTOR>
78 void static op(
const GM &,
const FACTOR &);
80 template<
size_t IX,
size_t DX>
81 struct FactorInvariant<IX, DX, true> {
82 template<
class GM,
class FACTOR>
83 void static op(
const GM &,
const FACTOR &);
88 namespace detail_graphical_model {
90 struct FunctionWrapper;
91 template<
size_t DX,
class VALUE_TYPE>
92 struct FunctionValueWrapper;
93 template<
size_t IX,
size_t DX,
bool end>
94 struct FunctionWrapperExecutor;
95 template<
size_t IX,
size_t DX,
bool end,
class VALUE_TYPE>
96 struct FunctionValueWrapperExecutor;
102 template<
class GRAPHICAL_MODEL>
108 NrOfFunctionTypes = GraphicalModelType::NrOfFunctionTypes
112 typedef typename GraphicalModelType::ValueType
ValueType;
113 typedef typename GraphicalModelType::LabelType
LabelType;
114 typedef typename GraphicalModelType::IndexType
IndexType;
117 typedef FactorShapeAccessor<Factor<GRAPHICAL_MODEL> > ShapeAccessorType;
129 Factor(GraphicalModelPointerType);
131 Factor(GraphicalModelPointerType,
const IndexType,
const UInt8Type,
const IndexType,
const IndexType);
138 IndexType size()
const;
139 IndexType numberOfVariables()
const;
140 IndexType numberOfLabels(
const IndexType)
const;
141 IndexType shape(
const IndexType)
const;
142 IndexType variableIndex(
const IndexType)
const;
143 ShapeIteratorType shapeBegin()
const;
144 ShapeIteratorType shapeEnd()
const;
145 template<
size_t FUNCTION_TYPE_INDEX>
146 const typename meta::TypeAtTypeList<FunctionTypeList, FUNCTION_TYPE_INDEX>::type&
function()
const;
147 VariablesIteratorType variableIndicesBegin()
const;
148 VariablesIteratorType variableIndicesEnd()
const;
149 template<
class ITERATOR>
152 template<
class FUNCTOR>
153 void callFunctor(FUNCTOR & f)
const;
155 template<
class FUNCTOR>
156 void callViFunctor(FUNCTOR & f)
const;
158 template<
class ITERATOR>
159 void copyValues(ITERATOR iterator)
const;
160 template<
class ITERATOR>
161 void copyValuesSwitchedOrder(ITERATOR iterator)
const;
162 template<
int FunctionType,
class ITERATOR>
165 IndexType functionIndex()
const;
166 template<
class ITERATOR>
167 void variableIndices(ITERATOR out)
const;
168 bool isPotts()
const;
169 bool isGeneralizedPotts()
const;
170 bool isSubmodular()
const;
171 bool isSquaredDifference()
const;
172 bool isTruncatedSquaredDifference()
const;
173 bool isAbsoluteDifference()
const;
174 bool isTruncatedAbsoluteDifference()
const;
175 bool isLinearConstraint()
const;
176 template<
int PROPERTY>
177 bool binaryProperty()
const;
178 template<
int PROPERTY>
179 ValueType valueProperty()
const;
181 template<
class FUNCTOR>
182 void forAllValuesInAnyOrder(FUNCTOR & functor)
const;
183 template<
class FUNCTOR>
184 void forAtLeastAllUniqueValues(FUNCTOR & functor)
const;
185 template<
class FUNCTOR>
186 void forAllValuesInOrder(FUNCTOR & functor)
const;
187 template<
class FUNCTOR>
188 void forAllValuesInSwitchedOrder(FUNCTOR & functor)
const;
190 ValueType sum()
const;
191 ValueType product()
const;
192 ValueType min()
const;
193 ValueType max()
const;
194 IndexType
dimension()
const{
return this->numberOfVariables();}
198 template<
class LABEL_ITER>
200 typedef SubsetAccessor<VariablesIteratorType, LABEL_ITER>
Accessor;
201 typedef AccessorIterator<Accessor, true>
Iter;
204 template<
class LABEL_ITER>
208 Accessor accessor(variableIndicesBegin(),variableIndicesEnd(), gmLabelsBegin);
209 return Iter(accessor, 0);
212 template<
class LABEL_ITER>
217 Accessor accessor(variableIndicesBegin(),variableIndicesEnd(), gmLabelsBegin);
218 return Iter(accessor, this->numberOfVariables());
223 void testInvariant()
const;
225 const VisContainerType & variableIndexSequence()
const;
226 template<
size_t FUNCTION_TYPE_INDEX>
227 typename meta::TypeAtTypeList<FunctionTypeList, FUNCTION_TYPE_INDEX>::type&
function();
229 GraphicalModelPointerType gm_;
230 IndexType functionIndex_;
235 VisContainerType vis_;
236 template<
typename,
typename,
typename,
typename>
239 friend struct opengm::detail_graphical_model::FunctionWrapper;
240 template<
size_t,
size_t,
bool>
241 friend struct opengm::detail_graphical_model::FunctionWrapperExecutor;
244 template<
typename GM_>
246 template<
typename GM_>
248 template<
typename,
typename,
typename >
252 template<
class,
class,
class,
class>
253 friend class opengm::functionwrapper::binary::OperationWrapperSelector;
254 template<
class ,
class,
class>
255 friend class opengm::functionwrapper::unary::OperationWrapperSelector;
257 template<
class,
class,
class,
class,
class,
class,
class>
258 friend class opengm::functionwrapper::binary::OperationWrapper;
260 template <
class,
size_t>
261 friend class opengm::meta::GetFunction;
262 template<
class,
class,
class>
263 friend class opengm::functionwrapper::AccumulateSomeWrapper;
265 template<
class,
class,
class,
size_t,
size_t,
bool >
266 friend class opengm::functionwrapper::executor::AccumulateSomeExecutor;
268 template<
class,
class,
class,
size_t,
size_t,
bool>
269 friend class opengm::functionwrapper::executor::binary::InplaceOperationExecutor;
271 template<
class A,
class B,
class OP,
size_t IX,
size_t DX,
bool>
272 friend class opengm::functionwrapper::executor::unary::OperationExecutor;
276 template<
class T,
class I,
class L>
285 NrOfFunctionTypes = 1
295 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
296 IndependentFactor(VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR, SHAPE_ITERATOR, SHAPE_ITERATOR);
297 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
298 IndependentFactor(VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR, SHAPE_ITERATOR, SHAPE_ITERATOR,
const ValueType);
299 template<
class GRAPHICAL_MODEL,
class VARIABLE_INDEX_ITERATOR>
300 IndependentFactor(
const GRAPHICAL_MODEL&, VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR,
const ValueType = ValueType());
302 template<
class GRAPHICAL_MODEL>
305 template<
class GRAPHICAL_MODEL>
307 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
308 void assign(VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR, SHAPE_ITERATOR, SHAPE_ITERATOR);
309 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
310 void assign(VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR, SHAPE_ITERATOR, SHAPE_ITERATOR,
const ValueType);
311 template<
class GRAPHICAL_MODEL,
class VARIABLE_INDEX_ITERATOR>
312 void assign(
const GRAPHICAL_MODEL&, VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR);
313 template<
class GRAPHICAL_MODEL,
class VARIABLE_INDEX_ITERATOR>
314 void assign(
const GRAPHICAL_MODEL&, VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR,
const ValueType);
315 void assign(
const ValueType);
317 ShapeIteratorType shapeBegin()
const;
318 ShapeIteratorType shapeEnd()
const;
319 VariablesIteratorType variableIndicesBegin()
const;
320 VariablesIteratorType variableIndicesEnd()
const;
321 const std::vector<IndexType>& variableIndexSequence()
const;
322 template<
size_t FUNCTION_TYPE_INDEX>
323 const FunctionType&
function()
const;
324 size_t numberOfVariables()
const;
325 IndexType numberOfLabels(
const IndexType)
const;
326 IndexType shape(
const size_t dimIndex)
const;
328 IndexType variableIndex(
const size_t)
const;
329 template<
class ITERATOR>
330 void variableIndices(ITERATOR)
const;
331 template<
class ITERATOR>
334 T
operator()(
const IndexType,
const IndexType)
const;
335 T
operator()(
const IndexType,
const IndexType,
const IndexType)
const;
336 T
operator()(
const IndexType,
const IndexType,
const IndexType,
const IndexType)
const;
338 template<
class INDEX_ITERATOR,
class STATE_ITERATOR>
339 void fixVariables(INDEX_ITERATOR, INDEX_ITERATOR, STATE_ITERATOR);
340 template<
class ITERATOR>
343 T&
operator()(
const IndexType,
const IndexType);
344 T&
operator()(
const IndexType,
const IndexType,
const IndexType);
345 T&
operator()(
const IndexType,
const IndexType,
const IndexType,
const IndexType);
346 template<
class UNARY_OPERATOR_TYPE>
347 void operateUnary(UNARY_OPERATOR_TYPE unaryOperator);
348 template<
class BINARY_OPERATOR_TYPE>
349 void operateBinary(
const T value, BINARY_OPERATOR_TYPE binaryOperator);
350 template<
class GRAPHICAL_MODEL,
class BINARY_OPERATOR_TYPE>
352 template<
class BINARY_OPERATOR_TYPE>
354 template<
class BINARY_OPERATOR_TYPE>
356 void subtractOffset();
358 template<
class ACCUMULATOR>
359 void accumulate(ValueType&, std::vector<LabelType>&)
const;
360 template<
class ACCUMULATOR>
361 void accumulate(ValueType&)
const;
362 template<
class ACCUMULATOR,
class VariablesIterator>
364 template<
class ACCUMULATOR,
class VariablesIterator>
365 void accumulate(VariablesIterator, VariablesIterator) ;
366 const FunctionType&
function()
const;
369 {
return function_.isPotts(); }
371 {
return function_.isGeneralizedPotts(); }
373 {
return function_.isSubmodular(); }
375 {
return function_.isSquaredDifference(); }
377 {
return function_.isTruncatedSquaredDifference(); }
379 {
return function_.isAbsoluteDifference(); }
381 {
return function_.isTruncatedAbsoluteDifference(); }
383 T
min() {
return function_.min();}
384 T
max() {
return function_.max();}
385 T
sum() {
return function_.sum();}
389 template<
size_t FUNCTION_TYPE_INDEX>
390 FunctionType&
function();
391 std::vector<IndexType>& variableIndexSequence();
393 std::vector<IndexType> variableIndices_;
394 FunctionType function_;
398 template<
typename,
typename,
typename,
typename>
401 template<
class,
class,
class,
class>
402 friend class opengm::functionwrapper::binary::OperationWrapperSelector;
403 template<
class ,
class,
class>
404 friend class opengm::functionwrapper::unary::OperationWrapperSelector;
405 template<
class,
class,
class,
class,
class,
class,
class>
406 friend class opengm::functionwrapper::binary::OperationWrapper;
407 template <
class,
size_t>
408 friend class opengm::meta::GetFunction;
409 template<
class,
class,
class>
410 friend class opengm::functionwrapper::AccumulateSomeWrapper;
411 template<
class,
class,
class,
size_t,
size_t,
bool>
412 friend class opengm::functionwrapper::executor::AccumulateSomeExecutor;
413 template<
class,
class,
class,
size_t,
size_t,
bool>
414 friend class opengm::functionwrapper::executor::binary::InplaceOperationExecutor;
415 template<
class A,
class B,
class OP,
size_t IX,
size_t DX,
bool>
416 friend class opengm::functionwrapper::executor::unary::OperationExecutor;
417 template<
class ACC,
class A,
class ViAccIterator>
418 friend void accumulate(A &, ViAccIterator, ViAccIterator );
422 template<
class GRAPHICAL_MODEL>
430 template<
class GRAPHICAL_MODEL>
440 functionIndex_(functionIndex),
441 functionTypeId_(functionTypeId),
442 vis_(gm->factorsVis_, indexInVisVector,order)
457 template<
class GRAPHICAL_MODEL>
465 vis_(gm_->factorsVis_)
468 template<
class GRAPHICAL_MODEL>
474 functionIndex_(src.functionIndex_),
475 functionTypeId_(src.functionTypeId_),
479 template<
class GRAPHICAL_MODEL>
487 functionTypeId_ = src.functionTypeId_;
488 functionIndex_ = src.functionIndex_;
495 template<
class GRAPHICAL_MODEL>
502 template<
class GRAPHICAL_MODEL>
511 template<
class GRAPHICAL_MODEL>
520 template<
class GRAPHICAL_MODEL>
526 return gm_->numberOfLabels(vis_[j]);
529 template<
class GRAPHICAL_MODEL>
537 template<
class GRAPHICAL_MODEL>
547 template<
class GRAPHICAL_MODEL>
554 return gm_->numberOfLabels(vis_[j]);
559 template<
class GRAPHICAL_MODEL>
560 template<
class ITERATOR>
566 return opengm::detail_graphical_model::FunctionWrapper<
568 >::getValue (this->gm_, begin, functionIndex_, functionTypeId_);
575 template<
class GRAPHICAL_MODEL>
576 template<
class FUNCTOR>
582 return opengm::detail_graphical_model::FunctionWrapper<
584 >
::callFunctor(this->gm_, functionIndex_, functionTypeId_,functor);
590 template<
class GRAPHICAL_MODEL>
591 template<
class FUNCTOR>
599 return opengm::detail_graphical_model::FunctionWrapper<
601 >
::callFunctor(this->gm_, functionIndex_, functionTypeId_,viFunctor);
607 template<
class GRAPHICAL_MODEL>
608 template<
class ITERATOR>
614 opengm::detail_graphical_model::FunctionWrapper<
616 >::getValues (this->gm_, begin, functionIndex_, functionTypeId_);
619 template<
class GRAPHICAL_MODEL>
620 template<
class ITERATOR>
626 opengm::detail_graphical_model::FunctionWrapper<
628 >::getValuesSwitchedOrder (this->gm_, begin, functionIndex_, functionTypeId_);
633 template<
class GRAPHICAL_MODEL>
634 template<
int FunctionType,
class ITERATOR>
636 Factor<GRAPHICAL_MODEL>::operator()
640 return gm_->
template functions<FunctionType>()[functionIndex_].
operator()(begin);
654 template<
class GRAPHICAL_MODEL>
655 template<
int PROPERTY>
659 return opengm::detail_graphical_model::FunctionWrapper<
661 >:: template binaryProperty<GRAPHICAL_MODEL,PROPERTY> (this->gm_, functionIndex_, functionTypeId_);
676 template<
class GRAPHICAL_MODEL>
677 template<
int PROPERTY>
678 inline typename GRAPHICAL_MODEL::ValueType
681 return opengm::detail_graphical_model::FunctionWrapper<
683 >:: template valueProperty<GRAPHICAL_MODEL,PROPERTY> (this->gm_, functionIndex_, functionTypeId_);
695 template<
class GRAPHICAL_MODEL>
696 template<
class FUNCTOR>
702 opengm::detail_graphical_model::FunctionWrapper<
704 >:: template forAllValuesInAnyOrder<GRAPHICAL_MODEL,FUNCTOR> (this->gm_,functor, functionIndex_, functionTypeId_);
717 template<
class GRAPHICAL_MODEL>
718 template<
class FUNCTOR>
724 opengm::detail_graphical_model::FunctionWrapper<
726 >:: template forAtLeastAllUniqueValues<GRAPHICAL_MODEL,FUNCTOR> (this->gm_,functor, functionIndex_, functionTypeId_);
738 template<
class GRAPHICAL_MODEL>
739 template<
class FUNCTOR>
745 opengm::detail_graphical_model::FunctionWrapper<
747 >:: template forAllValuesInOrder<GRAPHICAL_MODEL,FUNCTOR> (this->gm_,functor, functionIndex_, functionTypeId_);
750 template<
class GRAPHICAL_MODEL>
751 template<
class FUNCTOR>
757 opengm::detail_graphical_model::FunctionWrapper<
759 >:: template forAllValuesInSwitchedOrder<GRAPHICAL_MODEL,FUNCTOR> (this->gm_,functor, functionIndex_, functionTypeId_);
762 template<
class GRAPHICAL_MODEL>
766 return opengm::detail_graphical_model::FunctionWrapper<
768 >
::isPotts (this->gm_, functionIndex_, functionTypeId_);
771 template<
class GRAPHICAL_MODEL>
775 return opengm::detail_graphical_model::FunctionWrapper<
780 template<
class GRAPHICAL_MODEL>
784 return opengm::detail_graphical_model::FunctionWrapper<
789 template<
class GRAPHICAL_MODEL>
794 return opengm::detail_graphical_model::FunctionWrapper<
803 template<
class GRAPHICAL_MODEL>
808 return opengm::detail_graphical_model::FunctionWrapper<
817 template<
class GRAPHICAL_MODEL>
822 return opengm::detail_graphical_model::FunctionWrapper<
831 template<
class GRAPHICAL_MODEL>
836 return opengm::detail_graphical_model::FunctionWrapper<
845 template<
class GRAPHICAL_MODEL>
849 return opengm::detail_graphical_model::FunctionWrapper<
854 template<
class GRAPHICAL_MODEL>
857 return opengm::detail_graphical_model::FunctionWrapper<
859 >
::sum (this->gm_, functionIndex_, functionTypeId_);
862 template<
class GRAPHICAL_MODEL>
865 return opengm::detail_graphical_model::FunctionWrapper<
867 >
::product (this->gm_, functionIndex_, functionTypeId_);
870 template<
class GRAPHICAL_MODEL>
873 return opengm::detail_graphical_model::FunctionWrapper<
875 >
::min (this->gm_, functionIndex_, functionTypeId_);
878 template<
class GRAPHICAL_MODEL>
881 return opengm::detail_graphical_model::FunctionWrapper<
883 >
::max (this->gm_, functionIndex_, functionTypeId_);
886 template<
class GRAPHICAL_MODEL>
887 template<
class ITERATOR>
898 template<
class GRAPHICAL_MODEL>
899 template<
size_t FUNCTION_TYPE_INDEX>
900 inline typename meta::TypeAtTypeList< typename Factor<GRAPHICAL_MODEL>::FunctionTypeList, FUNCTION_TYPE_INDEX>::type&
902 typedef typename meta::SmallerNumber<FUNCTION_TYPE_INDEX, Factor<GRAPHICAL_MODEL>::NrOfFunctionTypes>::type MetaBoolAssertType;
904 return meta::FieldAccess::template byIndex<FUNCTION_TYPE_INDEX>(gm_->functionDataField_).
905 functionData_.functions_[functionIndex_];
908 template<
class GRAPHICAL_MODEL>
909 template<
size_t FUNCTION_TYPE_INDEX>
910 inline const typename meta::TypeAtTypeList< typename Factor<GRAPHICAL_MODEL>::FunctionTypeList, FUNCTION_TYPE_INDEX>::type&
912 typedef typename meta::SmallerNumber<FUNCTION_TYPE_INDEX, Factor<GRAPHICAL_MODEL>::NrOfFunctionTypes>::type MetaBoolAssertType;
914 return meta::FieldAccess::template byIndex<FUNCTION_TYPE_INDEX>(gm_->functionDataField_).
915 functionData_.functions_[functionIndex_];
918 template<
class GRAPHICAL_MODEL>
924 template<
class GRAPHICAL_MODEL>
930 template<
class GRAPHICAL_MODEL>
934 if(vis_.
size() != 0) {
935 size_t val = this->
shape(0);
937 val *= this->
shape(i);
944 template<
class GRAPHICAL_MODEL>
946 opengm::functionwrapper::executor::FactorInvariant
950 meta::EqualNumber<Factor<GRAPHICAL_MODEL>::NrOfFunctionTypes, 0>::value
954 template<
class GRAPHICAL_MODEL>
957 return static_cast<UInt8Type> (functionTypeId_);
960 template<
class GRAPHICAL_MODEL>
963 return functionIndex_;
966 template<
class T,
class I,
class L>
968 : variableIndices_(),
973 template<
class T,
class I,
class L>
976 const ValueType constant
978 : variableIndices_(),
987 template<
class T,
class I,
class L>
988 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
991 VARIABLE_INDEX_ITERATOR beginVi,
992 VARIABLE_INDEX_ITERATOR endVi,
993 SHAPE_ITERATOR beginShape,
994 SHAPE_ITERATOR endShape
996 : variableIndices_(beginVi, endVi),
997 function_(beginShape, endShape, 1)
999 OPENGM_ASSERT(std::distance(beginVi, endVi) == std::distance(beginShape, endShape));
1003 template<
class T,
class I,
class L>
1004 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
1007 VARIABLE_INDEX_ITERATOR beginVi,
1008 VARIABLE_INDEX_ITERATOR endVi,
1009 SHAPE_ITERATOR beginShape,
1010 SHAPE_ITERATOR endShape,
1011 const ValueType constant
1013 : variableIndices_(beginVi, endVi),
1014 function_(beginShape, endShape, constant)
1016 OPENGM_ASSERT(std::distance(beginVi, endVi) == std::distance(beginShape, endShape));
1020 template<
class T,
class I,
class L>
1021 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
1024 VARIABLE_INDEX_ITERATOR beginVi,
1025 VARIABLE_INDEX_ITERATOR endVi,
1026 SHAPE_ITERATOR beginShape,
1027 SHAPE_ITERATOR endShape
1029 OPENGM_ASSERT(std::distance(beginVi, endVi) == std::distance(beginShape, endShape));
1032 function_.
resize(beginShape, endShape, 1);
1033 variableIndices_.assign(beginVi, endVi);
1036 template<
class T,
class I,
class L>
1037 template<
class VARIABLE_INDEX_ITERATOR,
class SHAPE_ITERATOR>
1040 VARIABLE_INDEX_ITERATOR beginVi,
1041 VARIABLE_INDEX_ITERATOR endVi,
1042 SHAPE_ITERATOR beginShape,
1043 SHAPE_ITERATOR endShape,
1044 const ValueType constant
1046 OPENGM_ASSERT(std::distance(beginVi, endVi) == std::distance(beginShape, endShape));
1049 function_.
resize(beginShape, endShape, constant);
1050 variableIndices_.assign(beginVi, endVi);
1054 template<
class T,
class I,
class L>
1055 template<
size_t FUNCTION_TYPE_INDEX>
1062 template<
class T,
class I,
class L>
1069 template<
class T,
class I,
class L>
1070 template<
size_t FUNCTION_TYPE_INDEX>
1077 template<
class T,
class I,
class L>
1081 const ValueType constant
1086 variableIndices_.clear();
1089 template<
class T,
class I,
class L>
1090 template<
class GRAPHICAL_MODEL,
class VARIABLE_INDEX_ITERATOR>
1093 const GRAPHICAL_MODEL& gm,
1094 VARIABLE_INDEX_ITERATOR begin,
1095 VARIABLE_INDEX_ITERATOR end
1099 this->variableIndices_.assign(begin, end);
1100 std::vector<size_t> factorShape(variableIndices_.size());
1101 for(
size_t i = 0; i < factorShape.size(); ++i) {
1102 factorShape[i] = gm.numberOfLabels(variableIndices_[i]);
1104 this->function_.
assign();
1105 this->function_.
resize(factorShape.begin(), factorShape.end());
1108 template<
class T,
class I,
class L>
1109 template<
class GRAPHICAL_MODEL,
class VARIABLE_INDEX_ITERATOR>
1112 const GRAPHICAL_MODEL& gm,
1113 VARIABLE_INDEX_ITERATOR begin,
1114 VARIABLE_INDEX_ITERATOR end,
1115 const ValueType value
1118 this->variableIndices_.assign(begin, end);
1119 std::vector<size_t> factorShape(variableIndices_.size());
1120 for(
size_t i = 0; i < factorShape.size(); ++i) {
1121 factorShape[i] =
static_cast<size_t> (gm.numberOfLabels(this->variableIndices_[i]));
1125 this->function_.
assign();
1126 this->function_.
resize(factorShape.begin(), factorShape.end(), value);
1129 template<
class T,
class I,
class L>
1130 template<
class GRAPHICAL_MODEL,
class VARIABLE_INDEX_ITERATOR>
1133 const GRAPHICAL_MODEL& gm,
1134 VARIABLE_INDEX_ITERATOR begin,
1135 VARIABLE_INDEX_ITERATOR end,
1136 const ValueType value
1138 : variableIndices_(begin, end)
1141 std::vector<size_t>
shape(variableIndices_.size());
1142 for(
size_t i = 0; i <
shape.size(); ++i) {
1143 shape[i] = gm.numberOfLabels(variableIndices_[i]);
1145 this->function_.
assign();
1149 template<
class T,
class I,
class L>
1154 : variableIndices_(src.variableIndices_)
1156 if(src.variableIndices_.size() == 0) {
1157 FunctionType tmp(src.function_(0));
1161 function_ = src.function_;
1165 template<
class T,
class I,
class L>
1166 template<
class GRAPHICAL_MODEL>
1178 ShapeWalker< typename Factor<GRAPHICAL_MODEL>::ShapeIteratorType> walker(src.
shapeBegin(), dimension);
1180 for(
size_t scalarIndex = 0; scalarIndex < function_.
size(); ++scalarIndex) {
1181 function_(coordinate.begin()) = src(coordinate.begin());
1187 size_t indexToScalar[]={0};
1195 template<
class T,
class I,
class L>
1203 function_ = src.function_;
1204 variableIndices_ = src.variableIndices_;
1209 template<
class T,
class I,
class L>
1210 template<
class GRAPHICAL_MODEL>
1212 IndependentFactor<T, I, L>::operator=
1226 ShapeWalker< typename Factor<GRAPHICAL_MODEL>::ShapeIteratorType> walker(src.
shapeBegin(), dimension);
1228 for(
size_t scalarIndex = 0; scalarIndex < function_.
size(); ++scalarIndex) {
1229 function_(scalarIndex) = src(coordinate.begin());
1234 size_t indexToScalar[]={0};
1240 template<
class T,
class I,
class L>
1244 return variableIndices_.size();
1248 template<
class T,
class I,
class L>
1252 const IndexType index
1256 return function_.
shape(index);
1260 template<
class T,
class I,
class L>
1264 return function_.
size();
1268 template<
class T,
class I,
class L>
1274 if(variableIndices_.size() == 0) {
1278 return function_.
shape(index);
1281 template<
class T,
class I,
class L>
1288 template<
class T,
class I,
class L>
1295 template<
class T,
class I,
class L>
1299 return variableIndices_.begin();
1302 template<
class T,
class I,
class L>
1306 return variableIndices_.end();
1311 template<
class T,
class I,
class L>
1318 return variableIndices_[index];
1321 template<
class T,
class I,
class L>
1324 if(variableIndices_.size() == 0) {
1325 function_(0) =
static_cast<ValueType
> (0);
1329 std::vector<size_t> states;
1330 opengm::accumulate<Minimizer>(*
this, v, states);
1337 template<
class T,
class I,
class L>
1338 template<
class ITERATOR>
1340 IndependentFactor<T, I, L>::operator()
1344 return function_(begin);
1347 template<
class T,
class I,
class L>
1348 inline std::vector<I>&
1351 return this->variableIndices_;
1354 template<
class T,
class I,
class L>
1355 inline const std::vector<I>&
1358 return this->variableIndices_;
1362 template<
class T,
class I,
class L>
1364 IndependentFactor<T, I, L>::operator()
1369 return function_(x0);
1373 template<
class T,
class I,
class L>
1375 IndependentFactor<T, I, L>::operator()
1382 return function_(x0, x1);
1386 template<
class T,
class I,
class L>
1388 IndependentFactor<T, I, L>::operator()
1396 return function_(x0, x1, x2);
1400 template<
class T,
class I,
class L>
1411 return function_(x0, x1, x2, x3);
1414 template<
class T,
class I,
class L>
1415 template<
class UNARY_OPERATOR_TYPE>
1419 UNARY_OPERATOR_TYPE unaryOperator
1421 if(this->variableIndices_.size() != 0) {
1422 for(
size_t i = 0; i < function_.
size(); ++i) {
1423 function_(i) =
static_cast<T
> (unaryOperator(function_(i)));
1427 function_(0) =
static_cast<T
> (unaryOperator(function_(0)));
1431 template<
class T,
class I,
class L>
1432 template<
class BINARY_OPERATOR_TYPE>
1437 BINARY_OPERATOR_TYPE binaryOperator
1439 if(this->variableIndices_.size() != 0) {
1440 for(
size_t i = 0; i < function_.
size(); ++i) {
1441 function_(i) =
static_cast<T
> (binaryOperator(function_(i), value));
1445 function_(0) =
static_cast<T
> (binaryOperator(function_(0), value));
1449 template<
class T,
class I,
class L>
1450 template<
class GRAPHICAL_MODEL,
class BINARY_OPERATOR_TYPE>
1455 BINARY_OPERATOR_TYPE binaryOperator
1457 opengm::operateBinary(*
this, srcB, binaryOperator);
1460 template<
class T,
class I,
class L>
1461 template<
class BINARY_OPERATOR_TYPE>
1466 BINARY_OPERATOR_TYPE binaryOperator
1468 opengm::operateBinary(*
this, srcB, binaryOperator);
1471 template<
class T,
class I,
class L>
1472 template<
class BINARY_OPERATOR_TYPE>
1478 BINARY_OPERATOR_TYPE binaryOperator
1480 opengm::operateBinary(srcA, srcB, *
this, binaryOperator);
1483 template<
class T,
class I,
class L>
1484 template<
class ACCUMULATOR>
1489 std::vector<LabelType>& resultState
1491 opengm::accumulate<ACCUMULATOR> (*
this, result, resultState);
1494 template<
class T,
class I,
class L>
1495 template<
class ACCUMULATOR>
1501 opengm::accumulate<ACCUMULATOR> (*
this, result);
1504 template<
class T,
class I,
class L>
1505 template<
class ACCUMULATOR,
class VariablesIterator>
1509 VariablesIterator begin,
1510 VariablesIterator end,
1513 opengm::accumulate<ACCUMULATOR> (*
this, begin, end, dstFactor);
1516 template<
class T,
class I,
class L>
1517 template<
class ACCUMULATOR,
class VariablesIterator>
1520 VariablesIterator begin,
1521 VariablesIterator end
1523 opengm::accumulate<ACCUMULATOR> (*
this, begin, end);
1528 template<
class T,
class I,
class L>
1529 template<
class ITERATOR>
1534 return function_(begin);
1538 template<
class T,
class I,
class L>
1543 return function_(x0);
1547 template<
class T,
class I,
class L>
1554 return function_(x0, x1);
1558 template<
class T,
class I,
class L>
1565 return function_(x0, x1, x2);
1569 template<
class T,
class I,
class L>
1577 return function_(x0, x1, x2, x3);
1580 template<
class T,
class I,
class L>
1581 template<
class ITERATOR>
1587 for(
size_t j=0; j<variableIndices_.size(); ++j) {
1588 *out = variableIndices_[j];
1597 template<
class T,
class I,
class L>
1598 template<
class INDEX_ITERATOR,
class STATE_ITERATOR>
1602 INDEX_ITERATOR beginIndex,
1603 INDEX_ITERATOR endIndex,
1604 STATE_ITERATOR beginLabels
1606 if(this->variableIndices_.size() != 0) {
1614 while(beginIndex != endIndex) {
1616 if(*beginIndex>this->variableIndices_.back()) {
1619 for(
size_t i = counter; i<this->variableIndices_.size(); ++i) {
1620 if(*beginIndex<this->variableIndices_[i])
break;
1621 else if(*beginIndex == this->variableIndices_[i]) {
1631 for(
size_t i = 0; i<this->variableIndices_.size(); ++i) {
1633 for(
size_t j = 0; j < variablesToFix.
size(); ++j) {
1634 if(variablesToFix[j] == this->variableIndices_[i]) {
1639 if(found ==
false) {
1640 variablesNotToFix.
push_back(this->variableIndices_[i]);
1644 if(variablesToFix.
size() != 0) {
1645 FunctionType& factorFunction = this->function_;
1647 if(variablesToFix.
size() == this->variableIndices_.size()) {
1648 FunctionType tmp(factorFunction(newStates.
begin()));
1649 factorFunction = tmp;
1650 this->variableIndices_.clear();
1659 FunctionType tmp(newShape.
begin(), newShape.
end());
1660 const size_t subSize = subWalker.subSize();
1661 subWalker.resetCoordinate();
1662 for(
size_t i = 0; i < subSize; ++i) {
1663 tmp(i) = factorFunction(subWalker.coordinateTuple().begin());
1666 factorFunction = tmp;
1667 this->variableIndices_.assign(variablesNotToFix.
begin(), variablesNotToFix.
end());
1676 #define OPENGM_INDEPENDENT_FACTOR_OPERATION_GENERATION(BINARY_OPERATOR_SYMBOL, BINARY_INPLACE_OPERATOR_SYMBOL, BINARY_FUNCTOR_NAME) \ 1677 template<class T, class I, class L> \ 1678 inline IndependentFactor<T, I, L> & \ 1679 operator BINARY_INPLACE_OPERATOR_SYMBOL \ 1681 IndependentFactor<T, I, L>& op1, \ 1684 op1.operateBinary(op2, BINARY_FUNCTOR_NAME<T>()); \ 1687 template<class GRAPHICAL_MODEL> \ 1688 inline IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > & \ 1689 operator BINARY_INPLACE_OPERATOR_SYMBOL \ 1691 IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType >& op1, \ 1692 const Factor<GRAPHICAL_MODEL>& op2 \ 1694 op1.operateBinary(op2, BINARY_FUNCTOR_NAME<typename GRAPHICAL_MODEL::ValueType> ()); \ 1697 template<class T, class I, class L> \ 1698 inline IndependentFactor<T, I, L> & \ 1699 operator BINARY_INPLACE_OPERATOR_SYMBOL \ 1701 IndependentFactor<T, I, L>& op1, \ 1702 const IndependentFactor<T, I, L>& op2 \ 1704 op1.operateBinary(op2, BINARY_FUNCTOR_NAME<T> ()); \ 1707 template<class T, class I, class L> \ 1708 inline IndependentFactor<T, I, L> \ 1709 operator BINARY_OPERATOR_SYMBOL \ 1711 const IndependentFactor<T, I, L>& op1, \ 1712 const IndependentFactor<T, I, L>& op2 \ 1714 IndependentFactor<T, I, L> tmp; \ 1715 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <T> ()); \ 1718 template<class T, class I, class L> \ 1719 inline IndependentFactor<T, I, L> \ 1720 operator BINARY_OPERATOR_SYMBOL \ 1723 const IndependentFactor<T, I, L>& op2 \ 1725 IndependentFactor<T, I, L> tmp; \ 1726 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <T> ()); \ 1729 template<class T, class I, class L> \ 1730 inline IndependentFactor<T, I, L> \ 1731 operator BINARY_OPERATOR_SYMBOL \ 1733 const IndependentFactor<T, I, L>& op1, \ 1736 IndependentFactor<T, I, L> tmp; \ 1737 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <T> ()); \ 1740 template<class GRAPHICAL_MODEL> \ 1741 inline IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > \ 1742 operator BINARY_OPERATOR_SYMBOL \ 1744 const Factor<GRAPHICAL_MODEL> & op1, \ 1745 const IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType >& op2 \ 1747 IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > tmp; \ 1748 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <typename GRAPHICAL_MODEL::ValueType> ()); \ 1751 template<class GRAPHICAL_MODEL> \ 1752 inline IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > \ 1753 operator BINARY_OPERATOR_SYMBOL \ 1755 const IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType >& op1, \ 1756 const Factor<GRAPHICAL_MODEL> & op2 \ 1758 IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > tmp; \ 1759 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <typename GRAPHICAL_MODEL::ValueType> ()); \ 1762 template<class GRAPHICAL_MODEL> \ 1763 inline IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > \ 1764 operator BINARY_OPERATOR_SYMBOL \ 1766 const Factor<GRAPHICAL_MODEL>& op1, \ 1767 const Factor<GRAPHICAL_MODEL>& op2 \ 1769 IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > tmp; \ 1770 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <typename GRAPHICAL_MODEL::ValueType> ()); \ 1773 template<class GRAPHICAL_MODEL> \ 1774 inline IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > \ 1775 operator BINARY_OPERATOR_SYMBOL \ 1777 const Factor<GRAPHICAL_MODEL>& op1, \ 1778 const typename GRAPHICAL_MODEL::ValueType & op2 \ 1780 IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > tmp; \ 1781 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <typename GRAPHICAL_MODEL::ValueType> ()); \ 1784 template<class GRAPHICAL_MODEL> \ 1785 inline IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > \ 1786 operator BINARY_OPERATOR_SYMBOL \ 1788 const typename GRAPHICAL_MODEL::ValueType & op1, \ 1789 const Factor<GRAPHICAL_MODEL>& op2 \ 1791 IndependentFactor<typename GRAPHICAL_MODEL::ValueType, typename GRAPHICAL_MODEL::IndexType, typename GRAPHICAL_MODEL::LabelType > tmp; \ 1792 opengm::operateBinary(op1, op2, tmp, BINARY_FUNCTOR_NAME <typename GRAPHICAL_MODEL::ValueType> ()); \ 1805 namespace functionwrapper {
1807 namespace executor {
1809 template<
size_t IX,
size_t DX>
1810 template<
class GM,
class FACTOR>
1811 void FactorInvariant<IX, DX, false>::op
1816 typedef typename GM::IndexType
IndexType;
1817 typedef typename GM::LabelType
LabelType;
1818 if(factor.functionType() == IX) {
1819 const IndexType functionIndex =
static_cast<IndexType
>(factor.functionIndex());
1820 const size_t numVar =
static_cast<size_t>(factor.numberOfVariables());
1821 const size_t dimFunction =
static_cast<size_t>(meta::FieldAccess::template byIndex<IX> (gm.functionDataField_).functionData_.functions_[functionIndex].dimension());
1822 const IndexType numberOfFunctions =
static_cast<IndexType
>(meta::FieldAccess::template byIndex<IX> (gm.functionDataField_).functionData_.functions_.size());
1825 "function index must be smaller than numberOfFunctions for that given function type")
1827 "number of variable indices of the factor must match the functions dimension")
1828 for(
size_t i = 0; i < numVar; ++i) {
1829 const LabelType numberOfLabelsOfFunction = meta::FieldAccess::template byIndex<IX> (gm.functionDataField_).functionData_.functions_[functionIndex].shape(i);
1830 OPENGM_CHECK_OP(factor.numberOfLabels(i) , == , numberOfLabelsOfFunction,
1831 "number of labels of the variables in a factor must match the functions shape")
1837 meta::Increment<IX>::value,
1839 meta::EqualNumber< meta::Increment<IX>::value, DX>::value
1844 template<
size_t IX,
size_t DX>
1845 template<
class GM,
class FACTOR>
1846 void FactorInvariant<IX, DX, true>::op
1861 #endif // #ifndef OPENGM_GRAPHICALMODEL_FACTOR_HXX void assign(const allocator_type &=allocator_type())
Clear Marray.
void callFunctor(FUNCTOR &f) const
call a functor for the function of the factor the first and only argument passed to the functor is th...
ShapeIteratorType shapeBegin() const
VariablesIteratorType variableIndicesBegin() const
void callViFunctor(FUNCTOR &f) const
call a functor for the function of the factor the first to arguments passed to the functor are a begi...
Factor (with corresponding function and variable indices), independent of a GraphicalModel.
GmToFactorLabelIter< LABEL_ITER >::Iter gmToFactorLabelsBegin(LABEL_ITER gmLabelsBegin) const
const size_t * shapeEnd() const
Get a constant iterator to the end of the shape vector.
ShapeIteratorType shapeEnd() const
IndexType variableIndex(const IndexType) const
return the index of the j-th variable
size_t numberOfVariables() const
const FunctionType & function() const
T const * begin() const
begin iterator
detail_types::UInt8Type UInt8Type
SizeT.
bool isSquaredDifference()
GraphicalModelType::LabelType LabelType
void push_back(const T &)
append a value
VariablesIteratorType variableIndicesBegin() const
IndexType shape(const IndexType) const
return the extension a value table encoding this factor would have in the dimension of the j-th varia...
bool isTruncatedSquaredDifference()
bool isAbsoluteDifference()
void load(GM_ &gm, const std::string &, const std::string &)
bool isLinearConstraint() const
IndexType numberOfVariables() const
bool isGeneralizedPotts() const
GraphicalModelType::ValueType ValueType
SubsetAccessor< VariablesIteratorType, LABEL_ITER > Accessor
VariablesIteratorType variableIndicesEnd() const
Vector that stores values on the stack if size is smaller than MAX_STACK.
VectorType::const_iterator const_iterator
GraphicalModelType::FunctionTypeList FunctionTypeList
#define OPENGM_ASSERT(expression)
void copyValuesSwitchedOrder(ITERATOR iterator) const
GRAPHICAL_MODEL * GraphicalModelPointerType
void load(const hid_t &, const std::string &, Marray< T > &)
Load an Marray from an HDF5 dataset.
std::vector< IndexType >::const_iterator VariablesIteratorType
#define OPENGM_META_ASSERT(assertion, msg)
opengm compile time assertion
void assign(VARIABLE_INDEX_ITERATOR, VARIABLE_INDEX_ITERATOR, SHAPE_ITERATOR, SHAPE_ITERATOR)
opengm::AccessorIterator< ShapeAccessorType, true > ShapeIteratorType
bool binaryProperty() const
compute a binary property of a factor
Abstraction (wrapper class) of factors, independent of the function used to implement the factor...
ShapeIteratorType shapeEnd() const
GraphicalModelType::IndexType IndexType
ExplicitFunction< ValueType, IndexType, LabelType > FunctionType
const size_t * shapeBegin() const
Get a constant iterator to the beginning of the shape vector.
IndexType functionIndex() const
void forAllValuesInAnyOrder(FUNCTOR &functor) const
call a functor for all values in no defined order
ValueType product() const
UInt8Type functionType() const
#define OPENGM_INDEPENDENT_FACTOR_OPERATION_GENERATION(BINARY_OPERATOR_SYMBOL, BINARY_INPLACE_OPERATOR_SYMBOL, BINARY_FUNCTOR_NAME)
IndexType variableIndex(const size_t) const
return the index of the j-th variable
void forAtLeastAllUniqueValues(FUNCTOR &functor) const
call a functor for at least all unique values in no defined order
void variableIndices(ITERATOR) const
ViFunctor(const FACTOR &factor, FUNCTOR &functor)
T const * end() const
end iterator
bool isTruncatedSquaredDifference() const
IndexType dimension() const
IndexType numberOfLabels(const IndexType) const
return the number of labels of the j-th variable
bool isTruncatedAbsoluteDifference() const
void operateBinary(const T value, BINARY_OPERATOR_TYPE binaryOperator)
bool isGeneralizedPotts()
VisContainerType::const_iterator VariablesIteratorType
ShapeIteratorType shapeBegin() const
meta::TypeListGenerator< FunctionType >::type FunctionTypeList
std::vector< IndexType > VisContainerType
const meta::TypeAtTypeList< FunctionTypeList, FUNCTION_TYPE_INDEX >::type & function() const
void copyValues(ITERATOR iterator) const
copies the values of a factors into an iterator
ValueType valueProperty() const
void fixVariables(INDEX_ITERATOR, INDEX_ITERATOR, STATE_ITERATOR)
assign specific labels to a specific subset of variables (reduces the order)
const std::vector< IndexType > & variableIndexSequence() const
void forAllValuesInOrder(FUNCTOR &functor) const
call a functor for all values in last coordinate major order
void save(const hid_t &, const std::string &, const Marray< T > &)
Save an Marray as an HDF5 dataset.
const size_t dimension() const
Get the dimension.
AccessorIterator< Accessor, true > Iter
void accumulate(ValueType &, std::vector< LabelType > &) const
bool isTruncatedAbsoluteDifference()
#define OPENGM_CHECK_OP(A, OP, B, TXT)
FACTOR::VariablesIteratorType ViIterator
IndexType numberOfLabels(const IndexType) const
return the number of labels of a specific variable
GRAPHICAL_MODEL GraphicalModelType
GmToFactorLabelIter< LABEL_ITER >::Iter gmToFactorLabelsEnd(LABEL_ITER gmLabelsBegin) const
VariablesIteratorType variableIndicesEnd() const
bool isSubmodular() const
const size_t * ShapeIteratorType
T operator()(ITERATOR) const
evaluate the function underlying the factor, given labels to be assigned the variables ...
bool isAbsoluteDifference() const
const size_t shape(const size_t) const
Get the shape in one dimension.
ValueType operator()(ITERATOR) const
evaluate the factor for a sequence of labels
void forAllValuesInSwitchedOrder(FUNCTOR &functor) const
void operateUnary(UNARY_OPERATOR_TYPE unaryOperator)
void variableIndices(ITERATOR out) const
void operator()(const FUNCTION &function)
bool isSquaredDifference() const
VectorView< std::vector< IndexType >, IndexType > VisContainerType
IndexType shape(const size_t dimIndex) const
return the extension of the value table of the of the function in a specific dimension ...
const IndexType size() const
void save(const GM &, const std::string &, const std::string &)
save a graphical model to an HDF5 file
void resize(ShapeIterator, ShapeIterator, const T &=T())
Resize (existing entries are preserved, new entries are initialized).
const size_t size() const
Get the number of data items.
size_t size() const
return the number of entries of the value table of the function