27 #ifndef _H_GRB_ALGORITHMS_MPV 28 #define _H_GRB_ALGORITHMS_MPV 35 namespace algorithms {
93 template< Descriptor descr,
class Ring,
typename IOType,
typename InputType >
102 (std::is_same< IOType, typename Ring::D4 >::value &&
103 std::is_same< InputType, typename Ring::D2 >::value &&
104 std::is_same< IOType, typename Ring::D1 >::value &&
105 std::is_same< IOType, typename Ring::D3 >::value
107 "grb::mpv : some containers were passed with element types that do not" 108 "match the given semiring domains." 112 const size_t n =
nrows( A );
113 if( n !=
ncols( A ) ) {
116 if(
size( u ) != n || n !=
size( v ) ) {
119 if(
size( temp ) != n ) {
130 return set< descr >( u, v );
134 std::cout <<
"init: input vector nonzeroes is " <<
grb::nnz( v ) <<
".\n";
136 RC ret = mxv< descr >( u, A, v, ring );
142 ret = ret ? ret :
clear( temp );
143 for(
size_t iterate = 1; ret ==
SUCCESS && iterate < k; iterate += 2 ) {
147 std::cout <<
"up: input vector nonzeroes is " <<
grb::nnz( u ) <<
"\n";
149 ret = mxv< descr >( temp, A, u, ring );
151 assert( iterate <= k );
152 if( iterate + 1 == k || ret !=
SUCCESS ) {
158 std::cout <<
"down: input vector nonzeroes is " <<
grb::nnz( temp ) <<
"\n";
160 ret = mxv< descr >( u, A, temp, ring );
165 std::swap( u, temp );
176 #endif // end ``_H_GRB_ALGORITHMS_MPV'' RC mpv(Vector< IOType > &u, const Matrix< InputType > &A, const size_t k, const Vector< IOType > &v, Vector< IOType > &temp, const Ring &ring)
The matrix powers kernel.
Definition: mpv.hpp:94
A call to a primitive has determined that one of its arguments was illegal as per the specification o...
Definition: rc.hpp:143
An ALP/GraphBLAS matrix.
Definition: matrix.hpp:72
RC
Return codes of ALP primitives.
Definition: rc.hpp:47
A GraphBLAS vector.
Definition: vector.hpp:64
static constexpr Descriptor no_casting
Disallows the standard casting of input parameters to a compatible domain in case they did not match ...
Definition: descriptors.hpp:196
size_t nnz(const Vector< DataType, backend, Coords > &x) noexcept
Request the number of nonzeroes in a given vector.
Definition: io.hpp:479
size_t nrows(const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept
Requests the row size of a given matrix.
Definition: io.hpp:286
size_t ncols(const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept
Requests the column size of a given matrix.
Definition: io.hpp:339
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
The main header to include in order to use the ALP/GraphBLAS API.
size_t size(const Vector< DataType, backend, Coords > &x) noexcept
Request the size of a given vector.
Definition: io.hpp:235
Indicates the primitive has executed successfully.
Definition: rc.hpp:54
size_t capacity(const Vector< InputType, backend, Coords > &x) noexcept
Queries the capacity of the given ALP/GraphBLAS container.
Definition: io.hpp:388
RC clear(Vector< DataType, backend, Coords > &x) noexcept
Clears a given vector of all nonzeroes.
Definition: io.hpp:574
One or more of the ALP/GraphBLAS objects passed to the primitive that returned this error have mismat...
Definition: rc.hpp:90