// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x64, 0x30(%rdi)
movabsq $0x3f50624dd2f1a9fc, %rax # imm = 0x3F50624DD2F1A9FC
movq %rax, 0x58(%rdi)
movq 0xa305(%rip), %rdi      # 0xdfd8
leaq 0x54af(%rip), %rsi      # 0x9189
callq 0x2190
movl 0x30(%rbx), %esi
movq %rax, %rdi
callq 0x22f0
pushq $0x20
popq %rsi
movq %rax, %rdi
callq 0x21e0
leaq 0x5453(%rip), %rsi      # 0x914f
movq %rax, %rdi
callq 0x2190
movsd 0x58(%rbx), %xmm0
movq %rax, %rdi
callq 0x22c0
movq %rax, %rdi
callq 0x20d0
leaq 0xe0(%rbx), %r15
movslq 0x539d9(%rip), %rsi     # 0x57700
movq %r15, %rdi
callq 0x4d7e
xorl %r14d, %r14d
pushq $0x18
popq %r12
xorl %r13d, %r13d
movq 0xe0(%rbx), %rdi
movq 0xe8(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %r13, %rax
jbe 0x3d69
addq %r14, %rdi
movslq 0x30(%rbx), %rsi
callq 0x4db4
incq %r13
addq $0x18, %r14
jmp 0x3d39
leaq 0xf8(%rbx), %r14
movslq 0x5398d(%rip), %rsi     # 0x57704
movq %r14, %rdi
callq 0x4d7e
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0xf8(%rbx), %rdi
movq 0x100(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x3db4
addq %r13, %rdi
movslq 0x30(%rbx), %rsi
callq 0x4db4
incq %rbp
addq $0x18, %r13
jmp 0x3d84
leaq 0x110(%rbx), %rdi
movslq 0x5393e(%rip), %rsi     # 0x57700
callq 0x4d7e
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x110(%rbx), %rdi
movq 0x118(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x3dfc
addq %r13, %rdi
movslq 0x30(%rbx), %rsi
callq 0x4db4
incq %rbp
addq $0x18, %r13
jmp 0x3dcc
leaq 0x128(%rbx), %rdi
movslq 0x538fa(%rip), %rsi     # 0x57704
callq 0x4d7e
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x128(%rbx), %rdi
movq 0x130(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x3e44
addq %r13, %rdi
movslq 0x30(%rbx), %rsi
callq 0x4db4
incq %rbp
addq $0x18, %r13
jmp 0x3e14
xorl %r12d, %r12d
movslq 0x538b2(%rip), %rax     # 0x57700
cmpq %rax, %r12
jge 0x3efe
imulq $0x18, %r12, %r13
xorl %ebp, %ebp
movslq 0x30(%rbx), %rax
cmpq %rax, %rbp
jge 0x3ef6
cvtsi2sd %eax, %xmm0
ucomisd 0x51ba(%rip), %xmm0     # 0x9030
movsd %xmm0, 0x10(%rsp)
jb 0x3e84
sqrtsd %xmm0, %xmm3
jmp 0x3e8d
callq 0x2130
movapd %xmm0, %xmm3
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x5196(%rip), %xmm0     # 0x9030
jb 0x3ea2
sqrtsd %xmm0, %xmm0
jmp 0x3eb3
movsd %xmm3, 0x8(%rsp)
callq 0x2130
movsd 0x8(%rsp), %xmm3
movsd 0x515d(%rip), %xmm1     # 0x9018
divsd 0x10(%rsp), %xmm1
movsd 0x5157(%rip), %xmm2     # 0x9020
divsd %xmm3, %xmm2
movsd 0x5153(%rip), %xmm3     # 0x9028
divsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
callq 0x2844
movq (%r15), %rax
movq (%rax,%r13), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
jmp 0x3e5d
incq %r12
jmp 0x3e47
xorl %r12d, %r12d
movslq 0x537fc(%rip), %rax     # 0x57704
cmpq %rax, %r12
jge 0x3fcc
imulq $0x18, %r12, %r15
xorl %r13d, %r13d
movslq 0x30(%rbx), %rax
cmpq %rax, %r13
jge 0x3fb2
cvtsi2sd %eax, %xmm0
ucomisd 0x50ff(%rip), %xmm0     # 0x9030
movsd %xmm0, 0x10(%rsp)
jb 0x3f3f
sqrtsd %xmm0, %xmm3
jmp 0x3f48
callq 0x2130
movapd %xmm0, %xmm3
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x50db(%rip), %xmm0     # 0x9030
jb 0x3f5d
sqrtsd %xmm0, %xmm0
jmp 0x3f6e
movsd %xmm3, 0x8(%rsp)
callq 0x2130
movsd 0x8(%rsp), %xmm3
movsd 0x50a2(%rip), %xmm1     # 0x9018
divsd 0x10(%rsp), %xmm1
movsd 0x509c(%rip), %xmm2     # 0x9020
divsd %xmm3, %xmm2
movsd 0x5098(%rip), %xmm3     # 0x9028
divsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
callq 0x2844
movq (%r14), %rax
movq (%rax,%r15), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
jmp 0x3f18
addq 0xf8(%rbx), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4de6
incq %r12
jmp 0x3f01
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4e2a