This file is indexed.

/usr/include/opengm/functions/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
#pragma once
#ifndef OPENGM_SQUARED_DIFFERENCE_FUNCTION_HXX
#define OPENGM_SQUARED_DIFFERENCE_FUNCTION_HXX

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

namespace opengm {

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

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

private:
   size_t numberOfLabels1_;
   size_t numberOfLabels2_;
   T weight_;
};

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

/// FunctionSerialization
template <class T, class I, class L>
class FunctionSerialization<SquaredDifferenceFunction<T, I, L> > {
public:
   typedef typename SquaredDifferenceFunction<T, I, L>::ValueType ValueType;

   static size_t indexSequenceSize(const SquaredDifferenceFunction<T, I, L>&);
   static size_t valueSequenceSize(const SquaredDifferenceFunction<T, I, L>&);
   template<class INDEX_OUTPUT_ITERATOR, class VALUE_OUTPUT_ITERATOR >
      static void serialize(const SquaredDifferenceFunction<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, SquaredDifferenceFunction<T, I, L>&);
};
/// \endcond

/// constructor
/// \param numberOfLabels1 number of labels of the first variable
/// \param numberOfLabels2 number of labels of the second variable
/// \param weight weight
template <class T, class I, class L>
inline
SquaredDifferenceFunction<T, I, L>::SquaredDifferenceFunction
(
   const LabelType numberOfStates1, 
   const LabelType numberOfStates2, 
   const ValueType weight
)
:  numberOfLabels1_(numberOfStates1), 
   numberOfLabels2_(numberOfStates2), 
   weight_(weight)
{}

template <class T, class I, class L>
template <class ITERATOR>
inline T
SquaredDifferenceFunction<T, I, L>::operator()
(
   ITERATOR begin
) const {
   T value = begin[0];
   value -= begin[1];
   return value*value*weight_;
}

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

template <class T, class I, class L>
inline T
SquaredDifferenceFunction<T, I, L>::weight() const {
   return weight_;
}

// order (number of variables) of the function
template <class T, class I, class L>
inline size_t
SquaredDifferenceFunction<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
SquaredDifferenceFunction<T, I, L>::size() const {
   return numberOfLabels1_ * numberOfLabels2_;
}

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

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

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

template <class T, class I, class L>
template<class INDEX_INPUT_ITERATOR, class VALUE_INPUT_ITERATOR >
inline void
FunctionSerialization<SquaredDifferenceFunction<T, I, L> >::deserialize
(
   INDEX_INPUT_ITERATOR indexInIterator, 
   VALUE_INPUT_ITERATOR valueInIterator, 
   SquaredDifferenceFunction<T, I, L>& dst
) {
   const size_t shape0=*indexInIterator;
   ++indexInIterator;
   dst = SquaredDifferenceFunction<T, I, L>(shape0, *indexInIterator, *valueInIterator);
}

} // namespace opengm

#endif // OPENGM_SQUARED_DIFFERENCE_FUNCTION_HXX