// File: toxaart[P]hierarchical_block_sparse_lib/test_source/./test_utils.h
// Function: void verify_that_matrices_are_equal<hbsm::HierarchicalBlockSparseMatrix<double>>(hbsm::HierarchicalBlockSparseMatrix<double> const&, hbsm::HierarchicalBlockSparseMatrix<double> const&)
void verify_that_matrices_are_equal(const MatrixType & A,
				    const MatrixType & B) {
  if(A.get_n_rows() != B.get_n_rows() || A.get_n_cols() != B.get_n_cols())
    throw std::runtime_error("Error: matrices do not have same dimensions.");
  SparseMatrix spA;
  A.get_all_values(spA.rows, spA.cols, spA.values);
  std::vector<double> fullMatrixA;
  spA.to_full(fullMatrixA, A.get_n_rows(), A.get_n_cols());
  SparseMatrix spB;
  B.get_all_values(spB.rows, spB.cols, spB.values);
  std::vector<double> fullMatrixB;
  spB.to_full(fullMatrixB, B.get_n_rows(), B.get_n_cols());

  assert( fullMatrixA.size() == fullMatrixB.size() );
  for(unsigned int ind=0; ind<fullMatrixA.size(); ind++) {
    if (verbose)
      std::cout << std::setw(5) << ind << "  " 
		<< std::setw(14) << fullMatrixA[ind] << "  " 
		<< std::setw(14) << fullMatrixB[ind] 
		<< std::endl;
    if(fullMatrixA[ind] != fullMatrixB[ind])
      throw std::runtime_error("Error: matrices not equal.");
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4b20
movl %eax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b20
movl %eax, %ecx
movl -0xe8(%rbp), %eax
cmpl %ecx, %eax
jne 0x764b
movq -0x8(%rbp), %rdi
callq 0x4b80
movl %eax, -0xec(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b80
movl %eax, %ecx
movl -0xec(%rbp), %eax
cmpl %ecx, %eax
je 0x76a7
movl $0x10, %edi
callq 0x20a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xf8(%rbp)
leaq 0xa956(%rip), %rsi      # 0x11fbf
callq 0x2070
jmp 0x7670
movq -0xf8(%rbp), %rdi
movq 0x10972(%rip), %rsi     # 0x17ff0
movq 0x1093b(%rip), %rdx     # 0x17fc0
callq 0x22c0
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x2130
jmp 0x7965
leaq -0x68(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0xe3d0
movq -0x100(%rbp), %rsi
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0x55b0
jmp 0x76d1
leaq -0x80(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x53e0
movq -0x8(%rbp), %rdi
callq 0x4b20
movl %eax, -0x104(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4b80
movq -0x110(%rbp), %rsi
movl -0x104(%rbp), %edx
movl %eax, %ecx
leaq -0x68(%rbp), %rdi
callq 0xe410
jmp 0x7713
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xe3d0
movq -0x118(%rbp), %rsi
movq -0x10(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x55b0
jmp 0x7746
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x53e0
movq -0x10(%rbp), %rdi
callq 0x4b20
movl %eax, -0x11c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b80
movq -0x128(%rbp), %rsi
movl -0x11c(%rbp), %edx
movl %eax, %ecx
leaq -0xc8(%rbp), %rdi
callq 0xe410
jmp 0x778e
leaq -0x80(%rbp), %rdi
callq 0x8cf0
movq %rax, -0x130(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x8cf0
movq %rax, %rcx
movq -0x130(%rbp), %rax
cmpq %rcx, %rax
jne 0x77bb
jmp 0x781e
leaq 0xa82a(%rip), %rdi      # 0x11fec
leaq 0xa84c(%rip), %rsi      # 0x12015
movl $0x40, %edx
leaq 0xa84f(%rip), %rcx      # 0x12024
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x795c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x7953
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x7947
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x793b
movl $0x0, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movq %rax, -0x138(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x8cf0
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0x7908
movl -0xe4(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x5070
movsd (%rax), %xmm0
movsd %xmm0, -0x140(%rbp)
movl -0xe4(%rbp), %eax
movl %eax, %esi
leaq -0xe0(%rbp), %rdi
callq 0x5070
movsd -0x140(%rbp), %xmm0
ucomisd (%rax), %xmm0
jne 0x7894
jp 0x7894
jmp 0x78f2
movl $0x10, %edi
callq 0x20a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x148(%rbp)
leaq 0xa7f9(%rip), %rsi      # 0x120ab
callq 0x2070
jmp 0x78b9
movq -0x148(%rbp), %rdi
movq 0x10729(%rip), %rsi     # 0x17ff0
movq 0x106f2(%rip), %rdx     # 0x17fc0
callq 0x22c0
jmp 0x796e
movq -0x148(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x2130
jmp 0x793b
jmp 0x78f4
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0x7828
leaq -0xe0(%rbp), %rdi
callq 0x5300
leaq -0xc8(%rbp), %rdi
callq 0xe530
leaq -0x80(%rbp), %rdi
callq 0x5300
leaq -0x68(%rbp), %rdi
callq 0xe530
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0xe0(%rbp), %rdi
callq 0x5300
leaq -0xc8(%rbp), %rdi
callq 0xe530
leaq -0x80(%rbp), %rdi
callq 0x5300
leaq -0x68(%rbp), %rdi
callq 0xe530
movq -0x18(%rbp), %rdi
callq 0x22e0
nop