ALP User Documentation  0.8.preview
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 
36 #include <graphblas/backends.hpp>
38 #include <graphblas/ops.hpp>
39 #include <graphblas/rc.hpp>
40 
41 
42 namespace grb {
43 
65  template<
66  typename D,
67  enum Backend implementation,
68  typename RowIndexType,
69  typename ColIndexType,
70  typename NonzeroIndexType
71  >
72  class Matrix {
73 
74  public :
75 
77  typedef Matrix<
78  D, implementation,
81 
117  class const_iterator : public std::iterator<
118  std::forward_iterator_tag,
119  std::pair< std::pair< const size_t, const size_t >, const D >,
120  size_t
121  > {
122 
123  public :
124 
131  bool operator==( const const_iterator &other ) const {
132  (void)other;
133  return false;
134  }
135 
139  bool operator!=( const const_iterator &other ) const {
140  (void)other;
141  return true;
142  }
143 
156  std::pair< const size_t, const D > operator*() const {
157  return std::pair< const size_t, const D >();
158  }
159 
174  return *this;
175  }
176 
177  };
178 
180  typedef D value_type;
181 
206  Matrix( const size_t rows, const size_t columns, const size_t nz ) {
207  (void) rows;
208  (void) columns;
209  (void) nz;
210  }
211 
227  Matrix( const size_t rows, const size_t columns ) {
228  (void)rows;
229  (void)columns;
230  }
231 
262  const Matrix<
263  D, implementation,
265  > &other
266  ) {
267  (void) other;
268  }
269 
284  Matrix( self_type &&other ) {
285  (void) other;
286  }
287 
304  self_type& operator=( self_type &&other ) noexcept {
305  *this = std::move( other );
306  return *this;
307  }
308 
322  ~Matrix() {}
323 
350  const_iterator cbegin() const {}
351 
359  const_iterator begin() const {}
360 
381  const_iterator cend() const {}
382 
390  const_iterator end() const {}
391 
392  };
393 
394 } // end namespace ``grb''
395 
396 #endif // end _H_GRB_MATRIX_BASE
397 
Defines the ALP error codes.
unsigned int RowIndexType
What data type should be used to store row indices.
Definition: base/config.hpp:436
This file contains a register of all backends that are either implemented, under implementation,...
An ALP/GraphBLAS matrix.
Definition: matrix.hpp:72
D value_type
The value type of elements stored in this matrix.
Definition: matrix.hpp:180
Matrix(const size_t rows, const size_t columns)
ALP/GraphBLAS matrix constructor that sets a default initial capacity.
Definition: matrix.hpp:227
A standard iterator for an ALP/GraphBLAS matrix.
Definition: matrix.hpp:117
~Matrix()
Matrix destructor.
Definition: matrix.hpp:322
const_iterator cbegin() const
Provides the only mechanism to extract data from a GraphBLAS matrix.
Definition: matrix.hpp:350
const_iterator & operator++()
Advances the position of this iterator by one.
Definition: matrix.hpp:173
const_iterator cend() const
Indicates the end to the elements in this container.
Definition: matrix.hpp:381
self_type & operator=(self_type &&other) noexcept
Move-assignment.
Definition: matrix.hpp:304
const_iterator begin() const
Same as cbegin().
Definition: matrix.hpp:359
unsigned int ColIndexType
What data type should be used to store column indices.
Definition: base/config.hpp:449
std::pair< const size_t, const D > operator*() const
Dereferences the current position of this iterator.
Definition: matrix.hpp:156
Defines all ALP/GraphBLAS descriptors.
Matrix< D, implementation, RowIndexType, ColIndexType, NonzeroIndexType > self_type
The type of this container.
Definition: matrix.hpp:80
const_iterator end() const
Same as cend().
Definition: matrix.hpp:390
Backend
A collection of all backends.
Definition: backends.hpp:49
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
Matrix(const Matrix< D, implementation, RowIndexType, ColIndexType, NonzeroIndexType > &other)
Copy constructor.
Definition: matrix.hpp:261
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:206
size_t NonzeroIndexType
What data type should be used to refer to an array containing nonzeroes.
Definition: base/config.hpp:462
bool operator!=(const const_iterator &other) const
Definition: matrix.hpp:139
bool operator==(const const_iterator &other) const
Standard equals operator.
Definition: matrix.hpp:131
Provides a set of standard binary operators.
Matrix(self_type &&other)
Move constructor.
Definition: matrix.hpp:284