// File: /workspace/github_cpp_makefile_star2_O3/IdelCoder[P]PTransE-ag/Train_PTransE-pos.cpp
// Function: Train::run()
void run()
    {
        // n是维数，rate是学习率
        n = 100;
        rate = 0.001;
		cout<<"n="<<n<<' '<<"rate="<<rate<<endl;
        // vector<vector<double> > 二维数组，每一个关系用n为向量表示
		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:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movl $0x64, 0x30(%rdi)
movabsq $0x3f50624dd2f1a9fc, %rax # imm = 0x3F50624DD2F1A9FC
movq %rax, 0x58(%rdi)
movq 0xa2d4(%rip), %r14      # 0xefd8
leaq 0x64a8(%rip), %rsi      # 0xb1b3
movl $0x2, %edx
movq %r14, %rdi
callq 0x2210
movl 0x30(%rbx), %esi
movq %r14, %rdi
callq 0x2310
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2210
movq %rax, %r14
leaq 0x6437(%rip), %rsi      # 0xb179
movl $0x5, %edx
movq %rax, %rdi
callq 0x2210
movsd 0x58(%rbx), %xmm0
movq %r14, %rdi
callq 0x22e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leaq 0xe0(%rbx), %rdi
movslq 0x5397c(%rip), %rsi     # 0x58710
callq 0x5e04
movq 0xe0(%rbx), %rdi
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
cmpq %rdi, 0xe8(%rbx)
je 0x4dea
xorl %r14d, %r14d
xorl %r12d, %r12d
addq %r14, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5e86
incq %r12
movq 0xe0(%rbx), %rdi
movq 0xe8(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r14
cmpq %r12, %rax
ja 0x4db9
leaq 0xf8(%rbx), %r14
movslq 0x5391c(%rip), %rsi     # 0x58714
movq %r14, %rdi
callq 0x5e04
movq 0xf8(%rbx), %rdi
cmpq %rdi, 0x100(%rbx)
je 0x4e47
xorl %r12d, %r12d
xorl %r13d, %r13d
addq %r12, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5e86
incq %r13
movq 0xf8(%rbx), %rdi
movq 0x100(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r12
cmpq %r13, %rax
ja 0x4e16
leaq 0x110(%rbx), %rdi
movslq 0x538bb(%rip), %rsi     # 0x58710
callq 0x5e04
movq 0x110(%rbx), %rdi
cmpq %rdi, 0x118(%rbx)
je 0x4ea1
xorl %r12d, %r12d
xorl %r13d, %r13d
addq %r12, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5e86
incq %r13
movq 0x110(%rbx), %rdi
movq 0x118(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r12
cmpq %r13, %rax
ja 0x4e70
leaq 0x128(%rbx), %rdi
movslq 0x53865(%rip), %rsi     # 0x58714
callq 0x5e04
movq 0x128(%rbx), %rdi
cmpq %rdi, 0x130(%rbx)
je 0x4efb
xorl %r12d, %r12d
xorl %r13d, %r13d
addq %r12, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5e86
incq %r13
movq 0x128(%rbx), %rdi
movq 0x130(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r12
cmpq %r13, %rax
ja 0x4eca
movl 0x5380f(%rip), %ecx     # 0x58710
testl %ecx, %ecx
jle 0x4fd5
movl 0x30(%rbx), %eax
xorl %r15d, %r15d
testl %eax, %eax
jle 0x4fc6
leaq (%r15,%r15,2), %r12
xorl %r13d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
ucomisd 0x6103(%rip), %xmm0     # 0xb030
movsd %xmm0, 0x18(%rsp)
jb 0x4f3e
xorps %xmm4, %xmm4
sqrtsd %xmm0, %xmm4
jmp 0x4f47
callq 0x2160
movapd %xmm0, %xmm4
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x60d9(%rip), %xmm0     # 0xb030
jb 0x4f5f
sqrtsd %xmm0, %xmm0
jmp 0x4f70
movsd %xmm4, 0x10(%rsp)
callq 0x2160
movsd 0x10(%rsp), %xmm4
movsd 0x60b0(%rip), %xmm3     # 0xb028
divsd %xmm0, %xmm3
movsd 0x6094(%rip), %xmm1     # 0xb018
divsd 0x18(%rsp), %xmm1
movsd 0x608e(%rip), %xmm2     # 0xb020
divsd %xmm4, %xmm2
xorpd %xmm0, %xmm0
callq 0x28b7
movq 0xe0(%rbx), %rax
movq (%rax,%r12,8), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
movslq 0x30(%rbx), %rax
cmpq %rax, %r13
jl 0x4f1e
movl 0x5374a(%rip), %ecx     # 0x58710
incq %r15
movslq %ecx, %rdx
cmpq %rdx, %r15
jl 0x4f0f
cmpl $0x0, 0x53738(%rip)     # 0x58714
jle 0x50bd
xorl %r15d, %r15d
movl 0x30(%rbx), %eax
leaq (%r15,%r15,2), %r12
testl %eax, %eax
jle 0x509b
xorl %r13d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
ucomisd 0x602a(%rip), %xmm0     # 0xb030
movsd %xmm0, 0x18(%rsp)
jb 0x5017
xorps %xmm4, %xmm4
sqrtsd %xmm0, %xmm4
jmp 0x5020
callq 0x2160
movapd %xmm0, %xmm4
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x6000(%rip), %xmm0     # 0xb030
jb 0x5038
sqrtsd %xmm0, %xmm0
jmp 0x5049
movsd %xmm4, 0x10(%rsp)
callq 0x2160
movsd 0x10(%rsp), %xmm4
movsd 0x5fd7(%rip), %xmm3     # 0xb028
divsd %xmm0, %xmm3
movsd 0x5fbb(%rip), %xmm1     # 0xb018
divsd 0x18(%rsp), %xmm1
movsd 0x5fb5(%rip), %xmm2     # 0xb020
divsd %xmm4, %xmm2
xorpd %xmm0, %xmm0
callq 0x28b7
movq 0xf8(%rbx), %rcx
movq (%rcx,%r12,8), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
movslq 0x30(%rbx), %rax
cmpq %rax, %r13
jl 0x4ff7
jmp 0x509e
movq (%r14), %rcx
leaq (%rcx,%r12,8), %rsi
movq %rbx, %rdi
callq 0x5eb8
incq %r15
movslq 0x53660(%rip), %rax     # 0x58714
cmpq %rax, %r15
jl 0x4fe5
movq %rbx, %rdi
callq 0x5f44
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq