Go to the source code of this file.
Definition at line 221 of file test_array.cxx.
void test_division_complex(ExecMon &em)
void test_division(ExecMon &em)
void test_copy(ExecMon &em)
void test_return(ExecMon &em)
void test_dft(ExecMon &em)
void test_deconv(ExecMon &em)
void test_partial(ExecMon &em)
std::string summary() const
Return summary up to now.
QTextStream & endl(QTextStream &s)
Definition at line 12 of file test_array.cxx.
15 ss <<
"array(" <<
nrows <<
"," << ncols<<
")";
16 em(ss.str() +
": constructing");
18 em(ss.str() +
": constructed");
unsigned nrows(sqlite3 *db, std::string const &tablename)
Eigen::ArrayXXf array_xxf
A real, 2D array.
template<typename arrtype >
bool same |
( |
const arrtype & |
a1, |
|
|
const arrtype & |
a2, |
|
|
double |
eps = 1.0e-6 |
|
) |
| |
Definition at line 61 of file test_array.cxx.
63 double n1 =
a1.matrix().squaredNorm();
64 double n2 =
a2.matrix().squaredNorm();
69 cerr <<
"norm2=0, norm1=" << n2 <<
endl;
74 cerr <<
"differ: " << diff <<
" n1=" << n1 <<
" n2=" << n2 <<
endl;
QTextStream & endl(QTextStream &s)
Definition at line 28 of file test_array.cxx.
30 const int nrows = 3000;
31 const int ncols = 10000;
34 em(
"array by value: returned");
37 for (
int ind=0; ind<100; ++ind) {
40 em(
"array by value: 100 dups");
43 em(
"array by value: left scope");
array_xxf dup(const array_xxf &arr)
array_xxf my_great_array(ExecMon &em, int nrows, int ncols)
unsigned nrows(sqlite3 *db, std::string const &tablename)
Eigen::ArrayXXf array_xxf
A real, 2D array.
Definition at line 142 of file test_array.cxx.
144 const int nrows = 300;
145 const int ncols = 1000;
149 em(
"deconv: got array");
151 em(
"deconv: got filter");
152 auto deco =
deconv(arr, filt);
158 double norm = diff.matrix().norm();
160 cerr <<
"got norm of diff " << norm <<
endl;
Eigen::ArrayXXcf array_xxc
A complex, 2D array.
array_xxf deconv(const array_xxf &arr, const array_xxc &filter)
auto norm(Vector const &v)
Return norm of the specified vector.
array_xxf my_great_array(ExecMon &em, int nrows, int ncols)
unsigned nrows(sqlite3 *db, std::string const &tablename)
QTextStream & endl(QTextStream &s)
Eigen::ArrayXXf array_xxf
A real, 2D array.
Definition at line 117 of file test_array.cxx.
119 const int nrows = 300;
120 const int ncols = 1000;
122 const int nrounds = 100;
125 em(
"dft: make array");
126 for (
int count = 0; count < nrounds; ++count) {
128 auto spec =
dft(arr);
129 auto orig =
idft(spec);
132 em(
"dft with floats");
133 #ifdef WCT_HACK_FOR_FFTW_NO_SP 134 for (
int count = 0; count < nrounds; ++count) {
135 auto spec = dftd(arr);
136 auto orig = idftd(spec);
138 em(
"dft up/down cast through doubles");
array_xxf my_great_array(ExecMon &em, int nrows, int ncols)
array_xxf idft(const array_xxc &arr)
unsigned nrows(sqlite3 *db, std::string const &tablename)
array_xxc dft(const array_xxf &arr)
Definition at line 164 of file test_array.cxx.
166 array_xxf arr1(3,2), arr2(3,2), arr3(3,2);
176 cerr <<
"arr3 before NaN zeroing\n" << arr3 <<
endl;
178 for (
int irow=0; irow<arr3.rows(); ++irow) {
179 for (
int icol=0; icol<arr3.cols(); ++icol) {
180 float val = arr3(irow,icol);
182 arr3(irow,icol) = -0.0;
185 arr3(irow,icol) = 0.0;
189 cerr <<
"arr3 after NaN zeroing\n" << arr3 <<
endl;
QTextStream & endl(QTextStream &s)
Eigen::ArrayXXf array_xxf
A real, 2D array.
void test_division_complex |
( |
ExecMon & |
em | ) |
|
Definition at line 193 of file test_array.cxx.
195 array_xxc arr1(3,2), arr2(3,2), arr3(3,2);
205 cerr <<
"arr3 before NaN zeroing\n" << arr3 <<
endl;
207 for (
int irow=0; irow<arr3.rows(); ++irow) {
208 for (
int icol=0; icol<arr3.cols(); ++icol) {
209 float val =
abs(arr3(irow,icol));
211 arr3(irow,icol) = -0.0;
214 arr3(irow,icol) = 0.0;
218 cerr <<
"arr3 after NaN zeroing\n" << arr3 <<
endl;
Eigen::ArrayXXcf array_xxc
A complex, 2D array.
QTextStream & endl(QTextStream &s)
Definition at line 79 of file test_array.cxx.
81 const int nrows = 300;
82 const int ncols = 1000;
85 em(
"test_partial: make array");
88 auto spec_rc =
dft_rc(arr);
89 auto spec_cc =
dft_cc(spec_rc);
90 em(
"test_partial: forward");
92 auto arr2 =
idft(spec);
93 auto arr2_cc =
idft_cc(spec_cc);
94 auto arr2_cr =
idft_cr(arr2_cc);
95 em(
"test_partial: reverse");
101 const int nrounds = 100;
103 for (
int count = 0; count < nrounds; ++count) {
104 auto spec =
dft(arr);
105 auto orig =
idft(spec);
107 em(
"test_partial: direct round trip");
108 for (
int count = 0; count < nrounds; ++count) {
109 auto spec_rc =
dft_rc(arr);
110 auto spec_cc =
dft_cc(spec_rc);
111 auto arr2_cc =
idft_cc(spec_cc);
112 auto arr2_cr =
idft_cr(arr2_cc);
114 em(
"test_partial: partial round trip");
array_xxc dft_cc(const array_xxc &arr, int dim=1)
array_xxf idft_cr(const array_xxc &arr, int dim=0)
array_xxc dft_rc(const array_xxf &arr, int dim=0)
array_xxc idft_cc(const array_xxc &arr, int dim=1)
bool same(const arrtype &a1, const arrtype &a2, double eps=1.0e-6)
array_xxf my_great_array(ExecMon &em, int nrows, int ncols)
array_xxf idft(const array_xxc &arr)
unsigned nrows(sqlite3 *db, std::string const &tablename)
array_xxc dft(const array_xxf &arr)
Definition at line 46 of file test_array.cxx.
48 const int nrows = 3000;
49 const int ncols = 10000;
55 em(
"ret: out of scope");
array_xxf my_great_array(ExecMon &em, int nrows, int ncols)
unsigned nrows(sqlite3 *db, std::string const &tablename)