// File: xbai0624[P]dnn/src/UnitTest.cpp
// Function: UnitTest::TestMatrix()
void UnitTest::TestMatrix()
{
    /*
    Matrix m(4, 4);
    m.Random();

    cout<<"Test Matrix."<<endl;
    cout<<m<<endl;

    double v = m.MaxInSectionWithPadding(2, 6, 2, 6);
    cout<<v<<endl;

    cout<<"Test average in section with padding."<<endl;
    Matrix mm(4, 4, 1);
    cout<<mm<<endl;
    double vv = mm.AverageInSectionWithPadding(0, 6, 1, 6);
    cout<<vv<<endl;

    Matrix m1(3, 1, 0);
    Matrix m2(3, 1, 1);
    bool e = (m1 == m2);
    cout<<m1<<endl;
    cout<<m2<<endl;
    cout<<"matrix equal: "<<e<<endl;

    Matrix m(4, 10);
    for(int i=0;i<10;i++)
    {
        m.RandomGaus(0, 1./100);
        cout<<m<<endl;
    }

    Matrix m(4, 4, 0);
    m[3][2] = 1;
    cout<<m<<endl;
    Matrix mm = m.Normalization();
    cout<<mm<<endl;
    */
    vector<Matrix> vm;
    Matrix m1(3, 3, 1);
    Matrix m2(3, 3, 2);
    Matrix m3(3, 3, 1);
    Matrix m4(3, 3, 0);


    vm.push_back(m1);
    vm.push_back(m4);
    //vm.push_back(m2);
    //vm.push_back(m3);
    vm.push_back(m4);
    cout<<vm<<endl;

    Matrix::BatchNormalization(vm);
    cout<<vm<<endl;

    cout<<"concatenate matrix by I:  "<<endl;
    Matrix c = Matrix::ConcatenateMatrixByI(vm);
    cout<<c<<endl;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x1f050
leaq 0x90(%rsp), %rdi
movl $0x3, %edx
movsd 0x77d7(%rip), %xmm0     # 0x52008
movq %rdx, %rsi
callq 0x3b590
jmp 0x4a83b
leaq 0x68(%rsp), %rdi
movl $0x3, %edx
movsd 0x77cb(%rip), %xmm0     # 0x52018
movq %rdx, %rsi
callq 0x3b590
jmp 0x4a857
leaq 0x50(%rsp), %rdi
movl $0x3, %edx
movsd 0x779f(%rip), %xmm0     # 0x52008
movq %rdx, %rsi
callq 0x3b590
jmp 0x4a873
leaq 0x38(%rsp), %rdi
movl $0x3, %edx
xorps %xmm0, %xmm0
movq %rdx, %rsi
callq 0x3b590
jmp 0x4a88a
leaq 0xa8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x1fa50
jmp 0x4a8a1
leaq 0xa8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1fa50
jmp 0x4a8b5
leaq 0xa8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1fa50
jmp 0x4a8c9
movq 0x20708(%rip), %rdi     # 0x6afd8
leaq 0xa8(%rsp), %rsi
callq 0x3d5b0
movq %rax, 0x18(%rsp)
jmp 0x4a8e4
movq 0x18(%rsp), %rdi
movq 0x206c0(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4a8f7
leaq 0xa8(%rsp), %rdi
callq 0x41a40
jmp 0x4a906
movq 0x206cb(%rip), %rdi     # 0x6afd8
leaq 0xa8(%rsp), %rsi
callq 0x3d5b0
movq %rax, 0x10(%rsp)
jmp 0x4a921
movq 0x10(%rsp), %rdi
movq 0x20683(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4a934
movq 0x2069d(%rip), %rdi     # 0x6afd8
leaq 0xbad3(%rip), %rsi      # 0x56415
callq 0x4230
movq %rax, 0x8(%rsp)
jmp 0x4a94e
movq 0x8(%rsp), %rdi
movq 0x20656(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4a961
leaq 0x20(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3fac0
jmp 0x4a975
movq 0x2065c(%rip), %rdi     # 0x6afd8
leaq 0x20(%rsp), %rsi
callq 0x3d640
movq %rax, (%rsp)
jmp 0x4a98c
movq (%rsp), %rdi
movq 0x20619(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x4a99e
leaq 0x20(%rsp), %rdi
callq 0x3bb80
leaq 0x38(%rsp), %rdi
callq 0x3bb80
leaq 0x50(%rsp), %rdi
callq 0x3bb80
leaq 0x68(%rsp), %rdi
callq 0x3bb80
leaq 0x90(%rsp), %rdi
callq 0x3bb80
leaq 0xa8(%rsp), %rdi
callq 0x1f0d0
addq $0xc8, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x4aaa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x4aa95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x4aa8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x4aa81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x4aa77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x3bb80
leaq 0x38(%rsp), %rdi
callq 0x3bb80
leaq 0x50(%rsp), %rdi
callq 0x3bb80
leaq 0x68(%rsp), %rdi
callq 0x3bb80
leaq 0x90(%rsp), %rdi
callq 0x3bb80
leaq 0xa8(%rsp), %rdi
callq 0x1f0d0
movq 0x88(%rsp), %rdi
callq 0x43f0
nopl (%rax)