// File: KokiKishimoto[P]cp_decomposition/quantizedcp.cpp
// Function: QuantizeCP::QuantizeCP(Data&, int, int, double, double)
QuantizeCP(Data& traindata, int vecDim_, int randomSeed, double learningRate, double threshold) : vecDim(vecDim_){
		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);
		for (int i = 0; i < traindata.entity_counter; i++) {
			subjVec[i].resize(vecDim);
			for (int j = 0; j < vecDim; j++) {
				subjVec[i][j] = dist(rnd);
			}
		}

		objVec.resize(traindata.entity_counter);
		for (int i = 0; i < traindata.entity_counter; i++) {
			objVec[i].resize(vecDim);
			for (int j = 0; j < vecDim; j++) {
				objVec[i][j] = dist(rnd);
			}
		}

		relationVec.resize(traindata.relation_counter);
		for (int i = 0; i < traindata.relation_counter; i++) {
			relationVec[i].resize(vecDim);
			for (int j = 0; j < vecDim; j++) {
				relationVec[i][j] = dist(rnd);
			}
		}

		updater = Updater(learningRate, threshold);

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

		norms.resize(3);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1480, %rsp           # imm = 0x1480
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1428(%rbp)
callq 0x9890
movq -0x1428(%rbp), %rdi
addq $0x8, %rdi
callq 0x98a0
movq -0x1428(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x1440(%rbp)
callq 0x98b0
movq -0x1428(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x1438(%rbp)
callq 0x98b0
movq -0x1428(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x1430(%rbp)
callq 0x98b0
movq -0x1428(%rbp), %rdi
addq $0x78, %rdi
movq %rdi, -0x1420(%rbp)
callq 0x3d10
jmp 0x42e1
movq -0x1428(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
movq %rdi, -0x1460(%rbp)
callq 0x98d0
movq -0x1428(%rbp), %rdi
addq $0x1a8, %rdi            # imm = 0x1A8
movq %rdi, -0x1458(%rbp)
callq 0x98d0
movq -0x1428(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movq %rdi, -0x1450(%rbp)
callq 0x98d0
movq -0x1428(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
movq %rdi, -0x1448(%rbp)
callq 0x98d0
movq -0x1428(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, 0x1f8(%rdi)
addq $0x200, %rdi            # imm = 0x200
callq 0x98f0
jmp 0x4367
leaq -0x35(%rbp), %rdi
callq 0x9890
jmp 0x4372
movslq -0x18(%rbp), %rsi
leaq -0x13c0(%rbp), %rdi
callq 0x9910
jmp 0x4384
movq -0x1428(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq -0x13c0(%rbp), %rsi
movl $0x1388, %edx           # imm = 0x1388
callq 0x3230
movsd 0xbc5d(%rip), %xmm0     # 0x10008
callq 0x3200
movq -0x1428(%rbp), %rax
movsd %xmm0, -0x1468(%rbp)
cvtsi2sdl 0x1f8(%rax), %xmm0
addsd %xmm0, %xmm0
callq 0x3200
movaps %xmm0, %xmm1
movsd -0x1468(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x13c8(%rbp)
movsd -0x13c8(%rbp), %xmm1
movaps %xmm1, %xmm0
movaps 0xbc47(%rip), %xmm2     # 0x10040
pxor %xmm2, %xmm0
leaq -0x13d8(%rbp), %rdi
callq 0x9940
jmp 0x440b
movq -0x1428(%rbp), %rdi
addq $0x30, %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x9970
jmp 0x4424
movl $0x0, -0x13dc(%rbp)
movl -0x13dc(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x456d
movq -0x1428(%rbp), %rdi
addq $0x30, %rdi
movslq -0x13dc(%rbp), %rsi
callq 0x9a00
movq %rax, %rdi
movq -0x1428(%rbp), %rax
movslq 0x1f8(%rax), %rsi
callq 0x9a20
jmp 0x446f
movl $0x0, -0x13e0(%rbp)
movq -0x1428(%rbp), %rcx
movl -0x13e0(%rbp), %eax
cmpl 0x1f8(%rcx), %eax
jge 0x4557
movq -0x1428(%rbp), %rsi
addq $0x200, %rsi            # imm = 0x200
leaq -0x13d8(%rbp), %rdi
callq 0x9ab0
movsd %xmm0, -0x1470(%rbp)
jmp 0x44b6
movq -0x1428(%rbp), %rdi
addq $0x30, %rdi
movslq -0x13dc(%rbp), %rsi
callq 0x9a00
movq %rax, %rdi
movslq -0x13e0(%rbp), %rsi
callq 0x9ae0
movsd -0x1470(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x13e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13e0(%rbp)
jmp 0x4479
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4828
movq -0x1448(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x9b50
movq -0x1450(%rbp), %rdi
callq 0x9b50
movq -0x1458(%rbp), %rdi
callq 0x9b50
movq -0x1460(%rbp), %rdi
callq 0x9b50
movq -0x1420(%rbp), %rdi
callq 0x5050
jmp 0x4828
jmp 0x4559
movl -0x13dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13dc(%rbp)
jmp 0x442e
movq -0x1428(%rbp), %rdi
addq $0x48, %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x9970
jmp 0x4586
movl $0x0, -0x13e4(%rbp)
movl -0x13e4(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x466d
movq -0x1428(%rbp), %rdi
addq $0x48, %rdi
movslq -0x13e4(%rbp), %rsi
callq 0x9a00
movq %rax, %rdi
movq -0x1428(%rbp), %rax
movslq 0x1f8(%rax), %rsi
callq 0x9a20
jmp 0x45d1
movl $0x0, -0x13e8(%rbp)
movq -0x1428(%rbp), %rcx
movl -0x13e8(%rbp), %eax
cmpl 0x1f8(%rcx), %eax
jge 0x4657
movq -0x1428(%rbp), %rsi
addq $0x200, %rsi            # imm = 0x200
leaq -0x13d8(%rbp), %rdi
callq 0x9ab0
movsd %xmm0, -0x1478(%rbp)
jmp 0x4614
movq -0x1428(%rbp), %rdi
addq $0x48, %rdi
movslq -0x13e4(%rbp), %rsi
callq 0x9a00
movq %rax, %rdi
movslq -0x13e8(%rbp), %rsi
callq 0x9ae0
movsd -0x1478(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x13e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13e8(%rbp)
jmp 0x45db
jmp 0x4659
movl -0x13e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13e4(%rbp)
jmp 0x4590
movq -0x1428(%rbp), %rdi
addq $0x60, %rdi
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rsi
callq 0x9970
jmp 0x4687
movl $0x0, -0x13ec(%rbp)
movl -0x13ec(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x476f
movq -0x1428(%rbp), %rdi
addq $0x60, %rdi
movslq -0x13ec(%rbp), %rsi
callq 0x9a00
movq %rax, %rdi
movq -0x1428(%rbp), %rax
movslq 0x1f8(%rax), %rsi
callq 0x9a20
jmp 0x46d3
movl $0x0, -0x13f0(%rbp)
movq -0x1428(%rbp), %rcx
movl -0x13f0(%rbp), %eax
cmpl 0x1f8(%rcx), %eax
jge 0x4759
movq -0x1428(%rbp), %rsi
addq $0x200, %rsi            # imm = 0x200
leaq -0x13d8(%rbp), %rdi
callq 0x9ab0
movsd %xmm0, -0x1480(%rbp)
jmp 0x4716
movq -0x1428(%rbp), %rdi
addq $0x60, %rdi
movslq -0x13ec(%rbp), %rsi
callq 0x9a00
movq %rax, %rdi
movslq -0x13f0(%rbp), %rsi
callq 0x9ae0
movsd -0x1480(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x13f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13f0(%rbp)
jmp 0x46dd
jmp 0x475b
movl -0x13ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13ec(%rbp)
jmp 0x4691
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
leaq -0x1418(%rbp), %rdi
callq 0x9b00
jmp 0x4787
movq -0x1428(%rbp), %rax
movq -0x13f8(%rbp), %rcx
movq %rcx, 0x28(%rax)
movups -0x1418(%rbp), %xmm0
movups -0x1408(%rbp), %xmm1
movups %xmm1, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movq %rax, %rdi
addq $0x190, %rdi            # imm = 0x190
movslq 0x1f8(%rax), %rsi
callq 0x9a20
jmp 0x47c7
movq -0x1428(%rbp), %rax
movq %rax, %rdi
addq $0x1a8, %rdi            # imm = 0x1A8
movslq 0x1f8(%rax), %rsi
callq 0x9a20
jmp 0x47e6
movq -0x1428(%rbp), %rax
movq %rax, %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq 0x1f8(%rax), %rsi
callq 0x9a20
jmp 0x4805
movq -0x1428(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
movl $0x3, %esi
callq 0x9a20
jmp 0x481f
addq $0x1480, %rsp           # imm = 0x1480
popq %rbp
retq
movq -0x1430(%rbp), %rdi
callq 0x9bb0
movq -0x1438(%rbp), %rdi
callq 0x9bb0
movq -0x1440(%rbp), %rdi
callq 0x9bb0
movq -0x30(%rbp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)
nop