new feature p-norm
This commit is contained in:
150
ChangeLog
150
ChangeLog
@@ -1,112 +1,158 @@
|
|||||||
|
2017-01-09 16:07
|
||||||
|
|
||||||
|
* [r24] COPYING, ChangeLog, INSTALL, src/matrix.hxx,
|
||||||
|
test/matricxx.cxx:
|
||||||
|
fix bug in sign comparision
|
||||||
|
|
||||||
|
2017-01-08 08:54
|
||||||
|
|
||||||
|
* [r23] bootstrap.sh, debian/changelog.in:
|
||||||
|
rebuilt debian/changelog.in
|
||||||
|
|
||||||
|
2017-01-07 13:31
|
||||||
|
|
||||||
|
* [r22] ChangeLog, ax_init_standard_project.m4, bootstrap.sh,
|
||||||
|
build-in-docker.conf, build-in-docker.sh, debian/control.in,
|
||||||
|
doc/plantuml.jar[ADD], resolve-debbuilddeps.sh,
|
||||||
|
resolve-rpmbuilddeps.sh:
|
||||||
|
build system updated
|
||||||
|
|
||||||
|
2016-09-02 08:44
|
||||||
|
|
||||||
|
* [r21] configure.ac:
|
||||||
|
fixed project url
|
||||||
|
|
||||||
2016-08-28 07:58
|
2016-08-28 07:58
|
||||||
|
|
||||||
* COPYING, ChangeLog, INSTALL, ax_init_standard_project.m4,
|
* [r20] COPYING, ChangeLog, INSTALL, ax_init_standard_project.m4,
|
||||||
bootstrap.sh: documentation fixed
|
bootstrap.sh:
|
||||||
|
documentation fixed
|
||||||
|
|
||||||
2016-08-26 14:10
|
2016-08-26 14:10
|
||||||
|
|
||||||
* COPYING, INSTALL, ax_init_standard_project.m4, bootstrap.sh,
|
* [r19] COPYING, INSTALL, ax_init_standard_project.m4,
|
||||||
doc/doxyfile.in: updated documentation build
|
bootstrap.sh, doc/doxyfile.in:
|
||||||
|
updated documentation build
|
||||||
|
|
||||||
2016-08-25 19:53
|
2016-08-25 19:53
|
||||||
|
|
||||||
* configure.ac, debian/control.in, src/matrix.hxx, test/basic.cxx,
|
* [r18] configure.ac, debian/control.in, src/matrix.hxx,
|
||||||
test/makefile.am, test/matricxx.cxx: documentation updated
|
test/basic.cxx[DEL], test/makefile.am, test/matricxx.cxx[CPY]:
|
||||||
|
documentation updated
|
||||||
|
|
||||||
2016-08-25 18:56
|
2016-08-25 18:56
|
||||||
|
|
||||||
* README, ax_init_standard_project.m4, bootstrap.sh, configure.ac,
|
* [r17] README, ax_init_standard_project.m4, bootstrap.sh,
|
||||||
doc/header.html.in, doc/style.css: documentation anhanced
|
configure.ac, doc/header.html.in, doc/style.css:
|
||||||
|
documentation anhanced
|
||||||
|
|
||||||
2016-08-25 18:02
|
2016-08-25 18:02
|
||||||
|
|
||||||
* COPYING, ChangeLog, INSTALL, README, ax_init_standard_project.m4,
|
* [r16] COPYING, ChangeLog, INSTALL, README,
|
||||||
doc/doxyfile.in, doc/footer.html.in, doc/header.html.in,
|
ax_init_standard_project.m4, doc/doxyfile.in,
|
||||||
doc/style.css, test/matricxx.cxx: documentation anhanced
|
doc/footer.html.in[ADD], doc/header.html.in[ADD],
|
||||||
|
doc/style.css[ADD], test/matricxx.cxx[ADD]:
|
||||||
|
documentation anhanced
|
||||||
|
|
||||||
2016-08-25 15:00
|
2016-08-25 15:00
|
||||||
|
|
||||||
* README, ax_init_standard_project.m4, bootstrap.sh,
|
* [r15] README, ax_init_standard_project.m4, bootstrap.sh,
|
||||||
doc/doxyfile.in, src/matrix.hxx: improved doxygen
|
doc/doxyfile.in, src/matrix.hxx:
|
||||||
|
improved doxygen
|
||||||
|
|
||||||
2016-08-24 09:42
|
2016-08-24 09:42
|
||||||
|
|
||||||
* src/libmatricxx.pc.in: PKG_REQUIREMENTS is undefined
|
* [r14] src/libmatricxx.pc.in:
|
||||||
|
PKG_REQUIREMENTS is undefined
|
||||||
|
|
||||||
2016-08-23 13:58
|
2016-08-23 13:58
|
||||||
|
|
||||||
* debian/control.in, src/makefile.am, src/matrix.hxx,
|
* [r13] debian/control.in, src/makefile.am, src/matrix.hxx,
|
||||||
test/basic.cxx, test/makefile.am: stream any size of matrix
|
test/basic.cxx, test/makefile.am:
|
||||||
|
stream any size of matrix
|
||||||
|
|
||||||
2016-08-23 13:09
|
2016-08-23 13:09
|
||||||
|
|
||||||
* configure.ac, src/matrix.hxx, test/basic.cxx: works perfectly,
|
* [r12] configure.ac, src/matrix.hxx, test/basic.cxx:
|
||||||
fully tested
|
works perfectly, fully tested
|
||||||
|
|
||||||
2016-08-22 15:04
|
2016-08-22 15:04
|
||||||
|
|
||||||
* COPYING, INSTALL, src/matrix.hxx, test/basic.cxx: inverse tested
|
* [r11] COPYING, INSTALL, src/matrix.hxx, test/basic.cxx:
|
||||||
|
inverse tested
|
||||||
|
|
||||||
2016-08-22 07:07
|
2016-08-22 07:07
|
||||||
|
|
||||||
* ChangeLog, src/matrix.hxx, test/basic.cxx: inverse does not work
|
* [r10] ChangeLog, src/matrix.hxx, test/basic.cxx:
|
||||||
yet
|
inverse does not work yet
|
||||||
|
|
||||||
2016-08-19 16:07
|
2016-08-19 16:07
|
||||||
|
|
||||||
* COPYING, ChangeLog, INSTALL, ax_cxx_compile_stdcxx_11.m4,
|
* [r9] COPYING, ChangeLog, INSTALL, ax_cxx_compile_stdcxx_11.m4,
|
||||||
ax_init_standard_project.m4, makefile_test.inc.am: fix C++11
|
ax_init_standard_project.m4, makefile_test.inc.am:
|
||||||
detection
|
fix C++11 detection
|
||||||
|
|
||||||
2016-08-19 14:52
|
2016-08-19 14:52
|
||||||
|
|
||||||
* COPYING, INSTALL, ax_cxx_compile_stdcxx_11.m4,
|
* [r8] COPYING, INSTALL, ax_cxx_compile_stdcxx_11.m4,
|
||||||
ax_init_standard_project.m4, bootstrap.sh, makefile_test.inc.am,
|
ax_init_standard_project.m4, bootstrap.sh,
|
||||||
src/matrix.hxx, test/basic.cxx: more operators more tests
|
makefile_test.inc.am[ADD], src/matrix.hxx, test/basic.cxx:
|
||||||
|
more operators more tests
|
||||||
|
|
||||||
2016-08-18 22:03
|
2016-08-18 22:03
|
||||||
|
|
||||||
* COPYING, ChangeLog, INSTALL, src/matrix.hxx: more operators
|
* [r7] COPYING, ChangeLog, INSTALL, src/matrix.hxx:
|
||||||
|
more operators
|
||||||
|
|
||||||
2016-08-17 07:26
|
2016-08-17 07:26
|
||||||
|
|
||||||
* configure.ac: only requires c++11
|
* [r6] configure.ac:
|
||||||
|
only requires c++11
|
||||||
|
|
||||||
2016-08-16 14:41
|
2016-08-16 14:41
|
||||||
|
|
||||||
* COPYING, INSTALL, ax_init_standard_project.m4, configure.ac,
|
* [r5] COPYING, INSTALL, ax_init_standard_project.m4, configure.ac,
|
||||||
src/matrix.hxx, test/basic.cxx: remove redundancy, collect common
|
src/matrix.hxx, test/basic.cxx:
|
||||||
functionality in base class
|
remove redundancy, collect common functionality in base class
|
||||||
|
|
||||||
2016-08-08 20:03
|
2016-08-08 20:03
|
||||||
|
|
||||||
* src/matrix.hxx, test/basic.cxx: more operator, more checks passed
|
* [r4] src/matrix.hxx, test/basic.cxx:
|
||||||
|
more operator, more checks passed
|
||||||
|
|
||||||
2016-08-03 18:43
|
2016-08-03 18:43
|
||||||
|
|
||||||
* configure.ac, test/makefile.am: all tests passed
|
* [r3] configure.ac, test/makefile.am:
|
||||||
|
all tests passed
|
||||||
|
|
||||||
2016-08-03 18:39
|
2016-08-03 18:39
|
||||||
|
|
||||||
* COPYING, ChangeLog, INSTALL, ax_cxx_compile_stdcxx_11.m4,
|
* [r2] COPYING[ADD], ChangeLog, INSTALL[ADD],
|
||||||
ax_init_standard_project.m4, configure.ac, examples/makefile.am,
|
ax_cxx_compile_stdcxx_11.m4, ax_init_standard_project.m4,
|
||||||
examples/matrix-sample.cxx, src/makefile.am, src/matrix.hxx,
|
configure.ac, examples/makefile.am,
|
||||||
test/basic.cxx, test/makefile.am: first approach including first
|
examples/matrix-sample.cxx[ADD], src/makefile.am,
|
||||||
tests
|
src/matrix.hxx[ADD], test/basic.cxx[ADD], test/makefile.am:
|
||||||
|
first approach including first tests
|
||||||
|
|
||||||
2016-07-30 08:50
|
2016-07-30 08:50
|
||||||
|
|
||||||
* ., AUTHORS, ChangeLog, NEWS, README, autogen.sh, ax_check_qt.m4,
|
* [r1] .[ADD], AUTHORS[ADD], ChangeLog[ADD], NEWS[ADD],
|
||||||
ax_cxx_compile_stdcxx_11.m4, ax_init_standard_project.m4,
|
README[ADD], autogen.sh[ADD], ax_check_qt.m4[ADD],
|
||||||
bootstrap.sh, build-in-docker.conf, build-in-docker.sh,
|
ax_cxx_compile_stdcxx_11.m4[ADD],
|
||||||
build-resource-file.sh, configure.ac, debian,
|
ax_init_standard_project.m4[ADD], bootstrap.sh[ADD],
|
||||||
debian/changelog.in, debian/compat, debian/control.in,
|
build-in-docker.conf[ADD], build-in-docker.sh[ADD],
|
||||||
debian/docs, debian/libmatricxx-dev.install,
|
build-resource-file.sh[ADD], configure.ac[ADD], debian[ADD],
|
||||||
debian/libmatricxx.install, debian/rules, doc, doc/doxyfile.in,
|
debian/changelog.in[ADD], debian/compat[ADD],
|
||||||
doc/makefile.am, examples, examples/makefile.am,
|
debian/control.in[ADD], debian/docs[ADD],
|
||||||
libmatricxx.desktop.in, libmatricxx.spec.in,
|
debian/libmatricxx-dev.install[ADD],
|
||||||
mac-create-app-bundle.sh, makefile.am, resolve-debbuilddeps.sh,
|
debian/libmatricxx.install[ADD], debian/rules[ADD], doc[ADD],
|
||||||
resolve-rpmbuilddeps.sh, sql-to-dot.sed, src,
|
doc/doxyfile.in[ADD], doc/makefile.am[ADD], examples[ADD],
|
||||||
src/libmatricxx.pc.in, src/makefile.am, src/version.cxx,
|
examples/makefile.am[ADD], libmatricxx.desktop.in[ADD],
|
||||||
src/version.hxx, test, test/makefile.am: initial project
|
libmatricxx.spec.in[ADD], mac-create-app-bundle.sh[ADD],
|
||||||
|
makefile.am[ADD], resolve-debbuilddeps.sh[ADD],
|
||||||
|
resolve-rpmbuilddeps.sh[ADD], sql-to-dot.sed[ADD], src[ADD],
|
||||||
|
src/libmatricxx.pc.in[ADD], src/makefile.am[ADD],
|
||||||
|
src/version.cxx[ADD], src/version.hxx[ADD], test[ADD],
|
||||||
|
test/makefile.am[ADD]:
|
||||||
|
initial project
|
||||||
|
|
||||||
|
@@ -282,6 +282,26 @@ template<typename TYPE, typename ARRAY=TYPE*> class MatrixBase {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Matrix P-Norm
|
||||||
|
/** Matrix p-norm is defined as:
|
||||||
|
|
||||||
|
@f[
|
||||||
|
\Vert A \Vert_p = \left( \sum_{i=1}^m \sum_{j=1}^n |a_{ij}|^p \right)^{1/p}
|
||||||
|
@f]
|
||||||
|
|
||||||
|
For a vector, norm(2) is equal to the length of the vector.
|
||||||
|
|
||||||
|
@see https://en.wikipedia.org/wiki/Matrix_norm */
|
||||||
|
long double norm(long double p=2) const {
|
||||||
|
long double res(0);
|
||||||
|
for (const TYPE *v((const TYPE*)(_c)+SIZE); v>(const TYPE*)(_c);) {
|
||||||
|
std::cout<<"res="<<res<<"; value="<<*--v<<std::endl;
|
||||||
|
res += pow(abs(*v), p);
|
||||||
|
}
|
||||||
|
std::cout<<"Result: res="<<res<<" → "<<pow(res, 1/p)<<std::endl;
|
||||||
|
return pow(res, 1/p);
|
||||||
|
}
|
||||||
|
|
||||||
/// Calculate Determinant Of The Matrix
|
/// Calculate Determinant Of The Matrix
|
||||||
/** The Matrix is replaced by it's gaussian representation. */
|
/** The Matrix is replaced by it's gaussian representation. */
|
||||||
TYPE det() {
|
TYPE det() {
|
||||||
|
@@ -199,6 +199,21 @@ class TemplateMatrixTest: public CppUnit::TestFixture {
|
|||||||
Matrix<T,3,3> o(m);
|
Matrix<T,3,3> o(m);
|
||||||
CPPUNIT_ASSERT_EQUAL((T)3*o, m.apply([](T& t){t*=3;}));
|
CPPUNIT_ASSERT_EQUAL((T)3*o, m.apply([](T& t){t*=3;}));
|
||||||
}
|
}
|
||||||
|
template<typename T>
|
||||||
|
void norm() {
|
||||||
|
Matrix<T,3,3> m1(1, -1, 1,
|
||||||
|
-1, 1, -1,
|
||||||
|
1, 1, -1);
|
||||||
|
Matrix<T,3,3> m2(-1, 3, 2,
|
||||||
|
-2, 0, -3,
|
||||||
|
2, 1, -2);
|
||||||
|
Matrix<T,3,3> m3(0, 3, 0,
|
||||||
|
-1, 0, 2,
|
||||||
|
0, -3, 1);
|
||||||
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, m1.norm(), 0.00001);
|
||||||
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(6.0, m2.norm(), 0.00001);
|
||||||
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(4.0, m3.norm(3), 0.00001);
|
||||||
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void gauss() {
|
void gauss() {
|
||||||
Matrix<T,3,3> m(2, -2, 4,
|
Matrix<T,3,3> m(2, -2, 4,
|
||||||
@@ -332,92 +347,113 @@ class TemplateMatrixTest: public CppUnit::TestFixture {
|
|||||||
CPPUNIT_TEST(initFromArray1<unsigned long>);
|
CPPUNIT_TEST(initFromArray1<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromArray1<float>);
|
CPPUNIT_TEST(initFromArray1<float>);
|
||||||
CPPUNIT_TEST(initFromArray1<double>);
|
CPPUNIT_TEST(initFromArray1<double>);
|
||||||
|
CPPUNIT_TEST(initFromArray1<long double>);
|
||||||
CPPUNIT_TEST(initFromArray2<int>);
|
CPPUNIT_TEST(initFromArray2<int>);
|
||||||
CPPUNIT_TEST(initFromArray2<long>);
|
CPPUNIT_TEST(initFromArray2<long>);
|
||||||
CPPUNIT_TEST(initFromArray2<unsigned>);
|
CPPUNIT_TEST(initFromArray2<unsigned>);
|
||||||
CPPUNIT_TEST(initFromArray2<unsigned long>);
|
CPPUNIT_TEST(initFromArray2<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromArray2<float>);
|
CPPUNIT_TEST(initFromArray2<float>);
|
||||||
CPPUNIT_TEST(initFromArray2<double>);
|
CPPUNIT_TEST(initFromArray2<double>);
|
||||||
|
CPPUNIT_TEST(initFromArray2<long double>);
|
||||||
CPPUNIT_TEST(initFromArray3<int>);
|
CPPUNIT_TEST(initFromArray3<int>);
|
||||||
CPPUNIT_TEST(initFromArray3<long>);
|
CPPUNIT_TEST(initFromArray3<long>);
|
||||||
CPPUNIT_TEST(initFromArray3<unsigned>);
|
CPPUNIT_TEST(initFromArray3<unsigned>);
|
||||||
CPPUNIT_TEST(initFromArray3<unsigned long>);
|
CPPUNIT_TEST(initFromArray3<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromArray3<float>);
|
CPPUNIT_TEST(initFromArray3<float>);
|
||||||
CPPUNIT_TEST(initFromArray3<double>);
|
CPPUNIT_TEST(initFromArray3<double>);
|
||||||
|
CPPUNIT_TEST(initFromArray3<long double>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<int>);
|
CPPUNIT_TEST(initFromOtherMatrix<int>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<long>);
|
CPPUNIT_TEST(initFromOtherMatrix<long>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<unsigned>);
|
CPPUNIT_TEST(initFromOtherMatrix<unsigned>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<unsigned long>);
|
CPPUNIT_TEST(initFromOtherMatrix<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<float>);
|
CPPUNIT_TEST(initFromOtherMatrix<float>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<double>);
|
CPPUNIT_TEST(initFromOtherMatrix<double>);
|
||||||
|
CPPUNIT_TEST(initFromOtherMatrix<long double>);
|
||||||
CPPUNIT_TEST(access<int>);
|
CPPUNIT_TEST(access<int>);
|
||||||
CPPUNIT_TEST(access<long>);
|
CPPUNIT_TEST(access<long>);
|
||||||
CPPUNIT_TEST(access<unsigned>);
|
CPPUNIT_TEST(access<unsigned>);
|
||||||
CPPUNIT_TEST(access<unsigned long>);
|
CPPUNIT_TEST(access<unsigned long>);
|
||||||
CPPUNIT_TEST(access<float>);
|
CPPUNIT_TEST(access<float>);
|
||||||
CPPUNIT_TEST(access<double>);
|
CPPUNIT_TEST(access<double>);
|
||||||
|
CPPUNIT_TEST(access<long double>);
|
||||||
CPPUNIT_TEST(equality<int>);
|
CPPUNIT_TEST(equality<int>);
|
||||||
CPPUNIT_TEST(equality<long>);
|
CPPUNIT_TEST(equality<long>);
|
||||||
CPPUNIT_TEST(equality<unsigned>);
|
CPPUNIT_TEST(equality<unsigned>);
|
||||||
CPPUNIT_TEST(equality<unsigned long>);
|
CPPUNIT_TEST(equality<unsigned long>);
|
||||||
CPPUNIT_TEST(equality<float>);
|
CPPUNIT_TEST(equality<float>);
|
||||||
CPPUNIT_TEST(equality<double>);
|
CPPUNIT_TEST(equality<double>);
|
||||||
|
CPPUNIT_TEST(equality<long double>);
|
||||||
CPPUNIT_TEST(operator_plus<int>);
|
CPPUNIT_TEST(operator_plus<int>);
|
||||||
CPPUNIT_TEST(operator_plus<long>);
|
CPPUNIT_TEST(operator_plus<long>);
|
||||||
CPPUNIT_TEST(operator_plus<unsigned>);
|
CPPUNIT_TEST(operator_plus<unsigned>);
|
||||||
CPPUNIT_TEST(operator_plus<unsigned long>);
|
CPPUNIT_TEST(operator_plus<unsigned long>);
|
||||||
CPPUNIT_TEST(operator_plus<float>);
|
CPPUNIT_TEST(operator_plus<float>);
|
||||||
CPPUNIT_TEST(operator_plus<double>);
|
CPPUNIT_TEST(operator_plus<double>);
|
||||||
|
CPPUNIT_TEST(operator_plus<long double>);
|
||||||
CPPUNIT_TEST(operator_minus<int>);
|
CPPUNIT_TEST(operator_minus<int>);
|
||||||
CPPUNIT_TEST(operator_minus<long>);
|
CPPUNIT_TEST(operator_minus<long>);
|
||||||
CPPUNIT_TEST(operator_minus<unsigned>);
|
CPPUNIT_TEST(operator_minus<unsigned>);
|
||||||
CPPUNIT_TEST(operator_minus<unsigned long>);
|
CPPUNIT_TEST(operator_minus<unsigned long>);
|
||||||
CPPUNIT_TEST(operator_minus<float>);
|
CPPUNIT_TEST(operator_minus<float>);
|
||||||
CPPUNIT_TEST(operator_minus<double>);
|
CPPUNIT_TEST(operator_minus<double>);
|
||||||
|
CPPUNIT_TEST(operator_minus<long double>);
|
||||||
CPPUNIT_TEST(scalar_mult<int>);
|
CPPUNIT_TEST(scalar_mult<int>);
|
||||||
CPPUNIT_TEST(scalar_mult<long>);
|
CPPUNIT_TEST(scalar_mult<long>);
|
||||||
CPPUNIT_TEST(scalar_mult<unsigned>);
|
CPPUNIT_TEST(scalar_mult<unsigned>);
|
||||||
CPPUNIT_TEST(scalar_mult<unsigned long>);
|
CPPUNIT_TEST(scalar_mult<unsigned long>);
|
||||||
CPPUNIT_TEST(scalar_mult<float>);
|
CPPUNIT_TEST(scalar_mult<float>);
|
||||||
CPPUNIT_TEST(scalar_mult<double>);
|
CPPUNIT_TEST(scalar_mult<double>);
|
||||||
|
CPPUNIT_TEST(scalar_mult<long double>);
|
||||||
CPPUNIT_TEST(scalar_div<int>);
|
CPPUNIT_TEST(scalar_div<int>);
|
||||||
CPPUNIT_TEST(scalar_div<long>);
|
CPPUNIT_TEST(scalar_div<long>);
|
||||||
CPPUNIT_TEST(scalar_div<unsigned>);
|
CPPUNIT_TEST(scalar_div<unsigned>);
|
||||||
CPPUNIT_TEST(scalar_div<unsigned long>);
|
CPPUNIT_TEST(scalar_div<unsigned long>);
|
||||||
CPPUNIT_TEST(scalar_div<float>);
|
CPPUNIT_TEST(scalar_div<float>);
|
||||||
CPPUNIT_TEST(scalar_div<double>);
|
CPPUNIT_TEST(scalar_div<double>);
|
||||||
|
CPPUNIT_TEST(scalar_div<long double>);
|
||||||
CPPUNIT_TEST(matrix_mult<int>);
|
CPPUNIT_TEST(matrix_mult<int>);
|
||||||
CPPUNIT_TEST(matrix_mult<long>);
|
CPPUNIT_TEST(matrix_mult<long>);
|
||||||
CPPUNIT_TEST(matrix_mult<unsigned>);
|
CPPUNIT_TEST(matrix_mult<unsigned>);
|
||||||
CPPUNIT_TEST(matrix_mult<unsigned long>);
|
CPPUNIT_TEST(matrix_mult<unsigned long>);
|
||||||
CPPUNIT_TEST(matrix_mult<float>);
|
CPPUNIT_TEST(matrix_mult<float>);
|
||||||
CPPUNIT_TEST(matrix_mult<double>);
|
CPPUNIT_TEST(matrix_mult<double>);
|
||||||
|
CPPUNIT_TEST(matrix_mult<long double>);
|
||||||
CPPUNIT_TEST(transpose<int>);
|
CPPUNIT_TEST(transpose<int>);
|
||||||
CPPUNIT_TEST(transpose<long>);
|
CPPUNIT_TEST(transpose<long>);
|
||||||
CPPUNIT_TEST(transpose<unsigned>);
|
CPPUNIT_TEST(transpose<unsigned>);
|
||||||
CPPUNIT_TEST(transpose<unsigned long>);
|
CPPUNIT_TEST(transpose<unsigned long>);
|
||||||
CPPUNIT_TEST(transpose<float>);
|
CPPUNIT_TEST(transpose<float>);
|
||||||
CPPUNIT_TEST(transpose<double>);
|
CPPUNIT_TEST(transpose<double>);
|
||||||
|
CPPUNIT_TEST(transpose<long double>);
|
||||||
CPPUNIT_TEST(apply<int>);
|
CPPUNIT_TEST(apply<int>);
|
||||||
CPPUNIT_TEST(apply<long>);
|
CPPUNIT_TEST(apply<long>);
|
||||||
CPPUNIT_TEST(apply<unsigned>);
|
CPPUNIT_TEST(apply<unsigned>);
|
||||||
CPPUNIT_TEST(apply<unsigned long>);
|
CPPUNIT_TEST(apply<unsigned long>);
|
||||||
CPPUNIT_TEST(apply<float>);
|
CPPUNIT_TEST(apply<float>);
|
||||||
CPPUNIT_TEST(apply<double>);
|
CPPUNIT_TEST(apply<double>);
|
||||||
|
CPPUNIT_TEST(apply<long double>);
|
||||||
|
CPPUNIT_TEST(norm<int>);
|
||||||
|
CPPUNIT_TEST(norm<long>);
|
||||||
|
CPPUNIT_TEST(norm<float>);
|
||||||
|
CPPUNIT_TEST(norm<double>);
|
||||||
|
CPPUNIT_TEST(norm<long double>);
|
||||||
CPPUNIT_TEST(gauss<int>);
|
CPPUNIT_TEST(gauss<int>);
|
||||||
CPPUNIT_TEST(gauss<long>);
|
CPPUNIT_TEST(gauss<long>);
|
||||||
CPPUNIT_TEST(gauss<float>);
|
CPPUNIT_TEST(gauss<float>);
|
||||||
CPPUNIT_TEST(gauss<double>);
|
CPPUNIT_TEST(gauss<double>);
|
||||||
|
CPPUNIT_TEST(gauss<long double>);
|
||||||
CPPUNIT_TEST(det<int>);
|
CPPUNIT_TEST(det<int>);
|
||||||
CPPUNIT_TEST(det<long>);
|
CPPUNIT_TEST(det<long>);
|
||||||
CPPUNIT_TEST(det<float>);
|
CPPUNIT_TEST(det<float>);
|
||||||
CPPUNIT_TEST(det<double>);
|
CPPUNIT_TEST(det<double>);
|
||||||
|
CPPUNIT_TEST(det<long double>);
|
||||||
CPPUNIT_TEST(i<int>);
|
CPPUNIT_TEST(i<int>);
|
||||||
CPPUNIT_TEST(i<long>);
|
CPPUNIT_TEST(i<long>);
|
||||||
CPPUNIT_TEST(i<unsigned>);
|
CPPUNIT_TEST(i<unsigned>);
|
||||||
CPPUNIT_TEST(i<unsigned long>);
|
CPPUNIT_TEST(i<unsigned long>);
|
||||||
CPPUNIT_TEST(i<float>);
|
CPPUNIT_TEST(i<float>);
|
||||||
CPPUNIT_TEST(i<double>);
|
CPPUNIT_TEST(i<double>);
|
||||||
|
CPPUNIT_TEST(i<long double>);
|
||||||
CPPUNIT_TEST(inv<float>);
|
CPPUNIT_TEST(inv<float>);
|
||||||
CPPUNIT_TEST(inv<double>);
|
CPPUNIT_TEST(inv<double>);
|
||||||
CPPUNIT_TEST(inv<long double>);
|
CPPUNIT_TEST(inv<long double>);
|
||||||
@@ -427,6 +463,7 @@ class TemplateMatrixTest: public CppUnit::TestFixture {
|
|||||||
CPPUNIT_TEST(stream<unsigned long>);
|
CPPUNIT_TEST(stream<unsigned long>);
|
||||||
CPPUNIT_TEST(stream<float>);
|
CPPUNIT_TEST(stream<float>);
|
||||||
CPPUNIT_TEST(stream<double>);
|
CPPUNIT_TEST(stream<double>);
|
||||||
|
CPPUNIT_TEST(stream<long double>);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
};
|
};
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(TemplateMatrixTest);
|
CPPUNIT_TEST_SUITE_REGISTRATION(TemplateMatrixTest);
|
||||||
@@ -626,6 +663,24 @@ class VariableMatrixTest: public CppUnit::TestFixture {
|
|||||||
Matrix<T> o(m);
|
Matrix<T> o(m);
|
||||||
CPPUNIT_ASSERT_EQUAL((T)3*o, m.apply([](T& t){t*=3;}));
|
CPPUNIT_ASSERT_EQUAL((T)3*o, m.apply([](T& t){t*=3;}));
|
||||||
}
|
}
|
||||||
|
template<typename T>
|
||||||
|
void norm() {
|
||||||
|
Matrix<T> m1(3, 3,
|
||||||
|
1, -1, 1,
|
||||||
|
-1, 1, -1,
|
||||||
|
1, 1, -1);
|
||||||
|
Matrix<T> m2(3, 3,
|
||||||
|
-1, 3, 2,
|
||||||
|
-2, 0, -3,
|
||||||
|
2, 1, -2);
|
||||||
|
Matrix<T> m3(3, 3,
|
||||||
|
0, 3, 0,
|
||||||
|
-1, 0, 2,
|
||||||
|
0, -3, 1);
|
||||||
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, m1.norm(), 0.00001);
|
||||||
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(6.0, m2.norm(), 0.00001);
|
||||||
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(4.0, m3.norm(3), 0.00001);
|
||||||
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void gauss() {
|
void gauss() {
|
||||||
Matrix<T> m(3, 3,
|
Matrix<T> m(3, 3,
|
||||||
@@ -763,48 +818,56 @@ class VariableMatrixTest: public CppUnit::TestFixture {
|
|||||||
CPPUNIT_TEST(initFromArray1<unsigned long>);
|
CPPUNIT_TEST(initFromArray1<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromArray1<float>);
|
CPPUNIT_TEST(initFromArray1<float>);
|
||||||
CPPUNIT_TEST(initFromArray1<double>);
|
CPPUNIT_TEST(initFromArray1<double>);
|
||||||
|
CPPUNIT_TEST(initFromArray1<long double>);
|
||||||
CPPUNIT_TEST(initFromArray2<int>);
|
CPPUNIT_TEST(initFromArray2<int>);
|
||||||
CPPUNIT_TEST(initFromArray2<long>);
|
CPPUNIT_TEST(initFromArray2<long>);
|
||||||
CPPUNIT_TEST(initFromArray2<unsigned>);
|
CPPUNIT_TEST(initFromArray2<unsigned>);
|
||||||
CPPUNIT_TEST(initFromArray2<unsigned long>);
|
CPPUNIT_TEST(initFromArray2<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromArray2<float>);
|
CPPUNIT_TEST(initFromArray2<float>);
|
||||||
CPPUNIT_TEST(initFromArray2<double>);
|
CPPUNIT_TEST(initFromArray2<double>);
|
||||||
|
CPPUNIT_TEST(initFromArray2<long double>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<int>);
|
CPPUNIT_TEST(initFromOtherMatrix<int>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<long>);
|
CPPUNIT_TEST(initFromOtherMatrix<long>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<unsigned>);
|
CPPUNIT_TEST(initFromOtherMatrix<unsigned>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<unsigned long>);
|
CPPUNIT_TEST(initFromOtherMatrix<unsigned long>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<float>);
|
CPPUNIT_TEST(initFromOtherMatrix<float>);
|
||||||
CPPUNIT_TEST(initFromOtherMatrix<double>);
|
CPPUNIT_TEST(initFromOtherMatrix<double>);
|
||||||
|
CPPUNIT_TEST(initFromOtherMatrix<long double>);
|
||||||
CPPUNIT_TEST(access<int>);
|
CPPUNIT_TEST(access<int>);
|
||||||
CPPUNIT_TEST(access<long>);
|
CPPUNIT_TEST(access<long>);
|
||||||
CPPUNIT_TEST(access<unsigned>);
|
CPPUNIT_TEST(access<unsigned>);
|
||||||
CPPUNIT_TEST(access<unsigned long>);
|
CPPUNIT_TEST(access<unsigned long>);
|
||||||
CPPUNIT_TEST(access<float>);
|
CPPUNIT_TEST(access<float>);
|
||||||
CPPUNIT_TEST(access<double>);
|
CPPUNIT_TEST(access<double>);
|
||||||
|
CPPUNIT_TEST(access<long double>);
|
||||||
CPPUNIT_TEST(equality<int>);
|
CPPUNIT_TEST(equality<int>);
|
||||||
CPPUNIT_TEST(equality<long>);
|
CPPUNIT_TEST(equality<long>);
|
||||||
CPPUNIT_TEST(equality<unsigned>);
|
CPPUNIT_TEST(equality<unsigned>);
|
||||||
CPPUNIT_TEST(equality<unsigned long>);
|
CPPUNIT_TEST(equality<unsigned long>);
|
||||||
CPPUNIT_TEST(equality<float>);
|
CPPUNIT_TEST(equality<float>);
|
||||||
CPPUNIT_TEST(equality<double>);
|
CPPUNIT_TEST(equality<double>);
|
||||||
|
CPPUNIT_TEST(equality<long double>);
|
||||||
CPPUNIT_TEST(operator_plus<int>);
|
CPPUNIT_TEST(operator_plus<int>);
|
||||||
CPPUNIT_TEST(operator_plus<long>);
|
CPPUNIT_TEST(operator_plus<long>);
|
||||||
CPPUNIT_TEST(operator_plus<unsigned>);
|
CPPUNIT_TEST(operator_plus<unsigned>);
|
||||||
CPPUNIT_TEST(operator_plus<unsigned long>);
|
CPPUNIT_TEST(operator_plus<unsigned long>);
|
||||||
CPPUNIT_TEST(operator_plus<float>);
|
CPPUNIT_TEST(operator_plus<float>);
|
||||||
CPPUNIT_TEST(operator_plus<double>);
|
CPPUNIT_TEST(operator_plus<double>);
|
||||||
|
CPPUNIT_TEST(operator_plus<long double>);
|
||||||
CPPUNIT_TEST(operator_minus<int>);
|
CPPUNIT_TEST(operator_minus<int>);
|
||||||
CPPUNIT_TEST(operator_minus<long>);
|
CPPUNIT_TEST(operator_minus<long>);
|
||||||
CPPUNIT_TEST(operator_minus<unsigned>);
|
CPPUNIT_TEST(operator_minus<unsigned>);
|
||||||
CPPUNIT_TEST(operator_minus<unsigned long>);
|
CPPUNIT_TEST(operator_minus<unsigned long>);
|
||||||
CPPUNIT_TEST(operator_minus<float>);
|
CPPUNIT_TEST(operator_minus<float>);
|
||||||
CPPUNIT_TEST(operator_minus<double>);
|
CPPUNIT_TEST(operator_minus<double>);
|
||||||
|
CPPUNIT_TEST(operator_minus<long double>);
|
||||||
CPPUNIT_TEST(scalar_mult<int>);
|
CPPUNIT_TEST(scalar_mult<int>);
|
||||||
CPPUNIT_TEST(scalar_mult<long>);
|
CPPUNIT_TEST(scalar_mult<long>);
|
||||||
CPPUNIT_TEST(scalar_mult<unsigned>);
|
CPPUNIT_TEST(scalar_mult<unsigned>);
|
||||||
CPPUNIT_TEST(scalar_mult<unsigned long>);
|
CPPUNIT_TEST(scalar_mult<unsigned long>);
|
||||||
CPPUNIT_TEST(scalar_mult<float>);
|
CPPUNIT_TEST(scalar_mult<float>);
|
||||||
CPPUNIT_TEST(scalar_mult<double>);
|
CPPUNIT_TEST(scalar_mult<double>);
|
||||||
|
CPPUNIT_TEST(scalar_mult<long double>);
|
||||||
CPPUNIT_TEST(scalar_mult<int>);
|
CPPUNIT_TEST(scalar_mult<int>);
|
||||||
CPPUNIT_TEST(scalar_div<int>);
|
CPPUNIT_TEST(scalar_div<int>);
|
||||||
CPPUNIT_TEST(scalar_div<long>);
|
CPPUNIT_TEST(scalar_div<long>);
|
||||||
@@ -812,38 +875,50 @@ class VariableMatrixTest: public CppUnit::TestFixture {
|
|||||||
CPPUNIT_TEST(scalar_div<unsigned long>);
|
CPPUNIT_TEST(scalar_div<unsigned long>);
|
||||||
CPPUNIT_TEST(scalar_div<float>);
|
CPPUNIT_TEST(scalar_div<float>);
|
||||||
CPPUNIT_TEST(scalar_div<double>);
|
CPPUNIT_TEST(scalar_div<double>);
|
||||||
|
CPPUNIT_TEST(scalar_div<long double>);
|
||||||
CPPUNIT_TEST(matrix_mult<int>);
|
CPPUNIT_TEST(matrix_mult<int>);
|
||||||
CPPUNIT_TEST(matrix_mult<long>);
|
CPPUNIT_TEST(matrix_mult<long>);
|
||||||
CPPUNIT_TEST(matrix_mult<unsigned>);
|
CPPUNIT_TEST(matrix_mult<unsigned>);
|
||||||
CPPUNIT_TEST(matrix_mult<unsigned long>);
|
CPPUNIT_TEST(matrix_mult<unsigned long>);
|
||||||
CPPUNIT_TEST(matrix_mult<float>);
|
CPPUNIT_TEST(matrix_mult<float>);
|
||||||
CPPUNIT_TEST(matrix_mult<double>);
|
CPPUNIT_TEST(matrix_mult<double>);
|
||||||
|
CPPUNIT_TEST(matrix_mult<long double>);
|
||||||
CPPUNIT_TEST(transpose<int>);
|
CPPUNIT_TEST(transpose<int>);
|
||||||
CPPUNIT_TEST(transpose<long>);
|
CPPUNIT_TEST(transpose<long>);
|
||||||
CPPUNIT_TEST(transpose<unsigned>);
|
CPPUNIT_TEST(transpose<unsigned>);
|
||||||
CPPUNIT_TEST(transpose<unsigned long>);
|
CPPUNIT_TEST(transpose<unsigned long>);
|
||||||
CPPUNIT_TEST(transpose<float>);
|
CPPUNIT_TEST(transpose<float>);
|
||||||
CPPUNIT_TEST(transpose<double>);
|
CPPUNIT_TEST(transpose<double>);
|
||||||
|
CPPUNIT_TEST(transpose<long double>);
|
||||||
CPPUNIT_TEST(apply<int>);
|
CPPUNIT_TEST(apply<int>);
|
||||||
CPPUNIT_TEST(apply<long>);
|
CPPUNIT_TEST(apply<long>);
|
||||||
CPPUNIT_TEST(apply<unsigned>);
|
CPPUNIT_TEST(apply<unsigned>);
|
||||||
CPPUNIT_TEST(apply<unsigned long>);
|
CPPUNIT_TEST(apply<unsigned long>);
|
||||||
CPPUNIT_TEST(apply<float>);
|
CPPUNIT_TEST(apply<float>);
|
||||||
CPPUNIT_TEST(apply<double>);
|
CPPUNIT_TEST(apply<double>);
|
||||||
|
CPPUNIT_TEST(apply<long double>);
|
||||||
|
CPPUNIT_TEST(norm<int>);
|
||||||
|
CPPUNIT_TEST(norm<long>);
|
||||||
|
CPPUNIT_TEST(norm<float>);
|
||||||
|
CPPUNIT_TEST(norm<double>);
|
||||||
|
CPPUNIT_TEST(norm<long double>);
|
||||||
CPPUNIT_TEST(gauss<int>);
|
CPPUNIT_TEST(gauss<int>);
|
||||||
CPPUNIT_TEST(gauss<long>);
|
CPPUNIT_TEST(gauss<long>);
|
||||||
CPPUNIT_TEST(gauss<float>);
|
CPPUNIT_TEST(gauss<float>);
|
||||||
CPPUNIT_TEST(gauss<double>);
|
CPPUNIT_TEST(gauss<double>);
|
||||||
|
CPPUNIT_TEST(gauss<long double>);
|
||||||
CPPUNIT_TEST(det<int>);
|
CPPUNIT_TEST(det<int>);
|
||||||
CPPUNIT_TEST(det<long>);
|
CPPUNIT_TEST(det<long>);
|
||||||
CPPUNIT_TEST(det<float>);
|
CPPUNIT_TEST(det<float>);
|
||||||
CPPUNIT_TEST(det<double>);
|
CPPUNIT_TEST(det<double>);
|
||||||
|
CPPUNIT_TEST(det<long double>);
|
||||||
CPPUNIT_TEST(i<int>);
|
CPPUNIT_TEST(i<int>);
|
||||||
CPPUNIT_TEST(i<long>);
|
CPPUNIT_TEST(i<long>);
|
||||||
CPPUNIT_TEST(i<unsigned>);
|
CPPUNIT_TEST(i<unsigned>);
|
||||||
CPPUNIT_TEST(i<unsigned long>);
|
CPPUNIT_TEST(i<unsigned long>);
|
||||||
CPPUNIT_TEST(i<float>);
|
CPPUNIT_TEST(i<float>);
|
||||||
CPPUNIT_TEST(i<double>);
|
CPPUNIT_TEST(i<double>);
|
||||||
|
CPPUNIT_TEST(i<long double>);
|
||||||
CPPUNIT_TEST(inv<float>);
|
CPPUNIT_TEST(inv<float>);
|
||||||
CPPUNIT_TEST(inv<double>);
|
CPPUNIT_TEST(inv<double>);
|
||||||
CPPUNIT_TEST(inv<long double>);
|
CPPUNIT_TEST(inv<long double>);
|
||||||
@@ -853,6 +928,7 @@ class VariableMatrixTest: public CppUnit::TestFixture {
|
|||||||
CPPUNIT_TEST(stream<unsigned long>);
|
CPPUNIT_TEST(stream<unsigned long>);
|
||||||
CPPUNIT_TEST(stream<float>);
|
CPPUNIT_TEST(stream<float>);
|
||||||
CPPUNIT_TEST(stream<double>);
|
CPPUNIT_TEST(stream<double>);
|
||||||
|
CPPUNIT_TEST(stream<long double>);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
};
|
};
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(VariableMatrixTest);
|
CPPUNIT_TEST_SUITE_REGISTRATION(VariableMatrixTest);
|
||||||
|
Reference in New Issue
Block a user