-
Notifications
You must be signed in to change notification settings - Fork 3
/
azint.hpp
65 lines (58 loc) · 1.48 KB
/
azint.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <pybind11/stl.h>
namespace py = pybind11;
enum class Unit
{
q,
tth
};
struct Entry
{
Entry(int c, float v) : col(c), value(v) {}
int col;
float value;
};
struct RListMatrix
{
RListMatrix(int nrows) : rows(nrows), nelements(0) {}
std::vector<std::vector<Entry> > rows;
size_t nelements;
};
struct Poni
{
float dist;
float poni1;
float poni2;
float rot1;
float rot2;
float rot3;
float wavelength;
};
class Sparse
{
public:
Sparse(py::object py_poni,
py::array_t<float> pixel_corners,
int n_splitting,
py::array_t<int8_t> mask,
const std::string& unit,
py::array_t<float, py::array::c_style | py::array::forcecast> radial_bins,
std::optional<py::array_t<float, py::array::c_style | py::array::forcecast> > phi_bins);
Sparse(std::vector<int>&& c,
std::vector<int>&& r,
std::vector<float>&& v,
std::vector<float>&& vc,
std::vector<float>&& vc2);
void set_correction(py::array_t<float> corrections);
py::array_t<float> spmv(py::array x);
py::array_t<float> spmv_corrected(py::array x);
py::array_t<float> spmv_corrected2(py::array x);
// sparse csr matrix
std::vector<int> col_idx;
std::vector<int> row_ptr;
std::vector<float> values;
std::vector<float> values_corrected;
std::vector<float> values_corrected2;
};