-
Notifications
You must be signed in to change notification settings - Fork 0
/
fun-bkup.cpp
74 lines (60 loc) · 1.53 KB
/
fun-bkup.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>
#include "fun.h"
extern "C"
int fun (void)
{
// Create interpreter.
octave::interpreter interpreter;
bool status = interpreter.initialized();
if(status==false)
{
interpreter.initialize ();
int status = interpreter.execute ();
if (status != 0)
{
std::cerr << "creating embedded Octave interpreter failed!"
<< std::endl;
return status;
}
}
try
{
octave_idx_type n = 20;
octave_value_list in;
in(0) = octave_value(n);
octave_value_list out = octave::feval ("hamming", in, 1);
std::cout << out.length() << "\n";
//Matrix mOut(out(0).matrix_value());
//return mOut;
//return out.length();
/*Matrix mOut(out(0).matrix_value());
std::cout << mOut << "\n";
ColumnVector vals(3);
vals(0) = 1;
vals(1) = 2;
vals(2) = 3;
octave_value_list f_arg, f_ret;
f_arg(0) = octave_value(vals);
f_arg(1) = octave_value(vals);
octave::feval ("pkg", ovl ("load", "signal"), 0);
f_ret = octave::feval("xcorr", f_arg, 1);
Matrix unis(f_ret(0).matrix_value());
std::cout << unis << "\n";
*/
}
catch (const octave::exit_exception& ex)
{
std::cerr << "Octave interpreter exited with status = "
<< ex.exit_status () << std::endl;
}
catch (const octave::execution_exception&)
{
std::cerr << "error encountered in Octave evaluator!" << std::endl;
}
//clean_up_and_exit (0);
return 0;
}