// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: hess(Matrix const&)
Matrix hess(const Matrix& A)
{

	int n = A.mRows;
	Matrix Ahes = A;
	disp(A);
	Vector u = Ahes.getElements(2,n,1,1,"Vector");
	std::cout<< "u=\n"<< u <<"\n";
	Vector v(length(u));
	v(1) = norm(u,2);
	std::cout<< "v=\n"<< v <<"\n";
	Vector w = u-v;
	Matrix H = eye(n);
	Matrix K = eye(n-1);
	if (norm(w)>1e-14)
	{
		Matrix temp = outer(w,w);
		K = K - (2/(w*w))*temp;
	}
	std::cout<< "H=\n"<< H <<"\n";
	H.setElements(2,n,2,n,K);
	disp(H);
	Ahes = H*Ahes*H;
	disp(Ahes);
	for (int i=2;i<n-1;i++)
	{
		Matrix B = Ahes.getElements(i,n,i, n);
		Vector u2 = B.getElements(2,B.mRows,1,1,"Vector");
		std::cout<< "B=\n"<< B <<"\n";
		std::cout<< "u2=\n"<< u2 <<"\n";
		Vector v2(length(u2));
		v2(1) = norm(u2,2);;
		std::cout<< "v2=\n"<< v2 <<"\n";
		Vector w2 = u2-v2;
		std::cout<<"w2=\n" << w2<<"\n";
		Matrix Hhat = eye(B.mRows-1);
		if (norm(w2)>1e-14)
		{
		Matrix temp2 = outer(w2,w2);
		std::cout<< temp2 <<"\n\n";
		Hhat = Hhat - (2/(w2*w2))*temp2;
		}
		std::cout<< "Hhat=\n"<< Hhat <<"\n\n";
		Matrix H2 = eye(n);
		H2.setElements(i+1,n,i+1,n,Hhat);
		std::cout<< "H2=\n"<< H2 <<"\n\n";
		Ahes = H2*Ahes*H2;
	}

	for (int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				if (std::abs(Ahes(i,j)) < 1e-12)
					Ahes(i,j) = 0;
			}
		}
	return Ahes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r15
