Skip to content
Snippets Groups Projects
Commit e8f98305 authored by Daniel Maier's avatar Daniel Maier
Browse files

new perforation function

parent ea982ded
No related branches found
No related tags found
Loading
#include <iostream>
#include <osl/osl.h>
osl_relation_p
perforate(osl_relation_p r) {
/* first: add one dimension */
std::cout << "extending to " << r->nb_output_dims+1 << "\n";
auto n = osl_relation_extend_output(r, r->nb_output_dims+1);
/* second: find new colum */
auto row = n->m[n->nb_rows-1];
int col = 0;
for(; osl_int_get_si(n->precision, row[col]) == 0 && col < n->nb_rows; col++) { }
/* third: set equal, iterator -1, new thing 2 */
osl_int_set_si(n->precision, &row[col], 2);
osl_int_set_si(n->precision, &row[1], -1);
osl_relation_dump(stdout, n);
int x = osl_int_get_si(r->precision, row[col]);
std::cout << "here is x: " << x << "\n";
return n;
void
perforate(osl_relation_p rel) {
int r = rel->nb_rows;
int c = rel->nb_columns-2;
osl_relation_insert_blank_row(rel, r);
osl_relation_insert_blank_column(rel, c);
rel->nb_local_dims++;
auto row = rel->m[r];
osl_int_set_si(rel->precision, &row[c], 2);
osl_int_set_si(rel->precision, &row[1], -1);
osl_relation_dump(stdout, rel);
}
int main() {
......@@ -38,10 +33,10 @@ int main() {
auto d = s->domain;
osl_relation_dump(stdout, s->domain);
auto n = perforate(d);
s->domain = n;
perforate(d);
//s->domain = n;
osl_relation_free(d);
//osl_relation_free(d);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment