ALP User Documentation 0.7.0
Algebraic Programming User Documentation
matrix.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
27#ifndef _H_GRB_MATRIX_BASE
28#define _H_GRB_MATRIX_BASE
29
30#include <iterator>
31
32#include <stddef.h>
33
34#include <utility>
35
38#include <graphblas/ops.hpp>
39#include <graphblas/rc.hpp>
40
41
42namespace grb {
43
65 template<
66 typename D, enum Backend implementation,
67 typename RowIndexType,
68 typename ColIndexType,
69 typename NonzeroIndexType
70 >
71 class Matrix {
72
73 public :
74
76 typedef Matrix<
77 D, implementation,
80
116 class const_iterator : public std::iterator<
117 std::forward_iterator_tag,
118 std::pair< std::pair< const size_t, const size_t >, const D >,
119 size_t
120 > {
121
122 public :
123
130 bool operator==( const const_iterator &other ) const {
131 (void)other;
132 return false;
133 }
134
138 bool operator!=( const const_iterator &other ) const {
139 (void)other;
140 return true;
141 }
142
155 std::pair< const size_t, const D > operator*() const {
156 return std::pair< const size_t, const D >();
157 }
158
173 return *this;
174 }
175
176 };
177
179 typedef D value_type;
180
205 Matrix( const size_t rows, const size_t columns, const size_t nz ) {
206 (void) rows;
207 (void) columns;
208 (void) nz;
209 }
210
226 Matrix( const size_t rows, const size_t columns ) {
227 (void)rows;
228 (void)columns;
229 }
230
261 const Matrix<
262 D, implementation,
264 > &other
265 ) {
266 (void) other;
267 }
268
283 Matrix( self_type &&other ) {
284 (void) other;
285 }
286
303 self_type& operator=( self_type &&other ) noexcept {
304 *this = std::move( other );
305 return *this;
306 }
307
322
350
359
381
390
391 };
392
393} // end namespace ``grb''
394
395#endif // end _H_GRB_MATRIX_BASE
396
This file contains a register of all backends that are either implemented, under implementation,...
A standard iterator for an ALP/GraphBLAS matrix.
Definition: matrix.hpp:120
bool operator!=(const const_iterator &other) const
Definition: matrix.hpp:138
std::pair< const size_t, const D > operator*() const
Dereferences the current position of this iterator.
Definition: matrix.hpp:155
bool operator==(const const_iterator &other) const
Standard equals operator.
Definition: matrix.hpp:130
const_iterator & operator++()
Advances the position of this iterator by one.
Definition: matrix.hpp:172
An ALP/GraphBLAS matrix.
Definition: matrix.hpp:71
self_type & operator=(self_type &&other) noexcept
Move-assignment.
Definition: matrix.hpp:303
Matrix(const size_t rows, const size_t columns)
ALP/GraphBLAS matrix constructor that sets a default initial capacity.
Definition: matrix.hpp:226
~Matrix()
Matrix destructor.
Definition: matrix.hpp:321
D value_type
The value type of elements stored in this matrix.
Definition: matrix.hpp:179
const_iterator begin() const
Same as cbegin().
Definition: matrix.hpp:358
const_iterator cbegin() const
Provides the only mechanism to extract data from a GraphBLAS matrix.
Definition: matrix.hpp:349
Matrix(const Matrix< D, implementation, RowIndexType, ColIndexType, NonzeroIndexType > &other)
Copy constructor.
Definition: matrix.hpp:260
Matrix< D, implementation, RowIndexType, ColIndexType, NonzeroIndexType > self_type
The type of this container.
Definition: matrix.hpp:79
const_iterator cend() const
Indicates the end to the elements in this container.
Definition: matrix.hpp:380
Matrix(self_type &&other)
Move constructor.
Definition: matrix.hpp:283
const_iterator end() const
Same as cend().
Definition: matrix.hpp:389
Matrix(const size_t rows, const size_t columns, const size_t nz)
ALP/GraphBLAS matrix constructor that sets an initial capacity.
Definition: matrix.hpp:205
Defines all ALP/GraphBLAS descriptors.
Backend
A collection of all backends.
Definition: backends.hpp:46
unsigned int ColIndexType
What data type should be used to store column indices.
Definition: base/config.hpp:449
unsigned int RowIndexType
What data type should be used to store row indices.
Definition: base/config.hpp:436
size_t NonzeroIndexType
What data type should be used to refer to an array containing nonzeroes.
Definition: base/config.hpp:462
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:452
Provides a set of standard binary operators.
Defines the ALP error codes.