This file is indexed.

/usr/include/opengm/functions/truncated_squared_difference.hxx is in libopengm-dev 2.3.6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#pragma once
#ifndef OPENGM_TRUNCATED_SQUARED_DIFFERENCE_FUNCTION_HXX
#define OPENGM_TRUNCATED_SQUARED_DIFFERENCE_FUNCTION_HXX

#include "opengm/opengm.hxx"
#include "opengm/functions/function_registration.hxx"
#include "opengm/functions/function_properties_base.hxx"

namespace opengm {

///  truncated squared difference of the labels of two variables
///
/// \ingroup functions
template<class T, class I = size_t, class L = size_t>
class TruncatedSquaredDifferenceFunction
: public FunctionBase<TruncatedSquaredDifferenceFunction<T, I, L>, T, I, L> {
public:
   typedef T ValueType;
   typedef I IndexType;
   typedef L LabelType;

   TruncatedSquaredDifferenceFunction(const LabelType = 2, const LabelType = 2, 
      const ValueType = ValueType(), const ValueType = ValueType());
   size_t shape(const IndexType) const;
   size_t size() const;
   size_t dimension() const;
   template<class ITERATOR> T operator()(ITERATOR) const;

private:
   size_t numberOfLabels1_;
   size_t numberOfLabels2_;
   ValueType parameter1_;
   ValueType parameter2_;

friend class FunctionSerialization<TruncatedSquaredDifferenceFunction<T, I, L> > ;
};

/// \cond HIDDEN_SYMBOLS
/// FunctionRegistration
template <class T, class I, class L>
struct FunctionRegistration< TruncatedSquaredDifferenceFunction<T, I, L> > {
   enum ID {
      Id = opengm::FUNCTION_TYPE_ID_OFFSET + 5
   };
};

/// FunctionSerialization
template <class T, class I, class L>
class FunctionSerialization<TruncatedSquaredDifferenceFunction<T, I, L> > {
public:
   typedef typename TruncatedSquaredDifferenceFunction<T, I, L>::ValueType ValueType;
   static size_t indexSequenceSize(const TruncatedSquaredDifferenceFunction<T, I, L>&);
   static size_t valueSequenceSize(const TruncatedSquaredDifferenceFunction<T, I, L>&);
   template<class INDEX_OUTPUT_ITERATOR,class VALUE_OUTPUT_ITERATOR >
      static void serialize(const TruncatedSquaredDifferenceFunction<T, I, L>&, INDEX_OUTPUT_ITERATOR,VALUE_OUTPUT_ITERATOR);
   template<class INDEX_INPUT_ITERATOR ,class VALUE_INPUT_ITERATOR>
      static void deserialize( INDEX_INPUT_ITERATOR,VALUE_INPUT_ITERATOR,TruncatedSquaredDifferenceFunction<T, I, L>&);
};
/// \endcond

/// Constructor
/// \param numberOfLabels1 number of labels of the first variable
/// \param numberOfLabels2 number of labels of the second variable
template <class T, class I, class L>
inline
TruncatedSquaredDifferenceFunction<T, I, L>::TruncatedSquaredDifferenceFunction
(
   const LabelType numberOfLabels1,
   const LabelType numberOfLabels2,
   const ValueType truncation,
   const ValueType weight
)
:  numberOfLabels1_(numberOfLabels1),
   numberOfLabels2_(numberOfLabels2),
   parameter1_(truncation),
   parameter2_(weight)
{}

template <class T, class I, class L>
template <class ITERATOR>
inline typename TruncatedSquaredDifferenceFunction<T, I, L>::ValueType
TruncatedSquaredDifferenceFunction<T, I, L>::operator()
(
   ITERATOR begin
) const {
   ValueType value = begin[0];
   value -= begin[1];
   return value * value > parameter1_ ? parameter1_* parameter2_ : value * value * parameter2_;
}

/// extension a value table encoding this function would have
///
/// \param i dimension
template <class T, class I, class L>
inline size_t
TruncatedSquaredDifferenceFunction<T, I, L>::shape(
   const IndexType i
) const {
   OPENGM_ASSERT(i < 2);
   return i==0 ? numberOfLabels1_ : numberOfLabels2_;
}

// order (number of variables) of the function
template <class T, class I, class L>
inline size_t
TruncatedSquaredDifferenceFunction<T, I, L>::dimension() const {
   return 2;
}

/// number of entries a value table encoding this function would have (used for I/O)
template <class T, class I, class L>
inline size_t
TruncatedSquaredDifferenceFunction<T, I, L>::size() const {
   return numberOfLabels1_ * numberOfLabels2_;
}

template <class T, class I, class L>
inline size_t
FunctionSerialization<TruncatedSquaredDifferenceFunction<T, I, L> >::indexSequenceSize
(
   const TruncatedSquaredDifferenceFunction<T, I, L>& src
) {
   return 2;
}

template <class T, class I, class L>
inline size_t
FunctionSerialization<TruncatedSquaredDifferenceFunction<T, I, L> >::valueSequenceSize
(
   const TruncatedSquaredDifferenceFunction<T, I, L>& src
) {
   return 2;
}

template <class T, class I, class L>
template<class INDEX_OUTPUT_ITERATOR, class VALUE_OUTPUT_ITERATOR >
inline void
FunctionSerialization<TruncatedSquaredDifferenceFunction<T, I, L> >::serialize
(
   const TruncatedSquaredDifferenceFunction<T, I, L>& src,
   INDEX_OUTPUT_ITERATOR indexOutIterator,
   VALUE_OUTPUT_ITERATOR valueOutIterator
) {
   *indexOutIterator = src.shape(0);
   ++indexOutIterator;
   *indexOutIterator = src.shape(1);

   *valueOutIterator = src.parameter1_;
   ++valueOutIterator;
   *valueOutIterator = src.parameter2_;
}

template <class T, class I, class L>
template<class INDEX_INPUT_ITERATOR, class VALUE_INPUT_ITERATOR >
inline void
FunctionSerialization< TruncatedSquaredDifferenceFunction<T, I, L> >::deserialize
(
   INDEX_INPUT_ITERATOR indexInIterator,
   VALUE_INPUT_ITERATOR valueInIterator,
   TruncatedSquaredDifferenceFunction<T, I, L>& dst
) {
   const size_t shape1=*indexInIterator;
   ++indexInIterator;
   const size_t shape2=*indexInIterator;
   const ValueType param1=*valueInIterator;
   ++valueInIterator;
   const ValueType param2=*valueInIterator;
   dst=TruncatedSquaredDifferenceFunction<T, I, L>(shape1,shape2,param1,param2);
}

} // namespace opengm

#endif // OPENGM_TRUNCATED_SQUARED_DIFFERENCE_FUNCTION_HXX