-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathutils.h
44 lines (34 loc) · 1.27 KB
/
utils.h
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
#ifndef UTILS_H
#define UTILS_H
#include <iostream>
#include <vector>
#include <random>
#include <fstream>
#include <functional>
#include <cmath>
#include <ctype.h>
#include <string>
#include <tr1/unordered_map>
#include <Eigen/Core>
using namespace Eigen;
using namespace std;
typedef Matrix<double, Dynamic, 1> Col;
typedef Matrix<double, 1, Dynamic> Row;
typedef Matrix<double, Dynamic, Dynamic> Mat;
typedef std::tr1::unordered_map<string, unsigned> mapStrUnsigned;
typedef std::tr1::unordered_map<int, Col> mapIntCol;
typedef std::tr1::unordered_map<int, Mat> mapIntMat;
typedef std::tr1::unordered_map<int, unsigned> mapIntUnsigned;
typedef std::tr1::unordered_map<unsigned, unsigned> mapUnsUns;
typedef std::tr1::unordered_map<unsigned, double> mapUnsDouble;
typedef std::tr1::unordered_map<unsigned, string> mapUnsignedStr;
typedef std::tr1::unordered_map<int, unsigned> mapIntUnsigned;
typedef std::tr1::unordered_map<string, bool> mapStrBool;
vector<string> split_line(const string&, char);
void ReadVecsFromFile(const string&, mapStrUnsigned*, vector<Col>*);
void ReadVecsFromFile(const string&, mapUnsignedStr*, vector<Col>*);
void ElemwiseTanh(Col*);
void ElemwiseTanhGrad(const Col&, Col*);
void ElemwiseAndrewNsnl(Col*);
void ElemwiseAndrewNsnlGrad(const Col&, Col*);
#endif