This file is indexed.

/usr/include/shogun/io/StreamingFileFromSimpleFeatures.h is in libshogun-dev 1.1.0-4ubuntu2.

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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Written (W) 2011 Shashwat Lal Das
 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
 */
#ifndef __STREAMING_FILEFROMSIMPLE_H__
#define __STREAMING_FILEFROMSIMPLE_H__

#include <shogun/io/StreamingFileFromFeatures.h>
#include <shogun/features/SimpleFeatures.h>

namespace shogun
{
/** @brief Class CStreamingFileFromSimpleFeatures is a derived
 * class of CStreamingFile which creates an input source
 * for the online framework from a CSimpleFeatures object.
 *
 * This kind of input is seekable, and hence can be used for
 * making multiple passes over data.
 *
 * It is useful for testing/comparison purposes.
 */
template <class T> class CStreamingFileFromSimpleFeatures: public CStreamingFileFromFeatures
{
public:
	/**
	 * Default constructor
	 */
	CStreamingFileFromSimpleFeatures();

	/**
	 * Constructor taking a SimpleFeatures object as arg
	 *
	 * @param feat SimpleFeatures object
	 */
	CStreamingFileFromSimpleFeatures(CSimpleFeatures<T>* feat);

	/**
	 * Constructor taking a SimpleFeatures object as arg
	 *
	 * @param feat SimpleFeatures object
	 * @param lab Labels as float64_t*
	 */
	CStreamingFileFromSimpleFeatures(CSimpleFeatures<T>* feat, float64_t* lab);

	/**
	 * Destructor
	 */
	virtual ~CStreamingFileFromSimpleFeatures();

	/**
	 * This function will be called for reading vectors from the
	 * corresponding SimpleFeatures object.
	 * It is specialized depending on class type T.
	 *
	 * @param vec vector
	 * @param len length of vector
	 */
	virtual void get_vector(T* &vec, int32_t &len);

	/**
	 * This function will be called for reading vectors and labels
	 * from the corresponding SimpleFeatures object.  It is
	 * specialized depending on class type T.
	 *
	 * @param vec vector
	 * @param len length of vector
	 * @param label label
	 */
	virtual void get_vector_and_label(T* &vec, int32_t &len, float64_t &label);

	/**
	 * Reset the stream so the next example returned is the first
	 * example in the SimpleFeatures object.
	 *
	 */
	void reset_stream()
	{
		vector_num = 0;
	}

	/** @return object name */
	inline virtual const char* get_name() const
	{
		return "StreamingFileFromSimpleFeatures";

	}

private:
	/**
	 * Initialize members to defaults
	 */
	void init();

protected:

	/// SimpleFeatures object
	CSimpleFeatures<T>* features;

	/// Index of vector to be returned from the feature matrix
	int32_t vector_num;

};

template <class T>
CStreamingFileFromSimpleFeatures<T>::CStreamingFileFromSimpleFeatures()
	: CStreamingFileFromFeatures()
{
	init();
}

template <class T>
CStreamingFileFromSimpleFeatures<T>::CStreamingFileFromSimpleFeatures(CSimpleFeatures<T>* feat)
	: CStreamingFileFromFeatures()
{
	ASSERT(feat);
	features=feat;

	init();
}

template <class T>
CStreamingFileFromSimpleFeatures<T>::CStreamingFileFromSimpleFeatures(CSimpleFeatures<T>* feat, float64_t* lab)
	: CStreamingFileFromFeatures()
{
	ASSERT(feat);
	ASSERT(lab);
	features=feat;
	labels=lab;

	init();
}

template <class T>
CStreamingFileFromSimpleFeatures<T>::~CStreamingFileFromSimpleFeatures()
{
}

template <class T>
void CStreamingFileFromSimpleFeatures<T>::init()
{
	vector_num=0;
}

/* Functions to return the vector from the SimpleFeatures object
 * If the class is of type T, specialize this function to work for
 * vectors of that type. */
template <class T>
void CStreamingFileFromSimpleFeatures<T>::get_vector(T*& vector, int32_t& num_feat)
{
	if (vector_num >= features->get_num_vectors())
	{
		vector=NULL;
		num_feat=-1;
		return;
	}

	SGVector<T> sg_vector=
		features->get_feature_vector(vector_num);

	vector = sg_vector.vector;
	num_feat = sg_vector.vlen;;
	vector_num++;

}

/* Functions to return the vector from the SimpleFeatures object with label */
template <class T>
void CStreamingFileFromSimpleFeatures<T>::get_vector_and_label
(T*& vector, int32_t& num_feat, float64_t& label)
{
	if (vector_num >= features->get_num_vectors())
	{
		vector=NULL;
		num_feat=-1;
		return;
	}

	SGVector<T> sg_vector
		=features->get_feature_vector(vector_num);

	vector = sg_vector.vector;
	num_feat = sg_vector.vlen;
	label = labels[vector_num];

	vector_num++;
}

}
#endif //__STREAMING_FILEFROMSIMPLE_H__