summaryrefslogtreecommitdiff
path: root/gcc/lambda-mat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/lambda-mat.c')
-rw-r--r--gcc/lambda-mat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/lambda-mat.c b/gcc/lambda-mat.c
index 16fd65eb4d7..8f4cbd0e485 100644
--- a/gcc/lambda-mat.c
+++ b/gcc/lambda-mat.c
@@ -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