def slogdet(a)
    lu, piv, = Lapack.call(:getrf, a)
    idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
    m = piv.eq(idx).count_false(axis:-1) % 2
    sign = m * -2 + 1

    lud = lu.diagonal
    if (lud.eq 0).any?
      return 0, (-Float::INFINITY)
    end
    lud_abs = lud.abs
    sign *= (lud/lud_abs).prod
    [sign, NMath.log(lud_abs).sum(axis:-1)]
  end
def slogdet(a)
    lu, piv, = Lapack.call(:getrf, a)
    idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
    m = piv.eq(idx).count_false(axis:-1) % 2
    sign = m * -2 + 1

    lud = lu.diagonal
    if (lud.eq 0).any?
      return 0, (-Float::INFINITY)
    end
    lud_abs = lud.abs
    sign *= (lud/lud_abs).prod
    [sign, NMath.log(lud_abs).sum(axis:-1)]
  end
Natural logarithm of the determinant of a matrix

 @param a [Numo::NArray] matrix (>= 2-dimensional NArray)
 @return [[sign,logdet]]
   - **sign** -- A number representing the sign of the determinant.
   - **logdet** -- The natural log of the absolute value of the determinant.