// File: 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:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x58(%rsp)
movl $0x64, 0x30(%rax)
movsd 0x14755(%rip), %xmm0    # 0x1a030
movsd %xmm0, 0x58(%rax)
movq 0x1f6f1(%rip), %rdi     # 0x24fd8
leaq 0x1487b(%rip), %rsi     # 0x1a169
callq 0x21f0
movq %rax, %rdi
movq 0x58(%rsp), %rax
movl 0x30(%rax), %esi
callq 0x2360
movq %rax, %rdi
movl $0x20, %esi
callq 0x2260
movq %rax, %rdi
leaq 0x14815(%rip), %rsi     # 0x1a12f
callq 0x21f0
movq %rax, %rdi
movq 0x58(%rsp), %rax
movsd 0x58(%rax), %xmm0
callq 0x23b0
movq %rax, %rdi
movq 0x1f685(%rip), %rsi     # 0x24fc0
callq 0x2240
movq 0x58(%rsp), %rdi
addq $0xe0, %rdi
movslq 0x68dfd(%rip), %rsi     # 0x6e750
callq 0xba40
movl $0x0, 0x7c(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x7c(%rsp), %rax
movq %rax, 0x50(%rsp)
addq $0xe0, %rdi
callq 0xbae0
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jae 0x59bc
movq 0x58(%rsp), %rdi
addq $0xe0, %rdi
movslq 0x7c(%rsp), %rsi
callq 0xbb00
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0xbb20
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x5960
movq 0x58(%rsp), %rdi
addq $0xf8, %rdi
movslq 0x68d85(%rip), %rsi     # 0x6e754
callq 0xba40
movl $0x0, 0x78(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x78(%rsp), %rax
movq %rax, 0x48(%rsp)
addq $0xf8, %rdi
callq 0xbae0
movq %rax, %rcx
movq 0x48(%rsp), %rax
cmpq %rcx, %rax
jae 0x5a38
movq 0x58(%rsp), %rdi
addq $0xf8, %rdi
movslq 0x78(%rsp), %rsi
callq 0xbb00
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0xbb20
movl 0x78(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x59dc
movq 0x58(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x68d05(%rip), %rsi     # 0x6e750
callq 0xba40
movl $0x0, 0x74(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x74(%rsp), %rax
movq %rax, 0x40(%rsp)
addq $0x110, %rdi            # imm = 0x110
callq 0xbae0
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jae 0x5ab4
movq 0x58(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x74(%rsp), %rsi
callq 0xbb00
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0xbb20
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x5a58
movq 0x58(%rsp), %rdi
addq $0x128, %rdi            # imm = 0x128
movslq 0x68c8d(%rip), %rsi     # 0x6e754
callq 0xba40
movl $0x0, 0x70(%rsp)
movq 0x58(%rsp), %rdi
movslq 0x70(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x128, %rdi            # imm = 0x128
callq 0xbae0
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
jae 0x5b30
movq 0x58(%rsp), %rdi
addq $0x128, %rdi            # imm = 0x128
movslq 0x70(%rsp), %rsi
callq 0xbb00
movq %rax, %rdi
movq 0x58(%rsp), %rax
movslq 0x30(%rax), %rsi
callq 0xbb20
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x70(%rsp)
jmp 0x5ad4
movl $0x0, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
cmpl 0x68c0e(%rip), %eax     # 0x6e750
jge 0x5c1d
movl $0x0, 0x68(%rsp)
movq 0x58(%rsp), %rcx
movl 0x68(%rsp), %eax
cmpl 0x30(%rcx), %eax
jge 0x5c0b
movq 0x58(%rsp), %rax
cvtsi2sdl 0x30(%rax), %xmm1
movsd 0x144ac(%rip), %xmm0    # 0x1a020
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0x30(%rax), %edi
callq 0xbbc0
movq 0x58(%rsp), %rax
movaps %xmm0, %xmm1
movsd 0x144aa(%rip), %xmm0    # 0x1a040
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movl 0x30(%rax), %edi
callq 0xbbc0
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movsd 0x1447c(%rip), %xmm3    # 0x1a038
divsd %xmm0, %xmm3
xorps %xmm0, %xmm0
callq 0x2930
movq 0x58(%rsp), %rdi
movsd %xmm0, 0x30(%rsp)
addq $0xe0, %rdi
movslq 0x6c(%rsp), %rsi
callq 0xbb00
movq %rax, %rdi
movslq 0x68(%rsp), %rsi
callq 0x4890
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x68(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68(%rsp)
jmp 0x5b50
jmp 0x5c0d
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x5b38
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0x68b25(%rip), %eax     # 0x6e754
jge 0x5d2b
movl $0x0, 0x60(%rsp)
movq 0x58(%rsp), %rcx
movl 0x60(%rsp), %eax
cmpl 0x30(%rcx), %eax
jge 0x5cf8
movq 0x58(%rsp), %rax
cvtsi2sdl 0x30(%rax), %xmm1
movsd 0x143bf(%rip), %xmm0    # 0x1a020
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x30(%rax), %edi
callq 0xbbc0
movq 0x58(%rsp), %rax
movaps %xmm0, %xmm1
movsd 0x143bd(%rip), %xmm0    # 0x1a040
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x30(%rax), %edi
callq 0xbbc0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movsd 0x1438f(%rip), %xmm3    # 0x1a038
divsd %xmm0, %xmm3
xorps %xmm0, %xmm0
callq 0x2930
movq 0x58(%rsp), %rdi
movsd %xmm0, 0x18(%rsp)
addq $0xf8, %rdi
movslq 0x64(%rsp), %rsi
callq 0xbb00
movq %rax, %rdi
movslq 0x60(%rsp), %rsi
callq 0x4890
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x60(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x60(%rsp)
jmp 0x5c3d
movq 0x58(%rsp), %rdi
addq $0xf8, %rdi
movslq 0x64(%rsp), %rsi
callq 0xbb00
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0xbbe0
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x5c25
movq 0x58(%rsp), %rdi
callq 0xbc80
addq $0x88, %rsp
retq
nopl (%rax)