ALP User Documentation 0.7.alpha
Algebraic Programming User Documentation
Loading...
Searching...
No Matches
pinnedvector.hpp
Go to the documentation of this file.
1
2/*
3 * Copyright 2021 Huawei Technologies Co., Ltd.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
26#ifndef _H_GRB_BASE_PINNEDVECTOR
27#define _H_GRB_BASE_PINNEDVECTOR
28
29#include <limits>
30
32#include <graphblas/iomode.hpp>
33
34#include "vector.hpp"
35
36
37namespace grb {
38
74 template< typename IOType, enum Backend implementation >
76
77 private :
78
82 static const constexpr bool
83 function_was_not_implemented_in_the_selected_backend = false;
84
85
86 public :
87
133 template< typename Coord >
136 const IOMode mode
137 ) {
138 (void) vector;
139 (void) mode;
140 assert( function_was_not_implemented_in_the_selected_backend );
141 }
142
154 assert( function_was_not_implemented_in_the_selected_backend );
155 }
156
167 assert( function_was_not_implemented_in_the_selected_backend );
168 }
169
180 inline size_t size() const noexcept {
181 assert( function_was_not_implemented_in_the_selected_backend );
182 return 0;
183 }
184
195 inline size_t nonzeroes() const noexcept {
196 assert( function_was_not_implemented_in_the_selected_backend );
197 return 0;
198 }
199
232 template< typename OutputType >
233 inline OutputType getNonzeroValue(
234 const size_t k, const OutputType one = OutputType()
235 ) const noexcept {
236 (void) k;
237 assert( function_was_not_implemented_in_the_selected_backend );
238 return one;
239 }
240
256 inline IOType getNonzeroValue(
257 const size_t k
258 ) const noexcept {
259 IOType ret;
260 (void) k;
261 assert( function_was_not_implemented_in_the_selected_backend );
262 return ret;
263 }
264
282 inline size_t getNonzeroIndex(
283 const size_t k
284 ) const noexcept {
285 (void) k;
286 assert( function_was_not_implemented_in_the_selected_backend );
287 return std::numeric_limits< size_t >::max();
288 }
289
290
291 }; // end class grb::PinnedVector
292
293} // end namespace ``grb''
294
295#endif // end _H_GRB_BASE_PINNEDVECTOR
296
This file contains a register of all backends that are either implemented, under implementation,...
Provides a mechanism to access ALP containers from outside of an ALP context.
Definition: pinnedvector.hpp:75
PinnedVector(const Vector< IOType, implementation, Coord > &vector, const IOMode mode)
Pins the contents of a given vector.
Definition: pinnedvector.hpp:134
size_t size() const noexcept
Definition: pinnedvector.hpp:180
PinnedVector()
Base constructor for this class.
Definition: pinnedvector.hpp:153
size_t nonzeroes() const noexcept
Definition: pinnedvector.hpp:195
IOType getNonzeroValue(const size_t k) const noexcept
Direct access variation of the general getNonzeroValue function.
Definition: pinnedvector.hpp:256
size_t getNonzeroIndex(const size_t k) const noexcept
Retrieves a nonzero index.
Definition: pinnedvector.hpp:282
~PinnedVector()
Destroys a grb::PinnedVector instance.
Definition: pinnedvector.hpp:166
OutputType getNonzeroValue(const size_t k, const OutputType one=OutputType()) const noexcept
Returns a requested nonzero of the pinned vector.
Definition: pinnedvector.hpp:233
A GraphBLAS vector.
Definition: vector.hpp:64
Defines the various I/O modes a user could employ with ALP data ingestion or extraction.
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:450
IOMode
The GraphBLAS input and output functionalities can either be used in a sequential or parallel fashion...
Definition: iomode.hpp:67
Specifies the ALP/GraphBLAS vector container.