spla
algorithm.hpp
Go to the documentation of this file.
1 /**********************************************************************************/
2 /* This file is part of spla project */
3 /* https://github.com/SparseLinearAlgebra/spla */
4 /**********************************************************************************/
5 /* MIT License */
6 /* */
7 /* Copyright (c) 2023 SparseLinearAlgebra */
8 /* */
9 /* Permission is hereby granted, free of charge, to any person obtaining a copy */
10 /* of this software and associated documentation files (the "Software"), to deal */
11 /* in the Software without restriction, including without limitation the rights */
12 /* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */
13 /* copies of the Software, and to permit persons to whom the Software is */
14 /* furnished to do so, subject to the following conditions: */
15 /* */
16 /* The above copyright notice and this permission notice shall be included in all */
17 /* copies or substantial portions of the Software. */
18 /* */
19 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
20 /* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
21 /* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
22 /* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
23 /* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
24 /* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
25 /* SOFTWARE. */
26 /**********************************************************************************/
27 
28 #ifndef SPLA_ALGORITHM_HPP
29 #define SPLA_ALGORITHM_HPP
30 
31 #include "config.hpp"
32 #include "descriptor.hpp"
33 #include "matrix.hpp"
34 #include "scalar.hpp"
35 #include "vector.hpp"
36 
37 namespace spla {
38 
55  const ref_ptr<Vector>& v,
56  const ref_ptr<Matrix>& A,
57  uint s,
58  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
59 
71  std::vector<int>& v,
72  std::vector<std::vector<spla::uint>>& A,
73  uint s,
74  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
75 
87  const ref_ptr<Vector>& v,
88  const ref_ptr<Matrix>& A,
89  uint s,
90  const ref_ptr<Descriptor>& descriptor = ref_ptr<Descriptor>());
91 
103  SPLA_API Status sssp_naive(std::vector<float>& v,
104  std::vector<std::vector<uint>>& Ai,
105  std::vector<std::vector<float>>& Ax,
106  uint s,
107  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
108 
121  ref_ptr<Vector>& p,
122  const ref_ptr<Matrix>& A,
123  float alpha = 0.85,
124  float eps = 1e-6,
125  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
126 
140  std::vector<float>& p,
141  std::vector<std::vector<uint>>& Ai,
142  std::vector<std::vector<float>>& Ax,
143  float alpha = 0.85,
144  float eps = 1e-6,
145  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
146 
158  int& ntrins,
159  const ref_ptr<Matrix>& A,
160  const ref_ptr<Matrix>& B,
161  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
162 
173  int& ntrins,
174  std::vector<std::vector<spla::uint>>& Ai,
175  const ref_ptr<Descriptor>& descriptor = spla::Descriptor::make());
176 
181 }// namespace spla
182 
183 #endif//SPLA_ALGORITHM_HPP
Status of library operation execution.
static ref_ptr< Descriptor > make()
Makes new empty descriptor object.
Definition: descriptor.cpp:39
Automates reference counting and behaves as shared smart pointer.
Definition: ref.hpp:117
#define SPLA_API
Definition: config.hpp:43
Status sssp_naive(std::vector< float > &v, std::vector< std::vector< uint >> &Ai, std::vector< std::vector< float >> &Ax, uint s, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
Naive single-source shortest path algorithm (reference cpu implementation)
Definition: algorithm.cpp:231
Status tc_naive(int &ntrins, std::vector< std::vector< spla::uint >> &Ai, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
Naive triangles counting algorithm (reference cpu implementation)
Definition: algorithm.cpp:416
Status pr_naive(std::vector< float > &p, std::vector< std::vector< uint >> &Ai, std::vector< std::vector< float >> &Ax, float alpha=0.85, float eps=1e-6, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
Naive PageRank algorithm (reference cpu implementation)
Definition: algorithm.cpp:337
Status sssp(const ref_ptr< Vector > &v, const ref_ptr< Matrix > &A, uint s, const ref_ptr< Descriptor > &descriptor=ref_ptr< Descriptor >())
Single-source shortest path algorithm.
Definition: algorithm.cpp:158
Status bfs(const ref_ptr< Vector > &v, const ref_ptr< Matrix > &A, uint s, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
Breadth-first search algorithm.
Definition: algorithm.cpp:45
std::uint32_t uint
Library index and size type.
Definition: config.hpp:56
Status pr(ref_ptr< Vector > &p, const ref_ptr< Matrix > &A, float alpha=0.85, float eps=1e-6, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
PageRank algorithm.
Definition: algorithm.cpp:278
Status bfs_naive(std::vector< int > &v, std::vector< std::vector< spla::uint >> &A, uint s, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
Naive breadth-first search algorithm (reference cpu implementation)
Definition: algorithm.cpp:122
Status tc(int &ntrins, const ref_ptr< Matrix > &A, const ref_ptr< Matrix > &B, const ref_ptr< Descriptor > &descriptor=spla::Descriptor::make())
Triangles counting algorithm.
Definition: algorithm.cpp:380
Definition: algorithm.hpp:37