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

Function test_conv

dlib/test/matrix4.cpp:668–838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

666 long D4
667 >
668 void test_conv()
669 {
670 dlog << LINFO << D1 << " " << D2 << " " << D3 << " " << D4;
671 matrix<int,D1,D1> a(1,1);
672 matrix<int,D2,D2> b(2,2);
673 matrix<int,D3,D3> c(3,3);
674 matrix<int,D4,D1> d(4,1);
675
676 a = 4;
677
678 b = 1,2,
679 3,4;
680
681 c = 1,2,3,
682 4,5,6,
683 7,8,9;
684
685 d = 1,
686 2,
687 3,
688 4;
689
690 matrix<int> temp(4,4), temp2;
691 temp = 1, 4, 7, 6,
692 7, 23, 33, 24,
693 19, 53, 63, 42,
694 21, 52, 59, 36;
695
696 DLIB_TEST(conv(b,c) == temp);
697 DLIB_TEST(conv(c,b) == temp);
698 DLIB_TEST(xcorr(c,flip(b)) == temp);
699
700 temp.set_size(2,2);
701 temp = 23, 33,
702 53, 63;
703 DLIB_TEST(conv_same(b,c) == temp);
704 DLIB_TEST(xcorr_same(b,flip(c)) == temp);
705
706 temp2.set_size(2,2);
707 temp2 = 63, 53,
708 33, 23;
709 DLIB_TEST(flip(temp) == temp2);
710 DLIB_TEST(flip(temp) == fliplr(flipud(temp)));
711
712 DLIB_TEST(conv_valid(b,c).nr() == 0);
713 DLIB_TEST(conv_valid(b,c).nc() == 0);
714
715 DLIB_TEST(conv_valid(c,b) == temp);
716 DLIB_TEST(xcorr_valid(c,flip(b)) == temp);
717
718 temp.set_size(1,1);
719 temp = 16;
720
721 DLIB_TEST(conv(a,a) == temp);
722 DLIB_TEST(conv_same(a,a) == temp);
723 DLIB_TEST(conv_valid(a,a) == temp);
724 DLIB_TEST(xcorr(a,a) == temp);
725 DLIB_TEST(xcorr_same(a,a) == temp);

Callers

nothing calls this directly

Calls 15

convFunction · 0.85
xcorrFunction · 0.85
flipFunction · 0.85
conv_sameFunction · 0.85
xcorr_sameFunction · 0.85
fliplrFunction · 0.85
flipudFunction · 0.85
conv_validFunction · 0.85
xcorr_validFunction · 0.85
complex_matrixFunction · 0.85
roundFunction · 0.85
absFunction · 0.85

Tested by

no test coverage detected