21 #include <boost/numeric/ublas/matrix.hpp>
22 #include <boost/numeric/ublas/matrix_proxy.hpp>
27 using coordinate_t = double;
28 using matrix_t = boost::numeric::ublas::matrix<coordinate_t>;
31 std::size_t
const rows_count = 5;
32 std::size_t
const columns_count = 3;
33 std::size_t
const sketch_size = 4;
35 auto fd_sketch = paal::make_frequent_directions<coordinate_t>(sketch_size, columns_count);
37 matrix_t data(rows_count, columns_count);
43 fd_sketch.update(std::move(data));
45 std::vector<std::vector<coordinate_t>> rows = {
51 fd_sketch.update_range(std::move(rows));
53 auto row = {7.0, 6.0, 5.0};
54 fd_sketch.update_row(std::move(row));
58 auto actual_size = fd_sketch.get_sketch().second;
59 std::cout <<
"Actual sketch size: " << actual_size << std::endl;
60 auto sketch = fd_sketch.get_sketch().first;
61 boost::numeric::ublas::matrix_range<matrix_t> sketch_range (sketch,
62 boost::numeric::ublas::range(0, actual_size),
63 boost::numeric::ublas::range(0, columns_count));
64 std::cout <<
"Sketch data:" << std::endl;
66 std::cout << std::endl;
void print_matrix(Stream &o, Matrix &&m, const std::string &del)
prints matrix with delimiters
auto irange(T begin, T end)
irange