// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x64, 0x30(%rdi)
movabsq $0x3f50624dd2f1a9fc, %rax # imm = 0x3F50624DD2F1A9FC
movq %rax, 0x58(%rdi)
movq 0xa2a0(%rip), %r14      # 0xefd8
leaq 0x6474(%rip), %rsi      # 0xb1b3
movl $0x2, %edx
movq %r14, %rdi
callq 0x2210
movl 0x30(%rbx), %esi
movq %r14, %rdi
callq 0x2310
leaq 0x7(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2210
movq %rax, %r14
leaq 0x6403(%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 0x53948(%rip), %rsi     # 0x58710
callq 0x5e44
movq 0xe0(%rbx), %rdi
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
cmpq %rdi, 0xe8(%rbx)
je 0x4e1e
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5ec6
incq %r12
movq 0xe0(%rbx), %rdi
movq 0xe8(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r14, %rax
addq $0x18, %r15
cmpq %r12, %rax
ja 0x4ded
leaq 0xf8(%rbx), %rdi
movslq 0x538e8(%rip), %rsi     # 0x58714
callq 0x5e44
movq 0xf8(%rbx), %rdi
cmpq %rdi, 0x100(%rbx)
je 0x4e78
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5ec6
incq %r12
movq 0xf8(%rbx), %rdi
movq 0x100(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r14, %rax
addq $0x18, %r15
cmpq %r12, %rax
ja 0x4e47
leaq 0x110(%rbx), %rdi
movslq 0x5388a(%rip), %rsi     # 0x58710
callq 0x5e44
movq 0x110(%rbx), %rdi
cmpq %rdi, 0x118(%rbx)
je 0x4ed2
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5ec6
incq %r12
movq 0x110(%rbx), %rdi
movq 0x118(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r14, %rax
addq $0x18, %r15
cmpq %r12, %rax
ja 0x4ea1
leaq 0x128(%rbx), %rdi
movslq 0x53834(%rip), %rsi     # 0x58714
callq 0x5e44
movq 0x128(%rbx), %rdi
cmpq %rdi, 0x130(%rbx)
je 0x4f2c
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %rdi
movslq 0x30(%rbx), %rsi
callq 0x5ec6
incq %r12
movq 0x128(%rbx), %rdi
movq 0x130(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r14, %rax
addq $0x18, %r15
cmpq %r12, %rax
ja 0x4efb
cmpl $0x0, 0x537dd(%rip)     # 0x58710
jle 0x5003
xorl %r14d, %r14d
movl 0x30(%rbx), %eax
testl %eax, %eax
jle 0x4ff0
leaq (%r14,%r14,2), %r15
xorl %r12d, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
ucomisd 0x60d3(%rip), %xmm0     # 0xb030
movsd %xmm0, 0x10(%rsp)
jb 0x4f6e
xorps %xmm4, %xmm4
sqrtsd %xmm0, %xmm4
jmp 0x4f77
callq 0x2160
movapd %xmm0, %xmm4
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x60a9(%rip), %xmm0     # 0xb030
jb 0x4f8f
sqrtsd %xmm0, %xmm0
jmp 0x4fa0
movsd %xmm4, 0x8(%rsp)
callq 0x2160
movsd 0x8(%rsp), %xmm4
movsd 0x6080(%rip), %xmm3     # 0xb028
divsd %xmm0, %xmm3
movsd 0x6064(%rip), %xmm1     # 0xb018
divsd 0x10(%rsp), %xmm1
movsd 0x605e(%rip), %xmm2     # 0xb020
divsd %xmm4, %xmm2
xorpd %xmm0, %xmm0
callq 0x28b7
movq 0xe0(%rbx), %rax
movq (%rax,%r15,8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
jl 0x4f4e
incq %r14
movslq 0x53716(%rip), %rax     # 0x58710
cmpq %rax, %r14
jl 0x4f3c
cmpl $0x0, 0x5370a(%rip)     # 0x58714
jle 0x50f0
xorl %r15d, %r15d
movl 0x30(%rbx), %eax
leaq (%r15,%r15,2), %r14
testl %eax, %eax
jle 0x50c7
xorl %r12d, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
ucomisd 0x5ffc(%rip), %xmm0     # 0xb030
movsd %xmm0, 0x10(%rsp)
jb 0x5045
xorps %xmm4, %xmm4
sqrtsd %xmm0, %xmm4
jmp 0x504e
callq 0x2160
movapd %xmm0, %xmm4
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x5fd2(%rip), %xmm0     # 0xb030
jb 0x5066
sqrtsd %xmm0, %xmm0
jmp 0x5077
movsd %xmm4, 0x8(%rsp)
callq 0x2160
movsd 0x8(%rsp), %xmm4
movsd 0x5fa9(%rip), %xmm3     # 0xb028
divsd %xmm0, %xmm3
movsd 0x5f8d(%rip), %xmm1     # 0xb018
divsd 0x10(%rsp), %xmm1
movsd 0x5f87(%rip), %xmm2     # 0xb020
divsd %xmm4, %xmm2
xorpd %xmm0, %xmm0
callq 0x28b7
movq 0xf8(%rbx), %rax
movq (%rax,%r14,8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
jl 0x5025
shlq $0x3, %r14
addq 0xf8(%rbx), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5ef8
incq %r15
movslq 0x5362d(%rip), %rax     # 0x58714
cmpq %rax, %r15
jl 0x5013
movq %rbx, %rdi
callq 0x5f84
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq