// File: KokiKishimoto[P]cp_decomposition/cp.cpp
// Function: CP::CP(Data&, int, int, double, double, double)
CP(Data& traindata, int vecDim_, int randomSeed, double learningRate, double threshold, double lambda_) : vecDim(vecDim_), lambda(lambda_) {
		op = SignalOperation();

		rnd = std::mt19937(randomSeed);
		double bnd = sqrt(6.0) / sqrt((double)vecDim * 2);
		std::uniform_real_distribution<> dist(-bnd, bnd);

		subjVec.resize(traindata.entity_counter);
		initializeModel(subjVec, traindata.entity_counter, dist);

		objVec.resize(traindata.entity_counter);
		initializeModel(objVec, traindata.entity_counter, dist);

		relationVec.resize(traindata.relation_counter);
		initializeModel(relationVec, traindata.relation_counter, dist);

		updater = Updater(learningRate, threshold);

		outVec1.resize(vecDim);
		outVec2.resize(vecDim);
		outVec3.resize(vecDim);

		norms.resize(3);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1460, %rsp           # imm = 0x1460
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x28(%rbp)
movsd %xmm2, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1418(%rbp)
callq 0x97f0
movq -0x1418(%rbp), %rdi
addq $0x8, %rdi
callq 0x9800
movq -0x1418(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x1430(%rbp)
callq 0x9810
movq -0x1418(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x1428(%rbp)
callq 0x9810
movq -0x1418(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x1420(%rbp)
callq 0x9810
movq -0x1418(%rbp), %rdi
addq $0x78, %rdi
movq %rdi, -0x1410(%rbp)
callq 0x3ec0
jmp 0x4496
movq -0x1418(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
movq %rdi, -0x1450(%rbp)
callq 0x9830
movq -0x1418(%rbp), %rdi
addq $0x1a8, %rdi            # imm = 0x1A8
movq %rdi, -0x1448(%rbp)
callq 0x9830
movq -0x1418(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movq %rdi, -0x1440(%rbp)
callq 0x9830
movq -0x1418(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
movq %rdi, -0x1438(%rbp)
callq 0x9830
movq -0x1418(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x1f8(%rdi)
movl -0x14(%rbp), %eax
movl %eax, 0x200(%rdi)
addq $0x208, %rdi            # imm = 0x208
callq 0x9850
jmp 0x4529
leaq -0x3d(%rbp), %rdi
callq 0x97f0
jmp 0x4534
movslq -0x18(%rbp), %rsi
leaq -0x13c8(%rbp), %rdi
callq 0x9870
jmp 0x4546
movq -0x1418(%rbp), %rdi
addq $0x208, %rdi            # imm = 0x208
leaq -0x13c8(%rbp), %rsi
movl $0x1388, %edx           # imm = 0x1388
callq 0x3230
movsd 0xba9b(%rip), %xmm0     # 0x10008
callq 0x3200
movq -0x1418(%rbp), %rax
movsd %xmm0, -0x1458(%rbp)
cvtsi2sdl 0x200(%rax), %xmm0
addsd %xmm0, %xmm0
callq 0x3200
movaps %xmm0, %xmm1
movsd -0x1458(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x13d0(%rbp)
movsd -0x13d0(%rbp), %xmm1
movaps %xmm1, %xmm0
movaps 0xba75(%rip), %xmm2     # 0x10030
pxor %xmm2, %xmm0
leaq -0x13e0(%rbp), %rdi
callq 0x98a0
jmp 0x45cd
movq -0x1418(%rbp), %rdi
addq $0x30, %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x98d0
jmp 0x45e6
movq -0x1418(%rbp), %rdi
movq %rdi, %rsi
addq $0x30, %rsi
movq -0x10(%rbp), %rax
movl (%rax), %edx
leaq -0x13e0(%rbp), %rcx
callq 0x9960
jmp 0x4608
movq -0x1418(%rbp), %rdi
addq $0x48, %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x98d0
jmp 0x4621
movq -0x1418(%rbp), %rdi
movq %rdi, %rsi
addq $0x48, %rsi
movq -0x10(%rbp), %rax
movl (%rax), %edx
leaq -0x13e0(%rbp), %rcx
callq 0x9960
jmp 0x4643
movq -0x1418(%rbp), %rdi
addq $0x60, %rdi
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rsi
callq 0x98d0
jmp 0x465d
movq -0x1418(%rbp), %rdi
movq %rdi, %rsi
addq $0x60, %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x13e0(%rbp), %rcx
callq 0x9960
jmp 0x4680
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
leaq -0x1408(%rbp), %rdi
callq 0x9a30
jmp 0x4698
movq -0x1418(%rbp), %rax
movq -0x13e8(%rbp), %rcx
movq %rcx, 0x28(%rax)
movups -0x1408(%rbp), %xmm0
movups -0x13f8(%rbp), %xmm1
movups %xmm1, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movq %rax, %rdi
addq $0x190, %rdi            # imm = 0x190
movslq 0x200(%rax), %rsi
callq 0x9a80
jmp 0x46d8
movq -0x1418(%rbp), %rax
movq %rax, %rdi
addq $0x1a8, %rdi            # imm = 0x1A8
movslq 0x200(%rax), %rsi
callq 0x9a80
jmp 0x46f7
movq -0x1418(%rbp), %rax
movq %rax, %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq 0x200(%rax), %rsi
callq 0x9a80
jmp 0x4716
movq -0x1418(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
movl $0x3, %esi
callq 0x9a80
jmp 0x4730
addq $0x1460, %rsp           # imm = 0x1460
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x478f
movq -0x1438(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x9b10
movq -0x1440(%rbp), %rdi
callq 0x9b10
movq -0x1448(%rbp), %rdi
callq 0x9b10
movq -0x1450(%rbp), %rdi
callq 0x9b10
movq -0x1410(%rbp), %rdi
callq 0x4fb0
movq -0x1420(%rbp), %rdi
callq 0x9b70
movq -0x1428(%rbp), %rdi
callq 0x9b70
movq -0x1430(%rbp), %rdi
callq 0x9b70
movq -0x38(%rbp), %rdi
callq 0x3440
nopl (%rax)