movq %rdi, %rbx
movl 0x8(%rsi), %r14d
callq 0x29b2
movq %r15, %rdi
callq 0x2b73
leaq 0x1eb0(%rip), %rsi      # 0x95be
leaq 0x178(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x1060
leaq 0x90(%rsp), %rdi
pushq $0x2
popq %rdx
pushq $0x1
popq %r8
movq %rbx, %rsi
movl %r14d, %ecx
movl %r8d, %r9d
callq 0x2d9e
leaq 0x178(%rsp), %rdi
callq 0x1070
movq 0x687c(%rip), %rdi      # 0xdfd0
leaq 0x1eac(%rip), %rsi      # 0x9607
callq 0x10e0
leaq 0x90(%rsp), %rsi
movq %rax, %rdi
callq 0x2035
leaq 0x1b53(%rip), %rsi      # 0x92ca
movq %rax, %rdi
callq 0x10e0
leaq 0x90(%rsp), %rdi
callq 0x2141
leaq 0x80(%rsp), %rdi
movl %eax, %esi
callq 0x186c
leaq 0x90(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x20c8
movsd %xmm0, 0x20(%rsp)
leaq 0x80(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x2030
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x67fe(%rip), %rdi      # 0xdfd0
leaq 0x1e32(%rip), %rsi      # 0x960b
callq 0x10e0
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x2035
leaq 0x1ad5(%rip), %rsi      # 0x92ca
movq %rax, %rdi
callq 0x10e0
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x1a3c
leaq 0x58(%rsp), %rdi
movl %r14d, %esi
callq 0x50c7
leal -0x1(%r14), %esi
leaq 0xb0(%rsp), %rdi
movl %esi, 0x6c(%rsp)
callq 0x50c7
leaq 0x70(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x20c8
ucomisd 0x1a92(%rip), %xmm0     # 0x92e0
jbe 0x7920
leaq 0x108(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x18bc
leaq 0xf8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x18bc
leaq 0x28(%rsp), %rdi
leaq 0x108(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x4d38
leaq 0xf8(%rsp), %rdi
callq 0x1908
leaq 0x108(%rsp), %rdi
callq 0x1908
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
callq 0x1b63
movsd 0x1a2f(%rip), %xmm1     # 0x92f0
divsd %xmm0, %xmm1
leaq 0x38(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movapd %xmm1, %xmm0
callq 0x36ec
leaq 0x10(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x3642
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x4c1c
movq %r15, %rdi
callq 0x2a78
leaq 0x38(%rsp), %rdi
callq 0x2a78
leaq 0x28(%rsp), %rdi
callq 0x2a78
movq 0x66a9(%rip), %rdi      # 0xdfd0
leaq 0x1ce1(%rip), %rsi      # 0x960f
callq 0x10e0
movq %rax, %r15
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x2ad5
leaq 0x1980(%rip), %rsi      # 0x92ca
movq %r15, %rdi
callq 0x10e0
leaq 0xe8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x29b2
leaq 0x58(%rsp), %rdi
pushq $0x2
popq %rcx
leaq 0xe8(%rsp), %r9
movl %ecx, %esi
movl %r14d, %edx
movl %r14d, %r8d
callq 0x30c2
leaq 0xe8(%rsp), %rdi
callq 0x2a78
leaq 0x58(%rsp), %rdi
callq 0x2b73
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq 0x376b
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x376b
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4c1c
movq %r15, %rdi
callq 0x2a78
leaq 0x10(%rsp), %rdi
callq 0x2a78
movq %rbx, %rdi
callq 0x2b73
movq 0x65de(%rip), %r12      # 0xdfd0
pushq $0x2
popq %r15
movl %r15d, 0x20(%rsp)
movl 0x20(%rsp), %edx
cmpl 0x6c(%rsp), %edx
jge 0x7de5
leaq 0xc0(%rsp), %rbp
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl %r14d, %ecx
movl %edx, %r8d
movl %r14d, %r9d
callq 0x2b96
movl 0x30(%rsp), %r13d
leaq 0x158(%rsp), %rdi
leaq 0x1b83(%rip), %rsi      # 0x95be
leaq 0x38(%rsp), %rdx
callq 0x1060
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rdx
movl %r13d, %ecx
pushq $0x1
popq %r8
movl %r8d, %r9d
callq 0x2d9e
leaq 0x158(%rsp), %rdi
callq 0x1070
movq %r12, %rdi
leaq 0x1b9b(%rip), %rsi      # 0x9613
callq 0x10e0
movq %rax, %r12
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x2ad5
movq %r12, %rdi
leaq 0x1833(%rip), %rsi      # 0x92ca
callq 0x10e0
movq 0x652d(%rip), %rdi      # 0xdfd0
leaq 0x1b6d(%rip), %rsi      # 0x9617
callq 0x10e0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2035
movq %rax, %rdi
leaq 0x1804(%rip), %rsi      # 0x92ca
callq 0x10e0
leaq 0x10(%rsp), %rdi
callq 0x2141
leaq 0x38(%rsp), %rdi
movl %eax, %esi
callq 0x186c
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x20c8
movsd %xmm0, 0xd0(%rsp)
movq 0x64d2(%rip), %r12      # 0xdfd0
leaq 0x38(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x2030
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, (%rax)
movq %r12, %rdi
leaq 0x1afa(%rip), %rsi      # 0x961c
callq 0x10e0
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x2035
movq %rax, %rdi
leaq 0x178c(%rip), %rsi      # 0x92ca
callq 0x10e0
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x1a3c
movq %r12, %rdi
leaq 0x1ac2(%rip), %rsi      # 0x9621
callq 0x10e0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2035
movq %rax, %rdi
leaq 0x1751(%rip), %rsi      # 0x92ca
callq 0x10e0
decl %r13d
leaq 0xa0(%rsp), %rdi
movl %r13d, %esi
callq 0x50c7
movq %rbp, %rdi
pushq $0x2
popq %rsi
callq 0x20c8
ucomisd 0x173c(%rip), %xmm0     # 0x92e0
movq 0x6425(%rip), %r13      # 0xdfd0
jbe 0x7c99
leaq 0x128(%rsp), %rdi
leaq 0xc0(%rsp), %r12
movq %r12, %rsi
callq 0x18bc
leaq 0x148(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x18bc
leaq 0x48(%rsp), %r12
movq %r12, %rdi
leaq 0x128(%rsp), %rbp
movq %rbp, %rsi
movq %r15, %rdx
callq 0x4d38
movq %r15, %rdi
callq 0x1908
movq %rbp, %rdi
callq 0x1908
movq %r13, %rdi
movq %r12, %rsi
callq 0x2ad5
movq %r13, %rdi
leaq 0x16ad(%rip), %rsi      # 0x92c9
callq 0x10e0
leaq 0xc0(%rsp), %rdi
movq %rdi, %rsi
callq 0x1b63
leaq 0xd8(%rsp), %r15
movsd 0x16af(%rip), %xmm1     # 0x92f0
divsd %xmm0, %xmm1
movq %r15, %rdi
movapd %xmm1, %xmm0
leaq 0x48(%rsp), %rsi
callq 0x36ec
leaq 0x138(%rsp), %r12
movq %r12, %rdi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rsi
movq %r15, %rdx
callq 0x3642
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4c1c
movq %r12, %rdi
callq 0x2a78
movq %r15, %rdi
callq 0x2a78
leaq 0x48(%rsp), %rdi
callq 0x2a78
movq %r13, %rdi
leaq 0x1983(%rip), %rsi      # 0x9626
callq 0x10e0
movq %rax, %r12
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x2ad5
movq %r12, %rdi
leaq 0x1604(%rip), %rsi      # 0x92c9
callq 0x10e0
leaq 0x48(%rsp), %rdi
movl %r14d, %esi
callq 0x50c7
leaq 0x118(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x29b2
movl 0x20(%rsp), %ecx
incl %ecx
leaq 0x48(%rsp), %rdi
movl %ecx, %esi
movl %r14d, %edx
movl %ecx, 0x20(%rsp)
movl %r14d, %r8d
leaq 0x118(%rsp), %r15
movq %r15, %r9
callq 0x30c2
movq %r15, %rdi
callq 0x2a78
movq 0x62ae(%rip), %rdi      # 0xdfd0
leaq 0x1904(%rip), %rsi      # 0x962d
callq 0x10e0
movq %rax, %r12
movq %rax, %rdi
leaq 0x48(%rsp), %rsi
callq 0x2ad5
movq %r12, %rdi
leaq 0x1581(%rip), %rsi      # 0x92c9
callq 0x10e0
leaq 0xd8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x48(%rsp), %r15
movq %r15, %rsi
movq %rbx, %rdx
callq 0x376b
leaq 0x138(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x376b
movq 0x624b(%rip), %r12      # 0xdfd0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4c1c
movq %r13, %rdi
callq 0x2a78
movq %rbp, %rdi
callq 0x2a78
movq %r15, %rdi
callq 0x2a78
leaq 0xa0(%rsp), %rdi
callq 0x2a78
leaq 0xc0(%rsp), %rdi
callq 0x1908
leaq 0x38(%rsp), %rdi
callq 0x1908
leaq 0x10(%rsp), %rdi
callq 0x1908
leaq 0x28(%rsp), %rdi
callq 0x2a78
jmp 0x79fb
xorl %r12d, %r12d
testl %r14d, %r14d
cmovgl %r14d, %r12d
incl %r12d
negl %r14d
pushq $0x1
popq %rbp
cmpl %r12d, %ebp
je 0x7e4d
pushq $0x1
popq %rax
movl %eax, %r15d
leal (%r14,%r15), %eax
cmpl $0x1, %eax
je 0x7e49
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3a1a
movsd (%rax), %xmm0
andpd 0x122b(%rip), %xmm0     # 0x9050
movsd 0x14cb(%rip), %xmm1     # 0x92f8
ucomisd %xmm0, %xmm1
jbe 0x7e44
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3a1a
andq $0x0, (%rax)
incl %r15d
jmp 0x7e03
incl %ebp
jmp 0x7df8
leaq 0xb0(%rsp), %rdi
callq 0x2a78
leaq 0x58(%rsp), %rdi
callq 0x2a78
leaq 0x70(%rsp), %rdi
callq 0x1908
leaq 0x80(%rsp), %rdi
callq 0x1908
leaq 0x90(%rsp), %rdi
callq 0x1908
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x2a78
jmp 0x8007
movq %rax, %r14
leaq 0xf8(%rsp), %rdi
callq 0x1908
jmp 0x7ec4
movq %rax, %r14
leaq 0x108(%rsp), %rdi
callq 0x1908
jmp 0x8016
jmp 0x8013
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x800c
jmp 0x8013
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
jmp 0x800c
jmp 0x7fb1
movq %rax, %r14
jmp 0x8023
movq %rax, %r14
jmp 0x802d
jmp 0x7f3d
movq %rax, %r14
leaq 0x178(%rsp), %rdi
callq 0x1070
jmp 0x8051
jmp 0x7f2b
movq %rax, %r14
jmp 0x8051
jmp 0x7f35
movq %rax, %r14
jmp 0x8044
movq %rax, %r14
jmp 0x8037
jmp 0x8013
movq %rax, %r14
jmp 0x7f61
jmp 0x7f85
movq %rax, %r14
leaq 0x148(%rsp), %rdi
callq 0x1908
leaq 0x128(%rsp), %rdi
callq 0x1908
jmp 0x7fcf
jmp 0x7fcc
jmp 0x7fb8
movq %rax, %r14
leaq 0x118(%rsp), %rdi
jmp 0x7f90
jmp 0x7fcc
jmp 0x7fbd
movq %rax, %r14
leaq 0xd8(%rsp), %rdi
callq 0x2a78
jmp 0x7fc0
jmp 0x7fbd
jmp 0x7fbd
movq %rax, %r14
leaq 0x158(%rsp), %rdi
callq 0x1070
jmp 0x8007
jmp 0x8013
jmp 0x7feb
movq %rax, %r14
jmp 0x8007
jmp 0x7ffa
movq %rax, %r14
jmp 0x7fdc
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x2a78
jmp 0x7fcf
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x2a78
leaq 0xc0(%rsp), %rdi
callq 0x1908
jmp 0x7fee
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x1908
jmp 0x7ffd
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x1908
leaq 0x28(%rsp), %rdi
callq 0x2a78
jmp 0x8016
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x2a78
leaq 0x58(%rsp), %rdi
callq 0x2a78
leaq 0x70(%rsp), %rdi
callq 0x1908
leaq 0x80(%rsp), %rdi
callq 0x1908
leaq 0x90(%rsp), %rdi
callq 0x1908
movq %rbx, %rdi
callq 0x2a78
movq %r14, %rdi
callq 0x1180