37 namespace algorithms {
81 template< Descriptor descr,
typename OutputType,
typename InputType >
84 const size_t source,
const size_t k,
94 const size_t n =
nrows( A );
95 if( n !=
ncols( A ) ) {
98 if(
size( buf1 ) != n ) {
101 if(
size( u ) != n ) {
113 if(
nnz( u ) != 0 ) {
116 if(
nnz( buf1 ) != 0 ) {
117 ret = ret ? ret :
clear( buf1 );
120 std::cout <<
"grb::algorithms::knn called with source " << source <<
" " 121 <<
"and k " << k <<
".\n";
123 ret = ret ? ret :
setElement( buf1,
true, source );
130 >( u, A, k, buf1, buf1, ring );
134 >( u, A, k, buf1, buf1, ring );
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
RC knn(Vector< OutputType > &u, const Matrix< InputType > &A, const size_t source, const size_t k, Vector< bool > &buf1)
Given a graph and a source vertex, indicates which vertices are contained within k hops.
Definition: knn.hpp:82
A GraphBLAS vector.
Definition: vector.hpp:64
static constexpr Descriptor add_identity
For any call to a matrix computation, the input matrix A is instead interpreted as ,...
Definition: descriptors.hpp:159
static constexpr Descriptor transpose_matrix
Transposes the input matrix prior to applying it.
Definition: descriptors.hpp:71
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
Standard identitity for the logical or operator.
Definition: identities.hpp:151
Implements the matrix powers kernel over arbitrary semirings.
size_t ncols(const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept
Requests the column size of a given matrix.
Definition: io.hpp:339
Standard identity for the logical AND operator.
Definition: identities.hpp:178
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
The logical and.
Definition: ops.hpp:490
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
The logical or.
Definition: ops.hpp:462
A generalised semiring.
Definition: semiring.hpp:190
RC setElement(Vector< DataType, backend, Coords > &x, const T val, const size_t i, const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< DataType >::value &&!grb::is_object< T >::value, void >::type *const =nullptr)
Sets the element of a given vector at a given position to a given value.
Definition: io.hpp:1129
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