// File: canzarlab[P]Trajan/./Eigen/src/LU/FullPivLU.h
// Function: Eigen::FullPivLU<Eigen::Matrix<double, -1, -1, 0, -1, -1>>::computeInPlace()
void FullPivLU<MatrixType>::computeInPlace()
{
  check_template_parameters();

  // the permutations are stored as int indices, so just to be sure:
  eigen_assert(m_lu.rows()<=NumTraits<int>::highest() && m_lu.cols()<=NumTraits<int>::highest());

  m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();

  const Index size = m_lu.diagonalSize();
  const Index rows = m_lu.rows();
  const Index cols = m_lu.cols();

  // will store the transpositions, before we accumulate them at the end.
  // can't accumulate on-the-fly because that will be done in reverse order for the rows.
  m_rowsTranspositions.resize(m_lu.rows());
  m_colsTranspositions.resize(m_lu.cols());
  Index number_of_transpositions = 0; // number of NONTRIVIAL transpositions, i.e. m_rowsTranspositions[i]!=i

  m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
  m_maxpivot = RealScalar(0);

  for(Index k = 0; k < size; ++k)
  {
    // First, we need to find the pivot.

    // biggest coefficient in the remaining bottom-right corner (starting at row k, col k)
    Index row_of_biggest_in_corner, col_of_biggest_in_corner;
    typedef internal::scalar_score_coeff_op<Scalar> Scoring;
    typedef typename Scoring::result_type Score;
    Score biggest_in_corner;
    biggest_in_corner = m_lu.bottomRightCorner(rows-k, cols-k)
                        .unaryExpr(Scoring())
                        .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
    row_of_biggest_in_corner += k; // correct the values! since they were computed in the corner,
    col_of_biggest_in_corner += k; // need to add k to them.

    if(biggest_in_corner==Score(0))
    {
      // before exiting, make sure to initialize the still uninitialized transpositions
      // in a sane state without destroying what we already have.
      m_nonzero_pivots = k;
      for(Index i = k; i < size; ++i)
      {
        m_rowsTranspositions.coeffRef(i) = i;
        m_colsTranspositions.coeffRef(i) = i;
      }
      break;
    }

    RealScalar abs_pivot = internal::abs_knowing_score<Scalar>()(m_lu(row_of_biggest_in_corner, col_of_biggest_in_corner), biggest_in_corner);
    if(abs_pivot > m_maxpivot) m_maxpivot = abs_pivot;

    // Now that we've found the pivot, we need to apply the row/col swaps to
    // bring it to the location (k,k).

    m_rowsTranspositions.coeffRef(k) = row_of_biggest_in_corner;
    m_colsTranspositions.coeffRef(k) = col_of_biggest_in_corner;
    if(k != row_of_biggest_in_corner) {
      m_lu.row(k).swap(m_lu.row(row_of_biggest_in_corner));
      ++number_of_transpositions;
    }
    if(k != col_of_biggest_in_corner) {
      m_lu.col(k).swap(m_lu.col(col_of_biggest_in_corner));
      ++number_of_transpositions;
    }

    // Now that the pivot is at the right location, we update the remaining
    // bottom-right corner by Gaussian elimination.

    if(k<rows-1)
      m_lu.col(k).tail(rows-k-1) /= m_lu.coeff(k,k);
    if(k<size-1)
      m_lu.block(k+1,k+1,rows-k-1,cols-k-1).noalias() -= m_lu.col(k).tail(rows-k-1) * m_lu.row(k).tail(cols-k-1);
  }

  // the main loop is over, we still have to accumulate the transpositions to find the
  // permutations P and Q

  m_p.setIdentity(rows);
  for(Index k = size-1; k >= 0; --k)
    m_p.applyTranspositionOnTheRight(k, m_rowsTranspositions.coeff(k));

  m_q.setIdentity(cols);
  for(Index k = 0; k < size; ++k)
    m_q.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k));

  m_det_pq = (number_of_transpositions%2) ? -1 : 1;

  m_isInitialized = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x580, %rsp            # imm = 0x580
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x518(%rbp)
callq 0x47440
movq -0x518(%rbp), %rdi
callq 0x26850
movq %rax, -0x510(%rbp)
callq 0x47450
movq -0x510(%rbp), %rcx
movslq %eax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x501(%rbp)
jg 0x4677e
movq -0x518(%rbp), %rdi
callq 0x26800
movq %rax, -0x520(%rbp)
callq 0x47450
movl %eax, %ecx
movq -0x520(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
setle %al
movb %al, -0x501(%rbp)
movb -0x501(%rbp), %al
testb $0x1, %al
jne 0x4678a
jmp 0x4678c
jmp 0x467ab
leaq 0xccaa9(%rip), %rdi     # 0x11323c
leaq 0xccaf3(%rip), %rsi     # 0x11328d
movl $0x1ef, %edx            # imm = 0x1EF
leaq 0xccb02(%rip), %rcx     # 0x1132a8
callq 0xa2b0
movq -0x518(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x47460
leaq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x474b0
leaq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x474f0
leaq -0x28(%rbp), %rdi
callq 0x47540
movq -0x518(%rbp), %rdi
movsd %xmm0, 0x60(%rdi)
callq 0x47580
movq -0x518(%rbp), %rdi
movq %rax, -0x50(%rbp)
callq 0x26850
movq -0x518(%rbp), %rdi
movq %rax, -0x58(%rbp)
callq 0x26800
movq -0x518(%rbp), %rdi
movq %rax, -0x60(%rbp)
movq %rdi, %rax
addq $0x38, %rax
movq %rax, -0x530(%rbp)
callq 0x26850
movq -0x530(%rbp), %rdi
movq %rax, %rsi
callq 0x47150
movq -0x518(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0x528(%rbp)
callq 0x26800
movq -0x528(%rbp), %rdi
movq %rax, %rsi
callq 0x47360
movq -0x518(%rbp), %rax
movq $0x0, -0x68(%rbp)
movq -0x50(%rbp), %rcx
movq %rcx, 0x58(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rax)
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x50(%rbp), %rax
jge 0x46cbc
movq -0x518(%rbp), %rsi
movq -0x58(%rbp), %rdx
subq -0x70(%rbp), %rdx
movq -0x60(%rbp), %rcx
subq -0x70(%rbp), %rcx
leaq -0x100(%rbp), %rdi
callq 0x270f0
leaq -0x101(%rbp), %rdi
callq 0x47620
leaq -0xc8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x101(%rbp), %rdx
callq 0x475d0
leaq -0xc8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x47640
movsd %xmm0, -0x88(%rbp)
movq -0x70(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rax
addq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
movsd -0x88(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x469d0
jp 0x469d0
movq -0x518(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, 0x58(%rax)
movq -0x70(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
cmpq -0x50(%rbp), %rax
jge 0x469cb
movq -0x518(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rax, -0x540(%rbp)
addq $0x38, %rdi
movq -0x110(%rbp), %rsi
callq 0x47690
movq -0x540(%rbp), %rcx
movq -0x518(%rbp), %rdi
movq %rcx, (%rax)
movq -0x110(%rbp), %rax
movq %rax, -0x538(%rbp)
addq $0x48, %rdi
movq -0x110(%rbp), %rsi
callq 0x476c0
movq -0x538(%rbp), %rcx
movq %rcx, (%rax)
movq -0x110(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x110(%rbp)
jmp 0x4694c
jmp 0x46cbc
leaq -0x119(%rbp), %rdi
callq 0x476f0
movq -0x518(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
callq 0x47720
movq %rax, %rsi
leaq -0x119(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x47700
movq -0x518(%rbp), %rax
movsd %xmm0, -0x118(%rbp)
movsd -0x118(%rbp), %xmm0
ucomisd 0x68(%rax), %xmm0
jbe 0x46a38
movq -0x518(%rbp), %rax
movsd -0x118(%rbp), %xmm0
movsd %xmm0, 0x68(%rax)
movq -0x518(%rbp), %rdi
movq -0x78(%rbp), %rax
movq %rax, -0x550(%rbp)
addq $0x38, %rdi
movq -0x70(%rbp), %rsi
callq 0x47690
movq -0x550(%rbp), %rcx
movq -0x518(%rbp), %rdi
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
movq %rax, -0x548(%rbp)
addq $0x48, %rdi
movq -0x70(%rbp), %rsi
callq 0x476c0
movq -0x548(%rbp), %rcx
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
cmpq -0x78(%rbp), %rax
je 0x46ae1
movq -0x518(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x158(%rbp), %rdi
callq 0x269c0
movq -0x518(%rbp), %rsi
movq -0x78(%rbp), %rdx
leaq -0x190(%rbp), %rdi
callq 0x269c0
leaq -0x158(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x477e0
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x80(%rbp), %rax
je 0x46b38
movq -0x518(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x1c8(%rbp), %rdi
callq 0x26870
movq -0x518(%rbp), %rsi
movq -0x80(%rbp), %rdx
leaq -0x200(%rbp), %rdi
callq 0x26870
leaq -0x1c8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x478b0
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
movq -0x58(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x46bad
movq -0x518(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x70(%rbp), %rdx
callq 0x47980
movq -0x518(%rbp), %rsi
movq %rax, -0x558(%rbp)
movq -0x70(%rbp), %rdx
leaq -0x2a0(%rbp), %rdi
callq 0x26870
movq -0x58(%rbp), %rdx
subq -0x70(%rbp), %rdx
subq $0x1, %rdx
leaq -0x268(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x479f0
movq -0x558(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x47a50
movq -0x70(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x46ca9
movq -0x518(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x410(%rbp), %rdi
callq 0x26870
movq -0x58(%rbp), %rdx
subq -0x70(%rbp), %rdx
subq $0x1, %rdx
leaq -0x3d8(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x479f0
movq -0x518(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x4b0(%rbp), %rdi
callq 0x269c0
movq -0x60(%rbp), %rdx
subq -0x70(%rbp), %rdx
subq $0x1, %rdx
leaq -0x478(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0x47b20
leaq -0x370(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
leaq -0x478(%rbp), %rdx
callq 0x47ad0
movq -0x518(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq $0x1, %rdx
movq -0x70(%rbp), %rcx
addq $0x1, %rcx
movq -0x58(%rbp), %r8
subq -0x70(%rbp), %r8
subq $0x1, %r8
movq -0x60(%rbp), %r9
subq -0x70(%rbp), %r9
subq $0x1, %r9
leaq -0x4f0(%rbp), %rdi
callq 0x2b620
leaq -0x4f0(%rbp), %rdi
callq 0x47b80
movq %rax, -0x4b8(%rbp)
leaq -0x4b8(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x47bb0
jmp 0x46cab
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x4688c
movq -0x518(%rbp), %rdi
addq $0x18, %rdi
movq -0x58(%rbp), %rsi
callq 0x47c10
movq -0x50(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x4f8(%rbp)
cmpq $0x0, -0x4f8(%rbp)
jl 0x46d46
movq -0x518(%rbp), %rdi
movq %rdi, %rax
addq $0x18, %rax
movq %rax, -0x568(%rbp)
movq -0x4f8(%rbp), %rax
movq %rax, -0x560(%rbp)
addq $0x38, %rdi
movq -0x4f8(%rbp), %rsi
callq 0x47d30
movq -0x568(%rbp), %rdi
movq -0x560(%rbp), %rsi
movq (%rax), %rdx
callq 0x47c40
movq -0x4f8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x4f8(%rbp)
jmp 0x46cdf
movq -0x518(%rbp), %rdi
addq $0x28, %rdi
movq -0x60(%rbp), %rsi
callq 0x47c10
movq $0x0, -0x500(%rbp)
movq -0x500(%rbp), %rax
cmpq -0x50(%rbp), %rax
jge 0x46dcf
movq -0x518(%rbp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, -0x578(%rbp)
movq -0x500(%rbp), %rax
movq %rax, -0x570(%rbp)
addq $0x48, %rdi
movq -0x500(%rbp), %rsi
callq 0x47d60
movq -0x578(%rbp), %rdi
movq -0x570(%rbp), %rsi
movq (%rax), %rdx
callq 0x47c40
movq -0x500(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x500(%rbp)
jmp 0x46d65
movq -0x68(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq -0x518(%rbp), %rax
movq %rdx, %rsi
movl $0x1, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq $0x0, %rsi
cmovnel %edx, %ecx
movb %cl, 0x78(%rax)
movb $0x1, 0x79(%rax)
addq $0x580, %rsp            # imm = 0x580
popq %rbp
retq
nopl (%rax,%rax)