Input
test.par
% Test parameter file
N = 150
my_text = "Hello"
pi_val=3.14151926
%un_def = 1
x = [0.25 ,0.5 ,0.25]
y = [0.25+0.1i ;0.5-1i ;0.25+0.3i]
A = [1,2,3;4,5,6;7,8,9;10, 11 ,12]
B = [0+1j,2-3i,3;4,5i,6+1i;7,8i,9;10, 11+3i ,12]
Output
SigPack: Parameter Z not found!
Setting default
1
2
3
4
my_text= Hello
N= 150
pi_val= 3.14152
x=
0.2500 0.5000 0.2500
y=
(+2.500e-01,+1.000e-01)
(+5.000e-01,-1.000e+00)
(+2.500e-01,+3.000e-01)
A=
1.0000 2.0000 3.0000
4.0000 5.0000 6.0000
7.0000 8.0000 9.0000
10.0000 11.0000 12.0000
B=
(+0.000e+00,+1.000e+00) (+2.000e+00,-3.000e+00)
(+3.000e+00,+0.000e+00)
(+4.000e+00,+0.000e+00) (+0.000e+00,+5.000e+00)
(+6.000e+00,+1.000e+00)
(+7.000e+00,+0.000e+00) (+0.000e+00,+8.000e+00)
(+9.000e+00,+0.000e+00)
(+1.000e+01,+0.000e+00) (+1.100e+01,+3.000e+00)
(+1.200e+01,+0.000e+00)
Z=
1
2
3
4
Source
{
rowvec def_vec = randu<rowvec>(10);
cx_vec def_vec_cx = randu<cx_vec>(10);
mat def_mat = randu<mat>(5, 5);
cx_mat def_matx = randu<cx_mat>(5, 5);
Col<int> def_vec_int;
def_vec_int << 1 << 2 << 3 << 4;
rowvec x = testpar.
getRow(
"x", def_vec);
cx_vec y = testpar.
getCxCol(
"y", def_vec_cx);
mat A = testpar.
getMat(
"A", def_mat);
cx_mat B = testpar.
getCxMat(
"B", def_matx);
std::string my_text = testpar.
getString(
"my_text",
"DEFAULT");
int N = testpar.
getParam<
int>(
"N", 125000);
double pi_val = testpar.
getParam<
double>(
"pi_val", 3.1);
Col<int> Z = testpar.
getCol(
"Z", def_vec_int);
std::cout << "my_text= " << my_text << std::endl;
std::cout << "N= " << N << std::endl;
std::cout << "pi_val= " << pi_val << std::endl;
std::cout << "x= \n" << x << std::endl;
std::cout << "y= \n" << y << std::endl;
std::cout << "A= \n" << A << std::endl;
std::cout << "B= \n" << B << std::endl;
std::cout << "Z= \n" << Z << std::endl;
return 0;
}