MCPcopy Create free account
hub / github.com/davisking/dlib / matrix_test

Function matrix_test

dlib/test/matrix3.cpp:633–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631
632
633 void matrix_test (
634 )
635 /*!
636 ensures
637 - runs tests on the matrix stuff compliance with the specs
638 !*/
639 {
640 print_spinner();
641
642
643 {
644 matrix<long> m1(2,2), m2(2,2);
645
646 m1 = 1, 2,
647 3, 4;
648
649 m2 = 4, 5,
650 6, 7;
651
652
653 DLIB_TEST(subm(tensor_product(m1,m2),range(0,1), range(0,1)) == 1*m2);
654 DLIB_TEST(subm(tensor_product(m1,m2),range(0,1), range(2,3)) == 2*m2);
655 DLIB_TEST(subm(tensor_product(m1,m2),range(2,3), range(0,1)) == 3*m2);
656 DLIB_TEST(subm(tensor_product(m1,m2),range(2,3), range(2,3)) == 4*m2);
657 }
658
659 {
660 print_spinner();
661 dlog << LTRACE << "testing blas stuff";
662 dlog << LTRACE << " \nsmall double";
663 test_blas<double>(3,4);
664 print_spinner();
665 dlog << LTRACE << " \nsmall float";
666 test_blas<float>(3,4);
667 print_spinner();
668 dlog << LTRACE << " \nbig double";
669 test_blas<double>(120,131);
670 print_spinner();
671 dlog << LTRACE << " \nbig float";
672 test_blas<float>(120,131);
673 print_spinner();
674 dlog << LTRACE << "testing done";
675 }
676
677
678 {
679 matrix<long> m(3,4), ml(3,4), mu(3,4);
680 m = 1,2,3,4,
681 4,5,6,7,
682 7,8,9,0;
683
684 ml = 1,0,0,0,
685 4,5,0,0,
686 7,8,9,0;
687
688 mu = 1,2,3,4,
689 0,5,6,7,
690 0,0,9,0;

Callers 1

perform_testMethod · 0.70

Calls 15

print_spinnerFunction · 0.85
submFunction · 0.85
tensor_productFunction · 0.85
lowermFunction · 0.85
uppermFunction · 0.85
join_rowsFunction · 0.85
absFunction · 0.85
join_colsFunction · 0.85
reshapeFunction · 0.85
sum_colsFunction · 0.85
sum_rowsFunction · 0.85
make_symmetricFunction · 0.85

Tested by

no test coverage detected