ARTS
2.3.1285(git:92a29ea9-dirty)
|
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include "array.h"
#include "describe.h"
#include "exceptions.h"
#include "logic.h"
#include "math_funcs.h"
#include "matpackII.h"
#include "matpackVII.h"
#include "mystring.h"
#include "rational.h"
#include "test_utils.h"
#include "time.h"
#include "wigner_functions.h"
Go to the source code of this file.
Macros | |
#define | docheck(fn, val, expect) |
Functions | |
Numeric | by_reference (const Numeric &x) |
Numeric | by_value (Numeric x) |
void | fill_with_junk (VectorView x) |
void | fill_with_junk (MatrixView x) |
int | test1 () |
void | test2 () |
void | test4 () |
void | test5 () |
void | test6 () |
void | test7 () |
void | test8 () |
void | test9 () |
void | test10 () |
void | test11 () |
void | test12 () |
void | test13 () |
void | test14 () |
void | test15 () |
void | test17 () |
void | test18 () |
void | test19 () |
void | test20 () |
void | test21 () |
void | test22 () |
void | test23 () |
void | test24 () |
void | test25 () |
void | test26 () |
void | test27 () |
void | test28 () |
void | test29 () |
void | test30 () |
void | test31 () |
void | test32 () |
void | test33 () |
void | junk4 (Tensor4View a) |
void | junk2 (ConstVectorView a) |
void | test34 () |
void | test35 () |
void | test36 () |
void | test37 (const Index &i) |
void | test38 () |
void | test39 () |
void | test40 () |
void | test41 () |
void | test42 () |
constexpr Rational | test_numeric2rational (const Index i, const Index maxi, const Rational r=0_rat, const Rational n2r=0_rat) |
void | test43 () |
void | test44 () |
void | test46 () |
bool | test_diagonal (Index ntests) |
Test diagonal vector. More... | |
Numeric | matrix_vector_mult (Index m, Index n, Index ntests, bool verbose) |
Numeric | test_matrix_vector_multiplication (bool verbose) |
Numeric | matrix_mult (Index k, Index m, Index n, Index ntests, Index nsubtests, bool verbose) |
Perform matrix multiplication test. More... | |
Numeric | test_matrix_multiplication (bool verbose) |
Perform matrix multiplication tests. More... | |
void | test_empty () |
Check if the empty function is working correctly. More... | |
void | nlinspace (Vector &x, const Numeric start, const Numeric stop, const Index n) |
nlinspace More... | |
void | test47 () |
int | main () |
#define docheck | ( | fn, | |
val, | |||
expect | |||
) |
Referenced by test44().
Definition at line 39 of file test_matpack.cc.
Referenced by test21().
Definition at line 41 of file test_matpack.cc.
Referenced by test22().
void fill_with_junk | ( | VectorView | x | ) |
Definition at line 43 of file test_matpack.cc.
Referenced by test1().
void fill_with_junk | ( | MatrixView | x | ) |
Definition at line 45 of file test_matpack.cc.
void junk2 | ( | ConstVectorView | a | ) |
void junk4 | ( | Tensor4View | a | ) |
int main | ( | void | ) |
Definition at line 1361 of file test_matpack.cc.
References test43().
Perform matrix multiplication test.
Creates to random m times k matrix A and a random k times n matrix B and computes C = A * B, C = A^T * B, C = A * B^T, C = A^T * B^T unsing the mult function from matpackI.cc. The result is verified using the mult_general functions. In addition to the operations above, ntests numbers of random submatrices of A and B are generated and their multiplication is also tested. Returns the maximum element-wise, relative error that occurred in the tests.
[in] | k | Dimension over which the multiplication is performed. |
[in] | m | Number of rows of A. |
[in] | n | Number of coluns of B. |
[in] | ntests | Number of standard multiplications to be performed. |
[in] | nsubtests | Number of submatrix multiplications to be performed. |
[in] | bool | If verbose is true the results of each test are printed to standard out. |
Definition at line 1058 of file test_matpack.cc.
Referenced by test_matrix_multiplication().
Definition at line 894 of file test_matpack.cc.
References get_maximum_error(), i, joker, mult(), mult_general(), random_fill_matrix(), random_fill_vector(), and transpose().
Referenced by test_matrix_vector_multiplication().
nlinspace
Linearly spaced vector with specified length.
Returns a vector equally and linearly spaced between start and stop of length n. (equals the Matlab function linspace)
The length must be > 1.
x | Output: linearly spaced vector |
start | first value in x |
stop | last value of x <= stop |
n | length of x |
Definition at line 1332 of file test_matpack.cc.
References i, Vector::resize(), and Zeeman::start().
Referenced by test46().
int test1 | ( | ) |
Definition at line 47 of file test_matpack.cc.
References VectorView::begin(), C, fill_with_junk(), i, joker, M, n, ConstMatrixView::ncols(), ConstVectorView::nelem(), ConstMatrixView::nrows(), Vector::resize(), transpose(), v2, and v3.
Referenced by hartmann_tran_lineshape().
void test10 | ( | ) |
Definition at line 228 of file test_matpack.cc.
References M.
void test11 | ( | ) |
Definition at line 238 of file test_matpack.cc.
References M, and ConstVectorView::nelem().
void test12 | ( | ) |
Definition at line 249 of file test_matpack.cc.
References Array< base >::nelem().
void test13 | ( | ) |
Definition at line 266 of file test_matpack.cc.
References M.
void test14 | ( | ) |
Definition at line 276 of file test_matpack.cc.
void test15 | ( | ) |
Definition at line 286 of file test_matpack.cc.
void test17 | ( | ) |
Definition at line 308 of file test_matpack.cc.
References ConstVectorView::sum().
void test18 | ( | ) |
Definition at line 314 of file test_matpack.cc.
void test19 | ( | ) |
Definition at line 321 of file test_matpack.cc.
void test2 | ( | ) |
Definition at line 129 of file test_matpack.cc.
References ConstVectorView::nelem().
void test20 | ( | ) |
Definition at line 332 of file test_matpack.cc.
void test21 | ( | ) |
Definition at line 338 of file test_matpack.cc.
References by_reference(), and i.
void test22 | ( | ) |
Definition at line 349 of file test_matpack.cc.
References by_value(), and i.
void test23 | ( | ) |
Definition at line 360 of file test_matpack.cc.
void test24 | ( | ) |
Definition at line 368 of file test_matpack.cc.
void test25 | ( | ) |
Definition at line 382 of file test_matpack.cc.
void test26 | ( | ) |
Definition at line 388 of file test_matpack.cc.
void test27 | ( | ) |
Definition at line 394 of file test_matpack.cc.
void test28 | ( | ) |
Definition at line 402 of file test_matpack.cc.
void test29 | ( | ) |
Definition at line 409 of file test_matpack.cc.
References Matrix::resize().
void test30 | ( | ) |
Definition at line 433 of file test_matpack.cc.
References ConstMatrixView::ncols(), ConstMatrixView::nrows(), and Matrix::resize().
void test31 | ( | ) |
Definition at line 454 of file test_matpack.cc.
References i, ConstTensor3View::npages(), and ConstTensor3View::nrows().
void test32 | ( | ) |
Definition at line 518 of file test_matpack.cc.
void test33 | ( | ) |
Definition at line 540 of file test_matpack.cc.
References describe(), and transpose().
void test34 | ( | ) |
Definition at line 605 of file test_matpack.cc.
void test35 | ( | ) |
Definition at line 615 of file test_matpack.cc.
void test36 | ( | ) |
Definition at line 634 of file test_matpack.cc.
References joker.
void test37 | ( | const Index & | i | ) |
Definition at line 642 of file test_matpack.cc.
References v1.
void test38 | ( | ) |
Definition at line 657 of file test_matpack.cc.
References VectorView::get_c_array(), and MatrixView::get_c_array().
void test39 | ( | ) |
Definition at line 682 of file test_matpack.cc.
void test4 | ( | ) |
Definition at line 141 of file test_matpack.cc.
References C, i, joker, mult(), and ConstVectorView::nelem().
void test40 | ( | ) |
Definition at line 694 of file test_matpack.cc.
void test41 | ( | ) |
Definition at line 702 of file test_matpack.cc.
References v1.
void test42 | ( | ) |
Definition at line 724 of file test_matpack.cc.
References joker.
void test43 | ( | ) |
Definition at line 758 of file test_matpack.cc.
References r, and test_numeric2rational().
Referenced by main().
void test44 | ( | ) |
Definition at line 799 of file test_matpack.cc.
References docheck, is_decreasing(), is_increasing(), and is_sorted().
void test46 | ( | ) |
Definition at line 835 of file test_matpack.cc.
References VectorView::begin(), VectorView::end(), n, nlinspace(), and v1.
void test47 | ( | ) |
Definition at line 1343 of file test_matpack.cc.
References joker, ConstMatrixView::ncols(), ConstVectorView::nelem(), and ConstMatrixView::nrows().
void test5 | ( | ) |
Definition at line 167 of file test_matpack.cc.
References M, mult(), and transpose().
void test6 | ( | ) |
Definition at line 186 of file test_matpack.cc.
References i, M, n, and transform().
void test7 | ( | ) |
Definition at line 207 of file test_matpack.cc.
References max, min, ConstVectorView::nelem(), and transform().
void test8 | ( | ) |
Definition at line 214 of file test_matpack.cc.
References i, and ConstVectorView::nelem().
void test9 | ( | ) |
Definition at line 221 of file test_matpack.cc.
References joker.
bool test_diagonal | ( | Index | ntests | ) |
Test diagonal vector.
Generates ntest random (m,n)-matrices and checks if the returned diagonal vector has the same entries as the diagonal. Also test transposed matrices and submatrices of the generated matrix.
[in] | ntests | Number of tests to run. |
Definition at line 854 of file test_matpack.cc.
References ConstMatrixView::diagonal(), i, min, ConstMatrixView::ncols(), ConstMatrixView::nrows(), random_fill_matrix(), and transpose().
void test_empty | ( | ) |
Check if the empty function is working correctly.
Definition at line 1223 of file test_matpack.cc.
References ConstTensor3View::empty(), ConstTensor4View::empty(), ConstTensor5View::empty(), ConstTensor7View::empty(), ConstTensor6View::empty(), ConstVectorView::empty(), ConstMatrixView::empty(), Tensor3::resize(), Tensor4::resize(), Tensor5::resize(), Vector::resize(), Tensor6::resize(), Matrix::resize(), and Tensor7::resize().
Numeric test_matrix_multiplication | ( | bool | verbose | ) |
Perform matrix multiplication tests.
Use matrix_mult function to perform matrix multiplication tests, for different combinations of dimensions including: k = m = n = 0 k = m = n = 1 k = 10, m = n = 1 k = 10, m = 100, n = 10 k = 10, m = 100, n = 100 k = m = n = 100
Definition at line 1181 of file test_matpack.cc.
References matrix_mult().
Numeric test_matrix_vector_multiplication | ( | bool | verbose | ) |
Definition at line 983 of file test_matpack.cc.
References matrix_vector_mult().
constexpr Rational test_numeric2rational | ( | const Index | i, |
const Index | maxi, | ||
const Rational | r = 0_rat , |
||
const Rational | n2r = 0_rat |
||
) |
Definition at line 746 of file test_matpack.cc.
References numeric2rational(), and r.
Referenced by test43().