// File: /workspace/github_cpp_makefile_star2_O3/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 0x6cbd
movq %r14, %rdi
movl $0x1, %esi
callq 0x3330
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movl $0x2, %esi
callq 0x3330
movsd 0x10(%rsp), %xmm0
ucomisd (%rax), %xmm0
jne 0xaf3e
jp 0xaf3e
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0xa333
movq %rsp, %rdi
leaq 0x70(%rsp), %rsi
callq 0x3f2a
leaq 0x80(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3f2a
movq 0x534c(%rip), %rdi      # 0xffd0
movq %rsp, %rsi
callq 0x4049
movq 0x533d(%rip), %rdi      # 0xffd0
leaq 0x165a(%rip), %rsi      # 0xc2f4
movl $0x1, %edx
callq 0x2110
movq 0x5325(%rip), %rdi      # 0xffd0
leaq 0x20(%rsp), %rsi
callq 0x4049
movq 0x5314(%rip), %rdi      # 0xffd0
leaq 0x1631(%rip), %rsi      # 0xc2f4
movl $0x1, %edx
callq 0x2110
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
callq 0x4ef7
leaq 0x30(%rsp), %rdi
movl $0x1, %esi
callq 0x3330
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movl $0x2, %esi
callq 0x3330
cvttsd2si 0x10(%rsp), %esi
cvttsd2si (%rax), %edx
leaq 0x50(%rsp), %rdi
callq 0x3dd4
movq %r15, 0x90(%rsp)
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f2a
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 0x681a
movq %r14, %rdi
movq %r12, %r13
movq %r12, %rsi
callq 0xa333
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x681a
leaq 0x80(%rsp), %r15
movq %r15, %rdi
leaq 0xa8(%rsp), %r12
movq %r12, %rsi
callq 0x681a
movq %r12, %rdi
callq 0x3fe2
movq %r14, %rdi
callq 0x3fe2
movq %rbp, %rdi
movq %rbx, %rsi
movq %rbp, %rbx
callq 0x681a
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x681a
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x4ef7
movq %r13, %r12
movq %r13, %rdi
movq %r14, %rsi
callq 0x681a
movq %r14, %rdi
callq 0x3fe2
movq %r14, %rdi
leaq 0x40(%rsp), %r13
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4ef7
movq 0x51d8(%rip), %rbp      # 0xffd0
movq %r13, %rdi
movq %r14, %rsi
callq 0x681a
movq %r14, %rdi
callq 0x3fe2
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4049
leaq 0x50(%rsp), %r15
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x14ca(%rip), %rsi      # 0xc2f4
callq 0x2110
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4049
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x14ab(%rip), %rsi      # 0xc2f4
callq 0x2110
movq %r15, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x5202
movsd (%rax), %xmm0
movapd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x5202
movapd 0x10(%rsp), %xmm0
subsd (%rax), %xmm0
andpd 0x11c2(%rip), %xmm0     # 0xc050
ucomisd 0x146a(%rip), %xmm0     # 0xc300
ja 0xad45
leaq 0x98(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x6ee3
leaq 0x98(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0xb120
leaq 0x98(%rsp), %rdi
callq 0x294e
leaq 0x40(%rsp), %rdi
callq 0x3fe2
leaq 0x50(%rsp), %rdi
callq 0x3fe2
leaq 0x60(%rsp), %rdi
callq 0x3fe2
leaq 0x20(%rsp), %rdi
callq 0x3fe2
movq %rsp, %rdi
callq 0x3fe2
leaq 0x80(%rsp), %rdi
callq 0x3fe2
leaq 0x70(%rsp), %rdi
callq 0x3fe2
leaq 0x30(%rsp), %rdi
callq 0x294e
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 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x16fc(%rip), %rsi      # 0xc65a
leaq 0x1704(%rip), %rdx      # 0xc669
leaq 0xb8(%rsp), %rdi
callq 0x3c44
leaq 0xe8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x16e4(%rip), %rsi      # 0xc66a
leaq 0x1708(%rip), %rdx      # 0xc695
leaq 0xd8(%rsp), %rdi
callq 0x3c44
movb $0x1, %bpl
leaq 0xb8(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %r14, %rdi
callq 0x3cdc
xorl %ebp, %ebp
leaq 0x4dda(%rip), %rsi      # 0xfd98
leaq -0x73ab(%rip), %rdx     # 0x3c1a
movq %r14, %rdi
callq 0x2180
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0xafe2
callq 0x2100
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0xaff4
callq 0x2100
testb %bpl, %bpl
jne 0xb018
jmp 0xb0ab
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0xb018
callq 0x2100
jmp 0xb018
movq %rax, %rbx
movq %r14, %rdi
callq 0x20c0
jmp 0xb0ab
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x294e
jmp 0xb064
jmp 0xb061
movq %rax, %rbx
jmp 0xb06e
jmp 0xb056
movq %rax, %rbx
jmp 0xb08c
movq %rax, %rbx
jmp 0xb094
jmp 0xb04c
movq %rax, %rbx
jmp 0xb0ab
movq %rax, %rbx
jmp 0xb078
movq %rax, %rbx
jmp 0xb082
jmp 0xb061
jmp 0xb061
jmp 0xb061
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3fe2
leaq 0x50(%rsp), %rdi
callq 0x3fe2
leaq 0x60(%rsp), %rdi
callq 0x3fe2
leaq 0x20(%rsp), %rdi
callq 0x3fe2
movq %rsp, %rdi
callq 0x3fe2
leaq 0x80(%rsp), %rdi
callq 0x3fe2
leaq 0x70(%rsp), %rdi
callq 0x3fe2
leaq 0x30(%rsp), %rdi
callq 0x294e
movq %rbx, %rdi
callq 0x21b0
nop