Home | History | Annotate | Download | only in dist

Lines Matching refs:row

46 		row_hash = isl_seq_get_hash(mat->row[i], mat->n_col);
63 mat->row = NULL;
67 mat->row = isl_calloc_array(ctx, isl_int *, n_row);
68 if (n_row && !mat->row)
73 mat->row[i] = mat->block.data + i * n_col;
96 isl_int **row;
116 isl_seq_cpy(new_mat->row[i], mat->row[i], mat->n_col);
129 row = isl_realloc_array(mat->ctx, mat->row, isl_int *, n_row);
130 if (n_row && !row)
132 mat->row = row;
135 mat->row[i] = mat->block.data + (mat->row[i] - old);
137 mat->row[i] = mat->block.data + i * mat->max_col;
148 __isl_give isl_mat *isl_mat_sub_alloc6(isl_ctx *ctx, isl_int **row,
157 mat->row = isl_alloc_array(ctx, isl_int *, n_row);
158 if (n_row && !mat->row)
161 mat->row[i] = row[first_row+i] + first_col;
180 return isl_mat_sub_alloc6(mat->ctx, mat->row, first_row, n_row,
222 isl_seq_cpy(mat2->row[i], mat->row[i], mat->n_col);
251 free(mat->row);
279 /* Check that "row" is a valid row position for "mat".
281 static isl_stat check_row(__isl_keep isl_mat *mat, int row)
285 if (row < 0 || row >= mat->n_row)
287 "row out of range", return isl_stat_error);
314 "row position or range out of bounds",
319 int isl_mat_get_element(__isl_keep isl_mat *mat, int row, int col, isl_int *v)
321 if (check_row(mat, row) < 0)
325 isl_int_set(*v, mat->row[row][col]);
329 /* Extract the element at row "row", oolumn "col" of "mat".
332 int row, int col)
336 if (check_row(mat, row) < 0)
341 return isl_val_int_from_isl_int(ctx, mat->row[row][col]);
345 int row, int col, isl_int v)
348 if (check_row(mat, row) < 0)
352 isl_int_set(mat->row[row][col], v);
357 int row, int col, int v)
360 if (check_row(mat, row) < 0)
364 isl_int_set_si(mat->row[row][col], v);
368 /* Replace the element at row "row", column "col" of "mat" by "v".
371 int row, int col, __isl_take isl_val *v)
378 mat = isl_mat_set_element(mat, row, col, v->n);
395 isl_seq_clr(mat->row[i], i);
396 isl_int_set(mat->row[i][i], d);
397 isl_seq_clr(mat->row[i]+i+1, n_row-(i+1));
414 isl_seq_clr(mat->row[i], n_col);
438 if (isl_seq_first_non_zero(mat->row[i], i) != -1)
440 if (isl_int_ne(mat->row[0][0], mat->row[i][i]))
442 if (isl_seq_first_non_zero(mat->row[i] + i + 1,
466 isl_seq_inner_product(mat->row[i], vec->el, vec->size,
489 isl_int_set(vec_mat->row[i][0], vec->el[i]);
497 isl_int_set(vec->el[i], vec_mat->row[i][0]);
524 isl_int_addmul(prod->el[i], vec->el[j], mat->row[j][i]);
549 isl_seq_first_non_zero(left->row[0]+1, left->n_col-1) == -1,
552 isl_seq_first_non_zero(right->row[0]+1, right->n_col-1) == -1,
558 isl_int_lcm(sum->row[0][0], left->row[0][0], right->row[0][0]);
559 isl_int_divexact(left->row[0][0], sum->row[0][0], left->row[0][0]);
560 isl_int_divexact(right->row[0][0], sum->row[0][0], right->row[0][0]);
562 isl_seq_clr(sum->row[0]+1, sum->n_col-1);
564 isl_int_mul(sum->row[i][0], left->row[0][0], left->row[i][0]);
565 isl_int_addmul(sum->row[i][0],
566 right->row[0][0], right->row[i][0]);
567 isl_seq_scale(sum->row[i]+1, left->row[i]+1, left->row[0][0],
569 isl_seq_scale(sum->row[i]+left->n_col,
570 right->row[i]+1, right->row[0][0],
574 isl_int_divexact(left->row[0][0], sum->row[0][0], left->row[0][0]);
575 isl_int_divexact(right->row[0][0], sum->row[0][0], right->row[0][0]);
586 __isl_keep isl_mat **Q, unsigned row, unsigned i, unsigned j)
589 for (r = row; r < M->n_row; ++r)
590 isl_int_swap(M->row[r][i], M->row[r][j]);
593 isl_int_swap((*U)->row[r][i], (*U)->row[r][j]);
600 __isl_keep isl_mat **Q, unsigned row, unsigned i, unsigned j, isl_int m)
603 for (r = row; r < M->n_row; ++r)
604 isl_int_submul(M->row[r][j], m, M->row[r][i]);
607 isl_int_submul((*U)->row[r][j], m, (*U)->row[r][i]);
611 isl_int_addmul((*Q)->row[i][r], m, (*Q)->row[j][r]);
616 __isl_keep isl_mat **Q, unsigned row, unsigned col)
619 for (r = row; r < M->n_row; ++r)
620 isl_int_neg(M->row[r][col], M->row[r][col]);
623 isl_int_neg((*U)->row[r][col], (*U)->row[r][col]);
626 isl_seq_neg((*Q)->row[col], (*Q)->row[col], (*Q)->n_col);
635 * such that on each echelon row the entries in the non-echelon column
645 int row, col;
673 for (row = 0; row < M->n_row; ++row) {
675 first = isl_seq_abs_min_non_zero(M->row[row]+col, M->n_col-col);
680 exchange(M, U, Q, row, first, col);
681 if (isl_int_is_neg(M->row[row][col]))
682 oppose(M, U, Q, row, col);
684 while ((off = isl_seq_first_non_zero(M->row[row]+first,
687 isl_int_fdiv_q(c, M->row[row][first], M->row[row][col]);
688 subtract(M, U, Q, row, col, first, c);
689 if (!isl_int_is_zero(M->row[row][first]))
690 exchange(M, U, Q, row, first, col);
695 if (isl_int_is_zero(M->row[row][i]))
698 isl_int_cdiv_q(c, M->row[row][i], M->row[row
700 isl_int_fdiv_q(c, M->row[row][i], M->row[row][col]);
703 subtract(M, U, Q, row, col, i, c);
723 /* Use row "row" of "mat" to eliminate column "col" from all other rows.
725 static __isl_give isl_mat *eliminate(__isl_take isl_mat *mat, int row, int col)
739 if (k == row)
741 if (isl_int_is_zero(mat->row[k][col]))
746 isl_seq_elim(mat->row[k], mat->row[row], col, nc, NULL);
747 isl_seq_normalize(ctx, mat->row[k], nc);
754 * from the final row and the final column.
758 * look for the last row with a non-zero coefficient in that column,
764 int k, row, last;
773 for (row = nr - 1; row >= 0; --row) {
775 for (k = row; k >= 0; --k)
776 if (!isl_int_is_zero(mat->row[k][last]))
783 if (k != row)
784 mat = isl_mat_swap_rows(mat, k, row);
787 if (isl_int_is_neg(mat->row[row][last]))
788 mat = isl_mat_row_neg(mat, row);
789 mat = eliminate(mat, row, last);
793 mat = isl_mat_drop_rows(mat, 0, row + 1);
814 pos = isl_seq_first_non_zero(mat->row[i], nc);
817 if (isl_int_is_nonneg(mat->row[i][pos]))
839 int row, col;
841 for (col = first_col, row = 0; col < H->n_col; ++col) {
842 for (; row < n_row; ++row)
843 if (!isl_int_is_zero(H->row[row][col]))
845 if (row == n_row)
883 isl_mat_sub_copy(K->ctx, K->row, U->row, U->n_row, 0, rank, U->n_col-rank);
903 isl_int_set_si(mat2->row[0][0], 1);
904 isl_seq_clr(mat2->row[0]+1, mat->n_col);
906 isl_int_set_si(mat2->row[1+i][0], 0);
907 isl_seq_cpy(mat2->row[1+i]+1, mat->row[i], mat->n_col);
935 isl_seq_cpy(mat->row[i], mat1->row[i], mat1->n_col);
936 isl_seq_clr(mat->row[i] + mat1->n_col, mat2->n_col);
939 isl_seq_clr(mat->row[mat1->n_row + i], mat1->n_col);
940 isl_seq_cpy(mat->row[mat1->n_row + i] + mat1->n_col,
941 mat2->row[i], mat2->n_col);
952 static int row_first_non_zero(isl_int **row, unsigned n_row, unsigned col)
957 if (!isl_int_is_zero(row[i][col]))
962 static int row_abs_min_non_zero(isl_int **row, unsigned n_row, unsigned col)
964 int i, min = row_first_non_zero(row, n_row, col);
968 if (isl_int_is_zero(row[i][col]))
970 if (isl_int_abs_lt(row[i][col], row[min][col]))
988 __isl_keep isl_mat *left, __isl_keep isl_mat *right, unsigned row)
990 isl_seq_neg(left->row[row]+row, left->row[row]+row, left->n_col-row);
991 isl_seq_neg(right->row[row], right->row[row], right->n_col);
995 unsigned row, unsigned i, isl_int m)
998 isl_seq_combine(left->row[i]+row,
999 left->ctx->one, left->row[i]+row,
1000 m, left->row[row]+row,
1001 left->n_col-row);
1002 isl_seq_combine(right->row[i], right->ctx->one, right->row[i],
1003 m, right->row[row], right->n_col);
1011 int row;
1032 for (row = 0; row < left->n_row; ++row) {
1034 pivot = row_abs_min_non_zero(left->row+row, left->n_row-row, row);
1040 pivot += row;
1041 if (pivot != row)
1042 if (inv_exchange(&left, &right, pivot, row) < 0)
1044 if (isl_int_is_neg(left->row[row][row]))
1045 inv_oppose(left, right, row);
1046 first = row+1;
1047 while ((off = row_first_non_zero(left->row+first,
1048 left->n_row-first, row)) != -1) {
1050 isl_int_fdiv_q(a, left->row[first][row],
1051 left->row[row][row]);
1052 inv_subtract(left, right, row, first, a);
1053 if (!isl_int_is_zero(left->row[first][row])) {
1054 if (inv_exchange(&left, &right, row, first) < 0)
1060 for (i = 0; i < row; ++i) {
1061 if (isl_int_is_zero(left->row[i][row]))
1063 isl_int_gcd(a, left->row[row][row], left->row[i][row]);
1064 isl_int_divexact(b, left->row[i][row], a);
1065 isl_int_divexact(a, left->row[row][row], a);
1067 isl_seq_combine(left->row[i] + i,
1068 a, left->row[i] + i,
1069 b, left->row[row] + i,
1071 isl_seq_combine(right->row[i], a, right->row[i],
1072 b, right->row[row], right->n_col);
1077 isl_int_set(a, left->row[0][0]);
1078 for (row = 1; row < left->n_row; ++row)
1079 isl_int_lcm(a, a, left->row[row][row]);
1084 for (row = 0; row < left->n_row; ++row) {
1085 isl_int_divexact(left->row[row][row], a, left->row[row][row]);
1086 if (isl_int_is_one(left->row[row][row]))
1088 isl_seq_scale(right->row[row], right->row[row],
1089 left->row[row][row], right->n_col);
1106 isl_int_mul(mat->row[i][col], mat->row[i][col], m);
1117 isl_int_mul(tmp, m1, mat->row[i][src1]);
1118 isl_int_addmul(tmp, m2, mat->row[i][src2]);
1119 isl_int_set(mat->row[i][dst], tmp);
1127 int row;
1141 for (row = 0; row < mat->n_row; ++row) {
1143 pivot = isl_seq_abs_min_non_zero(mat->row[row]+row, mat->n_col-row);
1149 pivot += row;
1150 if (pivot != row)
1151 exchange(mat, &inv, NULL, row, pivot, row);
1152 if (isl_int_is_neg(mat->row[row][row]))
1153 oppose(mat, &inv, NULL, row, row);
1154 first = row+1;
1155 while ((off = isl_seq_first_non_zero(mat->row[row]+first,
1158 isl_int_fdiv_q(a, mat->row[row][first],
1159 mat->row[row][row]);
1160 subtract(mat, &inv, NULL, row, row, first, a);
1161 if (!isl_int_is_zero(mat->row[row][first]))
1162 exchange(mat, &inv, NULL, row, row, first);
1166 for (i = 0; i < row; ++i) {
1167 if (isl_int_is_zero(mat->row[row][i]))
1169 isl_int_gcd(a, mat->row[row][row], mat->row[row][i]);
1170 isl_int_divexact(b, mat->row[row][i], a);
1171 isl_int_divexact(a, mat->row[row][row], a);
1173 isl_mat_col_combine(mat, i, a, i, b, row);
1174 isl_mat_col_combine(inv, i, a, i, b, row);
1179 isl_int_set(a, mat->row[0][0]);
1180 for (row = 1; row < mat->n_row; ++row)
1181 isl_int_lcm(a, a, mat->row[row][row]);
1186 for (row = 0; row < mat->n_row; ++row) {
1187 isl_int_divexact(mat->row[row][row], a, mat->row[row][row]);
1188 if (isl_int_is_one(mat->row[row][row]))
1190 isl_mat_col_scale(inv, row, mat->row[row][row]);
1217 isl_int_swap(mat->row[i][j], mat->row[j][i]);
1225 isl_int_set(transpose->row[j][i], mat->row[i][j]);
1244 isl_int_swap(mat->row[r][i], mat->row[r][j]);
1260 t = mat->row[i];
1261 mat->row[i] = mat->row[j];
1262 mat->row[j] = t;
1285 isl_seq_clr(prod->row[i], prod->n_col);
1292 isl_int_mul(prod->row[i][j],
1293 left->row[i][0], right->row[0][j]);
1295 if (isl_int_is_zero(left->row[i][k]))
1298 isl_int_addmul(prod->row[i][j],
1299 left->row[i][k], right->row[k][j]);
1318 * The row q may be the equalities, the inequalities or the
1335 isl_int_mul(q[i][0], q[i][0], mat->row[0][0]);
1341 isl_seq_swp_or_cpy(q[i] + has_div, t->row[i], t->n_col);
1451 isl_stat isl_mat_sub_transform(isl_int **row, unsigned n_row,
1461 t = isl_mat_sub_alloc6(ctx, row, 0, n_row, first_col, mat->n_row);
1466 isl_seq_swp_or_cpy(row[i] + first_col, t->row[i], t->n_col);
1491 isl_int_print(out, mat->row[i][j], 0);
1519 isl_seq_cpy(mat->row[r]+col, mat->row[r]+col+n,
1527 unsigned row, unsigned n)
1532 if (check_row_range(mat, row, n) < 0)
1535 for (r = row; r+n < mat->n_row; ++r)
1536 mat->row[r] = mat->row[r+n];
1556 isl_mat_sub_copy(mat->ctx, ext->row, mat->row, mat->n_row, 0, 0, col);
1557 isl_mat_sub_copy(mat->ctx, ext->row, mat->row, mat->n_row,
1579 isl_seq_clr(mat->row[i] + first, n);
1593 unsigned row, unsigned n)
1597 if (check_row_range(mat, row, 0) < 0)
1606 isl_mat_sub_copy(mat->ctx, ext->row, mat->row, row, 0, 0, mat->n_col);
1607 isl_mat_sub_copy(mat->ctx, ext->row + row + n, mat->row + row,
1608 mat->n_row - row, 0, 0, mat->n_col);
1626 unsigned row, unsigned n)
1630 mat = isl_mat_insert_rows(mat, row, n);
1635 isl_seq_clr(mat->row[row + i], mat->n_col);
1654 isl_int_submul(mat->row[i][dst_col], f, mat->row[i][src_col]);
1665 isl_int_add(mat->row[i][dst_col],
1666 mat->row[i][dst_col], mat->row[i][src_col]);
1675 isl_int_mul(mat->row[i][dst_col], f, mat->row[i][src_col]);
1690 if (isl_int_is_zero(mat->row[i][src_col]))
1695 isl_int_addmul(mat->row[i][dst_col], f, mat->row[i][src_col]);
1711 if (isl_int_is_zero(mat->row[i][col]))
1716 isl_int_neg(mat->row[i][col], mat->row[i][col]);
1722 /* Negate row "row" of "mat" and return the result.
1724 __isl_give isl_mat *isl_mat_row_neg(__isl_take isl_mat *mat, int row)
1726 if (check_row(mat, row) < 0)
1728 if (isl_seq_first_non_zero(mat->row[row], mat->n_col) == -1)
1733 isl_seq_neg(mat->row[row], mat->row[row], mat->n_col);
1737 __isl_give isl_mat *isl_mat_unimodular_complete(__isl_take isl_mat *M, int row)
1746 M->n_row = row;
1751 for (r = 0; r < row; ++r)
1752 isl_assert(M->ctx, isl_int_is_one(H->row[r][r]), goto error);
1753 for (r = row; r < M->n_row; ++r)
1754 isl_seq_cpy(M->row[r], Q->row[r], M->n_col);
1786 isl_mat_sub_copy(mat->ctx, mat->row, top->row, top->n_row,
1788 isl_mat_sub_copy(mat->ctx, mat->row + top->n_row, bot->row, bot->n_row,
1813 if (!isl_seq_eq(mat1->row[i], mat2->row[i], mat1->n_col))
1829 isl_seq_cpy(mat->row[0], vec->el, vec->size);
1838 /* Return a copy of row "row" of "mat" as an isl_vec.
1840 __isl_give isl_vec *isl_mat_get_row(__isl_keep isl_mat *mat, unsigned row)
1846 if (row >= mat->n_row)
1847 isl_die(mat->ctx, isl_error_invalid, "row out of range",
1853 isl_seq_cpy(v->el, mat->row[row], mat->n_col);
1879 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1881 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1883 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1885 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1889 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1891 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1893 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1895 isl_mat_sub_copy(res->ctx, res->row, mat->row, mat->n_row,
1907 /* Return the gcd of the elements in row "row" of "mat" in *gcd.
1910 isl_stat isl_mat_row_gcd(__isl_keep isl_mat *mat, int row, isl_int *gcd)
1912 if (check_row(mat, row) < 0)
1915 isl_seq_gcd(mat->row[row], mat->n_col, gcd);
1931 isl_seq_gcd(mat->row[i], mat->n_col, &g);
1951 isl_seq_scale(mat->row[i], mat->row[i], m, mat->n_col);
1968 isl_seq_scale_down(mat->row[i], mat->row[i], m, mat->n_col);
1973 __isl_give isl_mat *isl_mat_scale_down_row(__isl_take isl_mat *mat, int row,
1983 isl_seq_scale_down(mat->row[row], mat->row[row], m, mat->n_col);
2003 __isl_give isl_mat *isl_mat_normalize_row(__isl_take isl_mat *mat, int row)
2009 isl_seq_normalize(mat->ctx, mat->row[row], mat->n_col);
2024 if (row_first_non_zero(mat->row, mat->n_row, i) < 0)