// File: toxaart[P]hierarchical_block_sparse_lib/source/HierarchicalBlockSparseMatrix.h
// Function: hbsm::HierarchicalBlockSparseMatrix<double>::sum_spamm_errors(std::vector<double, std::allocator<double>> const&, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>> const&)
std::vector<Treal> HierarchicalBlockSparseMatrix<Treal>::sum_spamm_errors(std::vector<real> const & curr_level_errors, std::vector<std::vector<real> > const & sub_errors){

	 			  std::vector<real> total_errors(curr_level_errors.size(),0.0);


	 				for(int j = 0; j < curr_level_errors.size(); ++j){

					// WHAT IS COMMENTED OUT IS DUE TO THE NEW VERSION OF THE ALGORITHM PROPOSED BY EMANUEL
	 				//	if(curr_level_errors[j] > 0.0) total_errors[j] = curr_level_errors[j];
	 				//	else{
	 						for(int i = 0; i < sub_errors.size();++i){
								if(sub_errors[i].size() == 0) continue;
								else total_errors[j] += sub_errors[i][j] * sub_errors[i][j];
	 						}
							total_errors[j] = std::sqrt(total_errors[j]);
	 					//}
	 				}

	 				return total_errors;
	 		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x60(%rbp)
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movq -0x10(%rbp), %rdi
callq 0x22b40
movq %rax, -0x58(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x34080
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rcx
leaq -0x28(%rbp), %rdx
callq 0x340a0
jmp 0x3229f
leaq -0x29(%rbp), %rdi
callq 0x33510
movl $0x0, -0x40(%rbp)
movslq -0x40(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x22b40
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0x323f8
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0x33c90
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0x323b3
movq -0x18(%rbp), %rdi
movslq -0x44(%rbp), %rsi
callq 0x34120
movq %rax, %rdi
callq 0x22b40
cmpq $0x0, %rax
jne 0x32332
jmp 0x323a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x33510
jmp 0x32418
movq -0x18(%rbp), %rdi
movslq -0x44(%rbp), %rsi
callq 0x34120
movq %rax, %rdi
movslq -0x40(%rbp), %rsi
callq 0x245a0
movsd (%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x44(%rbp), %rsi
callq 0x34120
movq %rax, %rdi
movslq -0x40(%rbp), %rsi
callq 0x245a0
movq -0x60(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movslq -0x40(%rbp), %rsi
callq 0x22b60
movsd -0x88(%rbp), %xmm0
movsd -0x80(%rbp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
jmp 0x323a5
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x322d7
movq -0x60(%rbp), %rdi
movslq -0x40(%rbp), %rsi
callq 0x22b60
movsd (%rax), %xmm0
callq 0x2180
movq -0x60(%rbp), %rdi
movsd %xmm0, -0x90(%rbp)
movslq -0x40(%rbp), %rsi
callq 0x22b60
movsd -0x90(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x322af
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x3240b
movq -0x60(%rbp), %rdi
callq 0x112e0
movq -0x68(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)