This file is indexed.

/usr/include/viennacl/tools/entry_proxy.hpp is in libviennacl-dev 1.5.2-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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#ifndef VIENNACL_TOOLS_ENTRY_PROXY_HPP_
#define VIENNACL_TOOLS_ENTRY_PROXY_HPP_

/* =========================================================================
   Copyright (c) 2010-2014, Institute for Microelectronics,
                            Institute for Analysis and Scientific Computing,
                            TU Wien.
   Portions of this software are copyright by UChicago Argonne, LLC.

                            -----------------
                  ViennaCL - The Vienna Computing Library
                            -----------------

   Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at

   (A list of authors and contributors can be found in the PDF manual)

   License:         MIT (X11), see file LICENSE in the base directory
============================================================================= */

/** @file viennacl/tools/entry_proxy.hpp
    @brief A proxy class for entries in a vector
*/


#include "viennacl/forwards.h"
#include "viennacl/scalar.hpp"

namespace viennacl
{
    //proxy class for single vector entries (this is a slow operation!!)
    /**
    * @brief A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-users of the library.
    *
    * This proxy provides access to a single entry of a vector. If the element is assigned to a GPU object, no unnecessary transfers to the CPU and back to GPU are initiated.
    *
    * @tparam SCALARTYPE Either float or double
    */
    template <typename SCALARTYPE>
    class entry_proxy
    {
      public:
        typedef viennacl::backend::mem_handle      handle_type;

        /** @brief The constructor for the proxy class. Declared explicit to avoid any surprises created by the compiler.
        *
        * @param mem_offset The memory offset in multiples of sizeof(SCALARTYPE) relative to the memory pointed to by the handle
        * @param mem_handle A viennacl::ocl::handle for the memory buffer on the GPU.
        */
        explicit entry_proxy(vcl_size_t mem_offset,
                             handle_type & mem_handle)
         : index_(mem_offset), mem_handle_(mem_handle) {}


        //operators:
        /** @brief Inplace addition of a CPU floating point value
        */
        entry_proxy & operator+=(SCALARTYPE value)
        {
          SCALARTYPE temp = read();
          temp += value;
          write(temp);
          return *this;
        }

        /** @brief Inplace subtraction of a CPU floating point value
        */
        entry_proxy &  operator-=(SCALARTYPE value)
        {
          SCALARTYPE temp = read();
          temp -= value;
          write(temp);
          return *this;
        }

        /** @brief Inplace multiplication with a CPU floating point value
        */
        entry_proxy &  operator*=(SCALARTYPE value)
        {
          SCALARTYPE temp = read();
          temp *= value;
          write(temp);
          return *this;
        }

        /** @brief Inplace division by a CPU floating point value
        */
        entry_proxy &  operator/=(SCALARTYPE value)
        {
          SCALARTYPE temp = read();
          temp /= value;
          write(temp);
          return *this;
        }

        /** @brief Assignment of a CPU floating point value
        */
        entry_proxy &  operator=(SCALARTYPE value)
        {
          write(value);
          return *this;
        }

        /** @brief Assignment of a GPU floating point value. Avoids unnecessary GPU->CPU->GPU transfers
        */
        entry_proxy & operator=(scalar<SCALARTYPE> const & value)
        {
          viennacl::backend::memory_copy(value.handle(), mem_handle_, 0, sizeof(SCALARTYPE)*index_, sizeof(SCALARTYPE));
          return *this;
        }

        /** @brief Assignment of another GPU value.
        */
        entry_proxy &  operator=(entry_proxy const & other)
        {
          viennacl::backend::memory_copy(other.handle(), mem_handle_, sizeof(SCALARTYPE) * other.index_, sizeof(SCALARTYPE)*index_, sizeof(SCALARTYPE));
          return *this;
        }

        //type conversion:
        // allows to write something like:
        //  double test = vector(4);
        /** @brief Conversion to a CPU floating point value.
        *
        *  This conversion allows to write something like
        *    double test = vector(4);
        *  However, one has to keep in mind that CPU<->GPU transfers are very slow compared to CPU<->CPU operations.
        */
        operator SCALARTYPE () const
        {
          SCALARTYPE temp = read();
          return temp;
        }

        /** @brief Returns the index of the represented element
        */
        vcl_size_t index() const { return index_; }

        /** @brief Returns the memory viennacl::ocl::handle
        */
        handle_type const & handle() const { return mem_handle_; }

      private:
        /** @brief Reads an element from the GPU to the CPU
        */
        SCALARTYPE read() const
        {
          SCALARTYPE temp;
          viennacl::backend::memory_read(mem_handle_, sizeof(SCALARTYPE)*index_, sizeof(SCALARTYPE), &temp);
          return temp;
        }

        /** @brief Writes a floating point value to the GPU
        */
        void write(SCALARTYPE value)
        {
          viennacl::backend::memory_write(mem_handle_, sizeof(SCALARTYPE)*index_, sizeof(SCALARTYPE), &value);
        }

        vcl_size_t index_;
        viennacl::backend::mem_handle & mem_handle_;
    }; //entry_proxy







    /**
    * @brief A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-users of the library.
    *
    * This proxy provides access to a single entry of a vector. If the element is assigned to a GPU object, no unnecessary transfers to the CPU and back to GPU are initiated.
    *
    * @tparam SCALARTYPE Either float or double
    */
    template <typename SCALARTYPE>
    class const_entry_proxy
    {
        typedef const_entry_proxy<SCALARTYPE>      self_type;
      public:
        typedef viennacl::backend::mem_handle      handle_type;

        /** @brief The constructor for the proxy class. Declared explicit to avoid any surprises created by the compiler.
        *
        * @param mem_offset The memory offset in multiples of sizeof(SCALARTYPE) relative to the memory pointed to by the handle
        * @param mem_handle A viennacl::ocl::handle for the memory buffer on the GPU.
        */
        explicit const_entry_proxy(vcl_size_t mem_offset,
                                   handle_type const & mem_handle)
         : index_(mem_offset), mem_handle_(mem_handle) {}


        //type conversion:
        // allows to write something like:
        //  double test = vector(4);
        /** @brief Conversion to a CPU floating point value.
        *
        *  This conversion allows to write something like
        *    double test = vector(4);
        *  However, one has to keep in mind that CPU<->GPU transfers are very slow compared to CPU<->CPU operations.
        */
        operator SCALARTYPE () const
        {
          SCALARTYPE temp = read();
          return temp;
        }

        /** @brief Returns the index of the represented element
        */
        unsigned int index() const { return index_; }

        /** @brief Returns the memory handle
        */
        handle_type const & handle() const { return mem_handle_; }

      private:
        /** @brief Reads an element from the GPU to the CPU
        */
        SCALARTYPE read() const
        {
          SCALARTYPE temp;
          viennacl::backend::memory_read(mem_handle_, sizeof(SCALARTYPE)*index_, sizeof(SCALARTYPE), &temp);
          return temp;
        }

        vcl_size_t index_;
        viennacl::backend::mem_handle const & mem_handle_;
    }; //entry_proxy

}

#endif