# File lib/linalg/dmatrix/det.rb, line 15
      def determinant
         raise DimensionError unless square?
         begin
            a = self.clone
            ipiv = a.lu!
            res = 1.0
            sign = 1
            vsize.times { |i|
               res *= a[i,i]
               
               # 1-based fortran
               if ipiv[i] != i + 1
                  sign *= -1 
               end
            }
            res*sign
         rescue SingularMatrix
            0.0
         end
      end