-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.hpp
48 lines (39 loc) · 1.45 KB
/
util.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
/*
* Copyright (c) 2011 Daisuke Okanohara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above Copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above Copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the authors nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*/
#ifndef REDSVD_UTIL_HPP__
#define REDSVD_UTIL_HPP__
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#include <vector>
#include <eigen3/Eigen/Sparse>
#include <eigen3/Eigen/Dense>
#include <eigen3/Eigen/Eigenvalues>
namespace REDSVD {
typedef Eigen::SparseMatrix<double, Eigen::RowMajor> SMatrixXd;
typedef std::vector<std::pair<int, double> > fv_t;
class Util{
public:
static void convertFV2Mat(const std::vector<fv_t>& fvs, SMatrixXd& A);
static void sampleGaussianMat(Eigen::MatrixXd& x);
static void processGramSchmidt(Eigen::MatrixXd& mat);
static double getSec();
private:
static void sampleTwoGaussian(double& f1, double& f2);
};
}
#endif // REDSVD_UTIL_HPP_