This file is indexed.

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

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

namespace opengm {

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

/// FunctionSerialization
///
/// \ingroup functions
template<class T,class I,class L,class C>
class FunctionSerialization< opengm::SparseFunction<T,I,L,C> > {
public:
   typedef typename opengm::SparseFunction<T,I,L,C>::ValueType ValueType;

   static size_t indexSequenceSize(const opengm::SparseFunction<T,I,L,C>&);
   static size_t valueSequenceSize(const opengm::SparseFunction<T,I,L,C>&);
   template<class INDEX_OUTPUT_ITERATOR,class VALUE_OUTPUT_ITERATOR >
      static void serialize(const opengm::SparseFunction<T,I,L,C>&, INDEX_OUTPUT_ITERATOR,VALUE_OUTPUT_ITERATOR );
   template<class INDEX_INPUT_ITERATOR ,class VALUE_INPUT_ITERATOR>
      static void deserialize( INDEX_INPUT_ITERATOR,VALUE_INPUT_ITERATOR, opengm::SparseFunction<T,I,L,C>&);
};
/// \endcond

template<class T,class I,class L,class C>
inline size_t
FunctionSerialization<opengm::SparseFunction<T,I,L,C> >::indexSequenceSize
(
   const opengm::SparseFunction<T,I,L,C>& src
) {
   return 1 + src.dimension()+1+src.container().size();
}

template<class T,class I,class L,class C>
inline size_t
FunctionSerialization<opengm::SparseFunction<T,I,L,C> >::valueSequenceSize
(
   const opengm::SparseFunction<T,I,L,C>& src
) {

   return src.container().size()+1;
}

template<class T,class I,class L,class C>
template<class INDEX_OUTPUT_ITERATOR,class VALUE_OUTPUT_ITERATOR >
void
FunctionSerialization<opengm::SparseFunction<T,I,L,C> >::serialize
(
   const opengm::SparseFunction<T,I,L,C>& src,
   INDEX_OUTPUT_ITERATOR indexOutIterator,
   VALUE_OUTPUT_ITERATOR valueOutIterator
) {
   *indexOutIterator=src.dimension();
   ++indexOutIterator;
   for(size_t i=0;i<src.dimension();++i) {
      *indexOutIterator=src.shape(i);
      ++indexOutIterator;
   }
   //save the default value
   *valueOutIterator=src.defaultValue();
   ++valueOutIterator;
   //save how many not default values are in the SparseFunction
   *indexOutIterator=src.container().size();
   ++indexOutIterator;
   typedef typename opengm::SparseFunction<T,I,L,C>::ContainerType::const_iterator IterType;
   IterType srcIter=src.container().begin();
   for(size_t i=0;i<src.container().size();++i) {
      *indexOutIterator=srcIter->first;
      *valueOutIterator=srcIter->second;
      ++valueOutIterator;
      ++indexOutIterator;
      ++srcIter;
   }
}

template<class T,class I,class L,class C>
template<class INDEX_INPUT_ITERATOR,class VALUE_INPUT_ITERATOR >
void
FunctionSerialization<opengm::SparseFunction<T,I,L,C> >::deserialize
(
   INDEX_INPUT_ITERATOR indexOutIterator,
   VALUE_INPUT_ITERATOR valueOutIterator,
   opengm::SparseFunction<T,I,L,C>& dst
) {

   const size_t dim=*indexOutIterator;
   std::vector<size_t> shape(dim);
   ++indexOutIterator;
   for(size_t i=0;i<dim;++i) {
      shape[i]=*indexOutIterator;
      ++indexOutIterator;
   }
   dst = opengm::SparseFunction<T,I,L,C>(shape.begin(),shape.end(),*valueOutIterator);
   ++valueOutIterator;
   const size_t nNonDefault=*indexOutIterator;
   ++indexOutIterator;
   typedef typename opengm::SparseFunction<T,I,L,C>::KeyValPairType KeyValPairType;
   for(size_t i=0;i<nNonDefault;++i) {

      dst.container().insert(KeyValPairType(*indexOutIterator,*valueOutIterator));
      ++valueOutIterator;
      ++indexOutIterator;
   }
   
}

} // namepsace opengm

#endif // OPENGM_SPARSE_FUNCTION