API
 
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1#ifndef PCUTILS_HPP
2#define PCUTILS_HPP
3
4#include <Eigen/Dense>
5#include <string>
6#include <iostream>
7#include <fstream>
8
9namespace DDSPC
10{
11 typedef float realT;
12 typedef Eigen::Matrix<realT, Eigen::Dynamic, Eigen::Dynamic> Matrix;
13
14 inline void print_shape_matrix(Matrix mat, std::string name=""){
15 std::cout << name << " Matrix is of size " << mat.rows() << "x" << mat.cols() << std::endl;
16 };
17
18 void print_matrix(Matrix mat, std::string name);
19
20 static inline uint64_t find_next_power_of_2(int sample){
21 uint64_t num_bits = 0;
22
23 do{
24 sample >>= 1;
25 ++num_bits;
26 } while(sample);
27
28 return 1 << num_bits;
29 };
30
31 void save_matrix(std::string fileName, Matrix mat);
32 Matrix load_matrix(std::string fileName);
33}
34
35#endif // utils_hpp
Eigen::Matrix< realT, Eigen::Dynamic, Eigen::Dynamic > Matrix
Definition utils.hpp:12
static uint64_t find_next_power_of_2(int sample)
Definition utils.hpp:20
float realT
Definition utils.hpp:11
void save_matrix(std::string fileName, Matrix mat)
Definition utils.cpp:11
Matrix load_matrix(std::string fileName)
Definition utils.cpp:38
void print_shape_matrix(Matrix mat, std::string name="")
Definition utils.hpp:14
void print_matrix(Matrix mat, std::string name="")
Definition utils.cpp:22