docstr: Calculate the determinant of a matrix.
docstr_tok: ["Calculate","the","determinant","of","a","matrix","."]
code: def det(ctx, A):
      """
      Calculate the determinant of a matrix.
      """
      prec = ctx.prec
      try:
          # do not overwrite A
          A = ctx.matrix(A).copy()
          # use LU factorization to calculate determinant
          try:
              R, p = ctx.LU_decomp(A)
          except ZeroDivisionError:
              return 0
          z = 1
          for i, e in enumerate(p):
              if i != e:
                  z *= -1
          for i in xrange(A.rows):
              z *= R[i, i]
          return z
      finally:
          ctx.prec = prec
  
imports: from copy import copy
  from ..libmp.backend import xrange
label_desc: Use image node_id 14 for calling the LinearAlgebraMethods obj's underlying member method code with example usage: obj.det(ctx, A) and returns: z, int