// File: thunlp[P]KB2E/TransE/Train_TransE.cpp
// Function: Train::run(int, double, double, int)
void run(int n_in,double rate_in,double margin_in,int method_in)
    {
        n = n_in;
        rate = rate_in;
        margin = margin_in;
        method = method_in;
        relation_vec.resize(relation_num);
		for (int i=0; i<relation_vec.size(); i++)
			relation_vec[i].resize(n);
        entity_vec.resize(entity_num);
		for (int i=0; i<entity_vec.size(); i++)
			entity_vec[i].resize(n);
        relation_tmp.resize(relation_num);
		for (int i=0; i<relation_tmp.size(); i++)
			relation_tmp[i].resize(n);
        entity_tmp.resize(entity_num);
		for (int i=0; i<entity_tmp.size(); i++)
			entity_tmp[i].resize(n);
        for (int i=0; i<relation_num; i++)
        {
            for (int ii=0; ii<n; ii++)
                relation_vec[i][ii] = randn(0,1.0/n,-6/sqrt(n),6/sqrt(n));
        }
        for (int i=0; i<entity_num; i++)
        {
            for (int ii=0; ii<n; ii++)
                entity_vec[i][ii] = randn(0,1.0/n,-6/sqrt(n),6/sqrt(n));
            norm(entity_vec[i]);
        }


        bfgs();
    }

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movl %esi, 0x9c(%rsp)
movsd %xmm0, 0x90(%rsp)
movsd %xmm1, 0x88(%rsp)
movl %edx, 0x84(%rsp)
movq 0xa0(%rsp), %rdi
movq %rdi, 0x58(%rsp)
movl 0x9c(%rsp), %eax
movl %eax, 0x30(%rdi)
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x50(%rdi)
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x58(%rdi)
movl 0x84(%rsp), %eax
movl %eax, 0x34(%rdi)
addq $0xc8, %rdi
movslq 0x46e26(%rip), %rsi     # 0x4afb0
callq 0x7ef0
movl $0x0, 0x80(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x80(%rsp), %rax
movq %rax, 0x50(%rsp)
addq $0xc8, %rdi
callq 0x7f90
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jae 0x4202
movq 0x58(%rsp), %rdi
addq $0xc8, %rdi
movslq 0x80(%rsp), %rsi
callq 0x7fb0
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0x7fd0
movl 0x80(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x80(%rsp)
jmp 0x419a
movq 0x58(%rsp), %rdi
addq $0xe0, %rdi
movslq 0x46d9f(%rip), %rsi     # 0x4afb4
callq 0x7ef0
movl $0x0, 0x7c(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x7c(%rsp), %rax
movq %rax, 0x48(%rsp)
addq $0xe0, %rdi
callq 0x7f90
movq %rax, %rcx
movq 0x48(%rsp), %rax
cmpq %rcx, %rax
jae 0x427e
movq 0x58(%rsp), %rdi
addq $0xe0, %rdi
movslq 0x7c(%rsp), %rsi
callq 0x7fb0
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0x7fd0
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x4222
movq 0x58(%rsp), %rdi
addq $0xf8, %rdi
movslq 0x46d1f(%rip), %rsi     # 0x4afb0
callq 0x7ef0
movl $0x0, 0x78(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
addq $0xf8, %rdi
callq 0x7f90
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jae 0x42fa
movq 0x58(%rsp), %rdi
addq $0xf8, %rdi
movslq 0x78(%rsp), %rsi
callq 0x7fb0
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0x7fd0
movl 0x78(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x429e
movq 0x58(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x46ca7(%rip), %rsi     # 0x4afb4
callq 0x7ef0
movl $0x0, 0x74(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x74(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x110, %rdi            # imm = 0x110
callq 0x7f90
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
jae 0x4376
movq 0x58(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x74(%rsp), %rsi
callq 0x7fb0
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0x7fd0
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x431a
movl $0x0, 0x70(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x46c28(%rip), %eax     # 0x4afb0
jge 0x4463
movl $0x0, 0x6c(%rsp)
movq 0x58(%rsp), %rcx
movl 0x6c(%rsp), %eax
cmpl 0x30(%rcx), %eax
jge 0x4451
movq 0x58(%rsp), %rax
cvtsi2sdl 0x30(%rax), %xmm1
movsd 0xdc66(%rip), %xmm0     # 0x12020
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0x30(%rax), %edi
callq 0x8070
movq 0x58(%rsp), %rax
movaps %xmm0, %xmm1
movsd 0xdc64(%rip), %xmm0     # 0x12040
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movl 0x30(%rax), %edi
callq 0x8070
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movsd 0xdc36(%rip), %xmm3     # 0x12038
divsd %xmm0, %xmm3
xorps %xmm0, %xmm0
callq 0x2870
movq 0x58(%rsp), %rdi
movsd %xmm0, 0x30(%rsp)
addq $0xc8, %rdi
movslq 0x70(%rsp), %rsi
callq 0x7fb0
movq %rax, %rdi
movslq 0x6c(%rsp), %rsi
callq 0x37d0
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x4396
jmp 0x4453
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x70(%rsp)
jmp 0x437e
movl $0x0, 0x68(%rsp)
movl 0x68(%rsp), %eax
cmpl 0x46b3f(%rip), %eax     # 0x4afb4
jge 0x4571
movl $0x0, 0x64(%rsp)
movq 0x58(%rsp), %rcx
movl 0x64(%rsp), %eax
cmpl 0x30(%rcx), %eax
jge 0x453e
movq 0x58(%rsp), %rax
cvtsi2sdl 0x30(%rax), %xmm1
movsd 0xdb79(%rip), %xmm0     # 0x12020
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x30(%rax), %edi
callq 0x8070
movq 0x58(%rsp), %rax
movaps %xmm0, %xmm1
movsd 0xdb77(%rip), %xmm0     # 0x12040
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x30(%rax), %edi
callq 0x8070
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movsd 0xdb49(%rip), %xmm3     # 0x12038
divsd %xmm0, %xmm3
xorps %xmm0, %xmm0
callq 0x2870
movq 0x58(%rsp), %rdi
movsd %xmm0, 0x18(%rsp)
addq $0xe0, %rdi
movslq 0x68(%rsp), %rsi
callq 0x7fb0
movq %rax, %rdi
movslq 0x64(%rsp), %rsi
callq 0x37d0
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x4483
movq 0x58(%rsp), %rdi
addq $0xe0, %rdi
movslq 0x68(%rsp), %rsi
callq 0x7fb0
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x8090
movl 0x68(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68(%rsp)
jmp 0x446b
movq 0x58(%rsp), %rdi
callq 0x8130
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)