// File: /workspace/github_cpp_makefile_star2_O1/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: eig(Matrix const&)
std::pair <Vector,Matrix> eig(const Matrix& A)
{
	Vector dim = size(A);
	if (dim(1) != dim(2)) {throw Exception("dimension error",
	"computing eig(), matrix supplied not square");}
	std::pair<Matrix, Matrix> qr = QR(A);
	Matrix Q = qr.first;
	Matrix R = qr.second;
	disp(Q);
	disp(R);
	Matrix Anew = R*Q;
	Matrix Atemp = Matrix(dim(1),dim(2));
	Matrix evecs = Q;
	do {
			Atemp = Anew;
			qr = QR(Anew);
			Q = qr.first;
			R = qr.second;
			Anew = R*Q;
			evecs = evecs*Q;
			disp(Q);
			disp(evecs);
		}while((std::abs(Atemp(1,1) - Anew(1,1))) > 1e-15);

	Vector evals = diag(Anew);
	std::pair<Vector,Matrix> eigs = std::make_pair(evals,evecs);
	return eigs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x6c8e
movq %r14, %rdi
movl $0x1, %esi
callq 0x3354
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movl $0x2, %esi
callq 0x3354
movsd 0x10(%rsp), %xmm0
ucomisd (%rax), %xmm0
jne 0xaf89
jp 0xaf89
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0xa37e
movq %rsp, %rdi
leaq 0x70(%rsp), %rsi
callq 0x3f5e
leaq 0x80(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3f5e
movq 0x5301(%rip), %rdi      # 0xffd0
movq %rsp, %rsi
callq 0x407a
movq 0x52f2(%rip), %rdi      # 0xffd0
leaq 0x160f(%rip), %rsi      # 0xc2f4
movl $0x1, %edx
callq 0x2120
movq 0x52da(%rip), %rdi      # 0xffd0
leaq 0x20(%rsp), %rsi
callq 0x407a
movq 0x52c9(%rip), %rdi      # 0xffd0
leaq 0x15e6(%rip), %rsi      # 0xc2f4
movl $0x1, %edx
callq 0x2120
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
callq 0x4eee
leaq 0x30(%rsp), %rdi
movl $0x1, %esi
callq 0x3354
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movl $0x2, %esi
callq 0x3354
cvttsd2si 0x10(%rsp), %esi
cvttsd2si (%rax), %edx
leaq 0x50(%rsp), %rdi
callq 0x3df8
movq %r15, 0x90(%rsp)
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f5e
leaq 0x50(%rsp), %r15
leaq 0x60(%rsp), %r12
leaq 0x98(%rsp), %r14
movq %rsp, %rbx
movq %rbx, %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x67e4
movq %r14, %rdi
movq %r12, %r13
movq %r12, %rsi
callq 0xa37e
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x67e4
leaq 0x80(%rsp), %r15
movq %r15, %rdi
leaq 0xa8(%rsp), %r12
movq %r12, %rsi
callq 0x67e4
movq %r12, %rdi
callq 0x4016
movq %r14, %rdi
callq 0x4016
movq %rbp, %rdi
movq %rbx, %rsi
movq %rbp, %rbx
callq 0x67e4
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x67e4
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x4eee
movq %r13, %r12
movq %r13, %rdi
movq %r14, %rsi
callq 0x67e4
movq %r14, %rdi
callq 0x4016
movq %r14, %rdi
leaq 0x40(%rsp), %r13
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4eee
movq 0x518d(%rip), %rbp      # 0xffd0
movq %r13, %rdi
movq %r14, %rsi
callq 0x67e4
movq %r14, %rdi
callq 0x4016
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x407a
leaq 0x50(%rsp), %r15
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x147f(%rip), %rsi      # 0xc2f4
callq 0x2120
movq %rbp, %rdi
movq %r13, %rsi
callq 0x407a
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x1460(%rip), %rsi      # 0xc2f4
callq 0x2120
movq %r15, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x51ec
movsd (%rax), %xmm0
movapd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x51ec
movapd 0x10(%rsp), %xmm0
subsd (%rax), %xmm0
andpd 0x1177(%rip), %xmm0     # 0xc050
ucomisd 0x141f(%rip), %xmm0     # 0xc300
ja 0xad90
leaq 0x98(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x6eb4
leaq 0x98(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0xb160
leaq 0x98(%rsp), %rdi
callq 0x2970
leaq 0x40(%rsp), %rdi
callq 0x4016
leaq 0x50(%rsp), %rdi
callq 0x4016
leaq 0x60(%rsp), %rdi
callq 0x4016
leaq 0x20(%rsp), %rdi
callq 0x4016
movq %rsp, %rdi
callq 0x4016
leaq 0x80(%rsp), %rdi
callq 0x4016
leaq 0x70(%rsp), %rdi
callq 0x4016
leaq 0x30(%rsp), %rdi
callq 0x2970
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x40, %edi
callq 0x2070
movq %rax, %r14
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x16b1(%rip), %rsi      # 0xc65a
leaq 0x16b9(%rip), %rdx      # 0xc669
leaq 0xd8(%rsp), %rdi
callq 0x3c6e
leaq 0xc8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1699(%rip), %rsi      # 0xc66a
leaq 0x16bd(%rip), %rdx      # 0xc695
leaq 0xb8(%rsp), %rdi
callq 0x3c6e
movb $0x1, %bpl
leaq 0xd8(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
movq %r14, %rdi
callq 0x3d00
xorl %ebp, %ebp
leaq 0x4d8f(%rip), %rsi      # 0xfd98
leaq -0x73cc(%rip), %rdx     # 0x3c44
movq %r14, %rdi
callq 0x2190
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
je 0xb035
callq 0x2110
jmp 0xb035
movq %rax, %rbx
movb $0x1, %bpl
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0xb04f
callq 0x2110
jmp 0xb04f
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0xb0eb
movq %r14, %rdi
callq 0x20c0
jmp 0xb0eb
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x2970
jmp 0xb0a4
jmp 0xb0a1
movq %rax, %rbx
jmp 0xb0ae
jmp 0xb096
movq %rax, %rbx
jmp 0xb0cc
movq %rax, %rbx
jmp 0xb0d4
jmp 0xb08c
movq %rax, %rbx
jmp 0xb0eb
movq %rax, %rbx
jmp 0xb0b8
movq %rax, %rbx
jmp 0xb0c2
jmp 0xb0a1
jmp 0xb0a1
jmp 0xb0a1
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4016
leaq 0x50(%rsp), %rdi
callq 0x4016
leaq 0x60(%rsp), %rdi
callq 0x4016
leaq 0x20(%rsp), %rdi
callq 0x4016
movq %rsp, %rdi
callq 0x4016
leaq 0x80(%rsp), %rdi
callq 0x4016
leaq 0x70(%rsp), %rdi
callq 0x4016
leaq 0x30(%rsp), %rdi
callq 0x2970
movq %rbx, %rdi
callq 0x21c0
nop