-
Notifications
You must be signed in to change notification settings - Fork 3
/
tools.cpp
52 lines (37 loc) · 1.07 KB
/
tools.cpp
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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. See the enclosed file LICENSE for a copy or if
* that was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*
* Copyright 2017 Max H. Gerlach
*
* */
/*
* tools.cpp
*
* Created on: Apr 29, 2013
* Author: gerlach
*/
#include "tools.h"
#include <glob.h> //POSIX glob()
#include <iostream>
// Taken from:
// http://stackoverflow.com/questions/8401777/simple-glob-in-c-on-unix-system
std::vector<std::string> glob(const std::string& path){
using namespace std;
glob_t glob_result;
glob(path.c_str(), GLOB_TILDE, NULL, &glob_result);
vector<string> ret;
for(uint32_t i = 0; i < glob_result.gl_pathc; ++i){
ret.push_back(string(glob_result.gl_pathv[i]));
}
globfree(&glob_result);
return ret;
}
// these can be called from the debugger
void printMatrixReal(const arma::Mat<num>& mat) {
mat.print(std::cout);
}
void printMatrixComplex(const arma::Mat<cpx>& mat) {
mat.print(std::cout);
}