// File: /workspace/github_cpp_makefile_star2_O2/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::ParamsIterationUpdate()
void IsiSage::ParamsIterationUpdate(){
    Util::log("SAGE iteration step for updating params");
    int n_step = 1;
    SageResult last_update_result; 
    while(n_step <= max_iter_num){
        Util::log("====== Starting the " + to_string(n_step) + "th iteration step ======");
        // save init result of all path
        last_update_result = result;
        complex_mat y;
        for(int i_path = 0; i_path < max_path_num; ++i_path){
            y = CIR;
            //========== Expectation Step ==================
            for(int j = 0; j<max_path_num; ++j){
                if(j!=i_path){
                    y.row(result.tau(j)-1) -= SignalConstruct(j);
                }
            }
            //========== Maximization Step =================
            // update tau 
            RowVectorXcd tau_data = UpdateTau(y, i_path);
            // update AoA
            UpdateAoA(tau_data, i_path);
            // update AoD
            UpdateAoD(tau_data, i_path);
            // update doppler
            UpdateDoppler(tau_data, i_path);
            // update alpha 
            UpdateAlpha(tau_data, i_path);

        }
        // judge coverage
        if(IterConvergence(last_update_result, result)){
            Util::log("Iteration has coveraged !");
            break;
        }

        ++n_step;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdi, %rbx
leaq 0x14e2d(%rip), %rsi     # 0x1d7e6
leaq 0xa8(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x3b5e
leaq 0xa8(%rsp), %rdi
callq 0x547e
leaq 0xa8(%rsp), %rdi
callq 0x3100
xorps %xmm0, %xmm0
leaq 0x140(%rsp), %rax
movaps %xmm0, 0x60(%rax)
movaps %xmm0, 0x50(%rax)
movaps %xmm0, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x20(%rax)
andq $0x0, 0x70(%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x1c0(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x138(%rbx), %rax
movq %rax, 0x38(%rsp)
pushq $0x1
popq %r12
leaq 0xc8(%rsp), %r14
leaq 0x80(%rsp), %rbp
cmpl 0x158(%rbx), %r12d
jg 0x8cd4
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %r12d, %esi
callq 0xaa69
movq %r14, %rdi
leaq 0x14da8(%rip), %rsi     # 0x1d80e
movq %r15, %rdx
callq 0xaa45
leaq 0x120(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
leaq 0x14da0(%rip), %rdx     # 0x1d823
callq 0x545f
movq %r15, %rdi
callq 0x547e
movl %r12d, 0x4(%rsp)
movq %r15, %rdi
callq 0x3100
movq %r14, %rdi
callq 0x3100
leaq 0x10(%rsp), %rdi
callq 0x3100
leaq 0x140(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xb01c
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
xorl %r12d, %r12d
movslq 0x15c(%rbx), %rax
cmpq %rax, %r12
jge 0x8c33
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq 0x38(%rsp), %rsi
callq 0x19bee
xorl %r13d, %r13d
movslq 0x15c(%rbx), %rax
cmpq %rax, %r13
jge 0x8b51
cmpq %r13, %r12
je 0x8b4c
movq %rbp, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x865e
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x5618
movslq (%rax), %rdx
decq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xb9f6
movq %r14, %rdi
movq %rbp, %rsi
callq 0xaac2
movq 0x80(%rsp), %rdi
callq 0x32c0
incq %r13
jmp 0x8af7
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xb962
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x8e12
movq 0x90(%rsp), %rdi
callq 0x32c0
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0xb9b4
movq %rbx, %rdi
leaq 0x70(%rsp), %rsi
movl %r12d, %edx
callq 0x918a
movq 0x70(%rsp), %rdi
callq 0x32c0
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0xb9b4
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
movl %r12d, %edx
callq 0x96ca
movq 0x60(%rsp), %rdi
callq 0x32c0
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0xb9b4
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
movl %r12d, %edx
callq 0x9c0a
movq 0x50(%rsp), %rdi
callq 0x32c0
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0xb9b4
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
movl %r12d, %edx
callq 0x7f06
movq 0x40(%rsp), %rdi
callq 0x32c0
movq 0xc8(%rsp), %rdi
callq 0x32c0
incq %r12
jmp 0x8ad2
leaq 0x1b8(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0xb088
leaq 0x230(%rsp), %r13
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0xb088
movq (%rbx), %rax
movq %rbx, %rdi
leaq 0x1b8(%rsp), %r15
movq %r15, %rsi
movq %r13, %rdx
callq *0x28(%rax)
movl %eax, %r12d
movq %r13, %rdi
callq 0x3e7a
movq %r15, %rdi
callq 0x3e7a
testb %r12b, %r12b
je 0x8cb8
leaq 0x100(%rsp), %r15
movq %r15, %rdi
leaq 0x14b9e(%rip), %rsi     # 0x1d83c
movq %r14, %rdx
callq 0x3b5e
movq %r15, %rdi
callq 0x547e
movq %r15, %rdi
callq 0x3100
jmp 0x8cbc
incl 0x4(%rsp)
movq 0x10(%rsp), %rdi
callq 0x32c0
testb %r12b, %r12b
movl 0x4(%rsp), %r12d
je 0x8a3f
leaq 0x140(%rsp), %rdi
callq 0x3e7a
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x3100
jmp 0x8e0a
movq %rax, %rbx
jmp 0x8e0a
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x3100
jmp 0x8df3
jmp 0x8dde
movq %rax, %rbx
jmp 0x8d44
jmp 0x8dde
movq %rax, %rbx
leaq 0x230(%rsp), %rdi
callq 0x3e7a
leaq 0x1b8(%rsp), %rdi
callq 0x3e7a
jmp 0x8df3
jmp 0x8d5d
movq %rax, %rbx
jmp 0x8d7a
movq %rax, %rbx
jmp 0x8dfd
movq %rax, %rbx
jmp 0x8d87
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x3100
leaq 0xc8(%rsp), %rdi
callq 0x3100
leaq 0x10(%rsp), %rdi
callq 0x3100
jmp 0x8dfd
movq %rax, %rbx
movq 0x70(%rsp), %rdi
jmp 0x8dc8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
jmp 0x8dc8
jmp 0x8dde
movq %rax, %rbx
movq 0x50(%rsp), %rdi
jmp 0x8dc8
movq %rax, %rbx
movq 0x90(%rsp), %rdi
jmp 0x8dee
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x32c0
jmp 0x8dd4
jmp 0x8dde
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
jmp 0x8dee
movq %rax, %rbx
jmp 0x8df3
movq %rax, %rbx
movq 0x80(%rsp), %rdi
callq 0x32c0
movq 0x10(%rsp), %rdi
callq 0x32c0
leaq 0x140(%rsp), %rdi
callq 0x3e7a
movq %rbx, %rdi
callq 0x3430