// File: icemiliang[P]vot/src/vot/diagram.cc
// Function: vot::Diagram::update_h(Eigen::SparseMatrix<double, 0, int>&)
void Diagram::update_h(Eigen::SparseMatrix<double>& pHessian) {
        Eigen::VectorXd deltaH;
        Eigen::LeastSquaresConjugateGradient<Eigen::SparseMatrix<double>> solver;
        deltaH = solver.compute(pHessian).solve(mGradient);

        for (int i = 0; i < mNumDiracs; i++) {
            mHs[i] -= deltaH(i);
        }

        // I haven't found a way to directly update h
        // The alternative is to clear the diagram and define a new one with new h
        // Liang Mi
        mDiagram->clear();
        for (int i = 0; i < mNumDiracs; i++) {
            mDiagram->put(i, mDiracs[i].x(), mDiracs[i].y(), mDiracs[i].z(), sqrt(mHs[i]));
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x214b0
leaq -0x140(%rbp), %rdi
callq 0x22c70
jmp 0x20725
movq -0x10(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x22c90
movq %rax, -0x178(%rbp)
jmp 0x2073e
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
addq $0x40, %rsi
callq 0x22d20
movq %rdx, -0x188(%rbp)
movq %rax, -0x180(%rbp)
jmp 0x20765
movq -0x188(%rbp), %rax
movq -0x180(%rbp), %rcx
movq %rcx, -0x160(%rbp)
movq %rax, -0x158(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x22e10
jmp 0x20793
movl $0x0, -0x164(%rbp)
movq -0x170(%rbp), %rcx
movl -0x164(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x20855
movslq -0x164(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x22af0
movq %rax, -0x190(%rbp)
jmp 0x207cc
movq -0x170(%rbp), %rdi
movq -0x190(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x198(%rbp)
addq $0x50, %rdi
movslq -0x164(%rbp), %rsi
callq 0x21950
movsd -0x198(%rbp), %xmm1
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0x164(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x164(%rbp)
jmp 0x2079d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x20996
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x22e40
jmp 0x20996
movq -0x170(%rbp), %rax
movq (%rax), %rdi
callq 0x57810
jmp 0x20866
movl $0x0, -0x168(%rbp)
movq -0x170(%rbp), %rcx
movl -0x168(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x20978
movq -0x170(%rbp), %rdi
movq (%rdi), %rax
movq %rax, -0x1b0(%rbp)
movl -0x168(%rbp), %eax
movl %eax, -0x1a4(%rbp)
addq $0x20, %rdi
movslq %eax, %rsi
callq 0x218b0
movq %rax, %rdi
callq 0x218d0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x208c1
movq -0x170(%rbp), %rdi
addq $0x20, %rdi
movslq -0x168(%rbp), %rsi
callq 0x218b0
movq %rax, %rdi
callq 0x218f0
movsd %xmm0, -0x1b8(%rbp)
jmp 0x208ea
movq -0x170(%rbp), %rdi
addq $0x20, %rdi
movslq -0x168(%rbp), %rsi
callq 0x218b0
movq %rax, %rdi
callq 0x21910
movsd %xmm0, -0x1c0(%rbp)
jmp 0x20913
movq -0x170(%rbp), %rdi
addq $0x50, %rdi
movslq -0x168(%rbp), %rsi
callq 0x21950
movsd (%rax), %xmm0
callq 0xa3d0
movq -0x1b0(%rbp), %rdi
movl -0x1a4(%rbp), %esi
movsd -0x1b8(%rbp), %xmm1
movsd -0x1c0(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x1a0(%rbp), %xmm0
callq 0x56650
jmp 0x20962
jmp 0x20964
movl -0x168(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x168(%rbp)
jmp 0x20870
leaq -0x140(%rbp), %rdi
callq 0x22e40
leaq -0x20(%rbp), %rdi
callq 0x21580
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x21580
movq -0x148(%rbp), %rdi
callq 0xa950
nopl (%rax,%rax)