OSDN Git Service

* explow.c (convert_memory_address): Add gcc_assert.
[pf3gnuchains/gcc-fork.git] / gcc / lambda-mat.c
index 16fd65e..8de0e98 100644 (file)
@@ -70,6 +70,29 @@ lambda_matrix_id (lambda_matrix mat, int size)
       mat[i][j] = (i == j) ? 1 : 0;
 }
 
+/* Return true if MAT is the identity matrix of SIZE */
+
+bool
+lambda_matrix_id_p (lambda_matrix mat, int size)
+{
+  int i, j;
+  for (i = 0; i < size; i++)
+    for (j = 0; j < size; j++)
+      {
+       if (i == j)
+         {
+           if (mat[i][j] != 1)
+             return false;
+         }
+       else
+         {
+           if (mat[i][j] != 0)
+             return false;
+         }
+      }
+  return true;
+}
+
 /* Negate the elements of the M x N matrix MAT1 and store it in MAT2.  */
 
 void
@@ -378,9 +401,8 @@ lambda_matrix_inverse_hard (lambda_matrix mat, lambda_matrix inv, int n)
       row = temp[j];
       diagonal = row[j];
 
-      /* If the matrix is singular, abort.  */
-      if (diagonal == 0)
-       abort ();
+      /* The matrix must not be singular.  */
+      gcc_assert (diagonal);
 
       determinant = determinant * diagonal;
 
@@ -579,9 +601,9 @@ lambda_matrix_project_to_null (lambda_matrix B, int rowsize,
   lambda_matrix M1, M2, M3, I;
   int determinant;
 
-  /* compute c(I-B^T inv(B B^T) B) e sub k   */
+  /* Compute c(I-B^T inv(B B^T) B) e sub k.  */
 
-  /* M1 is the transpose of B */
+  /* M1 is the transpose of B */
   M1 = lambda_matrix_new (colsize, colsize);
   lambda_matrix_transpose (B, M1, rowsize, colsize);