Changeset: b300f6191ac9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b300f6191ac9
Modified Files:
monetdb5/modules/mal/Tests/array00.stable.out
monetdb5/modules/mal/Tests/array01.mal
monetdb5/modules/mal/Tests/array01.stable.out
monetdb5/modules/mal/Tests/array02.mal
monetdb5/modules/mal/Tests/array02.stable.err
monetdb5/modules/mal/Tests/array02.stable.out
monetdb5/modules/mal/array.mx
Branch: sciql
Log Message:
Add reverse map operation
Given a cell id list, extract the corresponding index vectors from a shape.
diffs (truncated from 527 to 300 lines):
diff --git a/monetdb5/modules/mal/Tests/array00.stable.out
b/monetdb5/modules/mal/Tests/array00.stable.out
--- a/monetdb5/modules/mal/Tests/array00.stable.out
+++ b/monetdb5/modules/mal/Tests/array00.stable.out
@@ -18,17 +18,22 @@
# MonetDB/SQL module loaded
function user.main():void;
#create the dimensions for a few arrays
-#create array v(i int dimension[0:4:1])
- vi := array.dimension(1,4,1,0);
- io.print(vi);
-#create array m(x int dimension[0:3:1], y int dimension[0:3:1], int 333);
- mx := array.dimension(1,3,3,0);
- my := array.dimension(3,3,1,0);
+#create array v(i int dimension[0:1:4])
+ v := array.series(0,1,4,1,1);
+ io.print(v);
+#create array m(x int dimension[0:1:3], y int dimension[0:1:3], int default
333);
+ mx := array.series(0,1,3,3,1);
+ my := array.series(0,1,3,1,3);
+ mv := array.filler(mx,333);
+ io.print(mx,my,mv);
+#create array m(x int dimension[0:2:6], y int dimension[0:1:4], int default
333);
+ mx := array.series(0,2,6,4,1);
+ my := array.series(0,1,4,1,3);
mv := array.filler(mx,333);
io.print(mx,my,mv);
#create array u(x int dimension[0:*:1]);
#any * implies this one
- ux := array.dimension(0,0,0,0);
+ ux := array.series(0,0,0,0,0);
io.print(ux);
end main;
#-----------------#
@@ -52,10 +57,25 @@
[ 6@0, 2, 0, 333 ]
[ 7@0, 2, 1, 333 ]
[ 8@0, 2, 2, 333 ]
-#-----------------#
-# h t # name
-# void int # type
-#-----------------#
+#---------------------------------#
+# h t t t # name
+# void int int int # type
+#---------------------------------#
+[ 0@0, 0, 0, 333 ]
+[ 1@0, 0, 1, 333 ]
+[ 2@0, 0, 2, 333 ]
+[ 3@0, 0, 3, 333 ]
+[ 4@0, 2, 0, 333 ]
+[ 5@0, 2, 1, 333 ]
+[ 6@0, 2, 2, 333 ]
+[ 7@0, 2, 3, 333 ]
+[ 8@0, 4, 0, 333 ]
+[ 9@0, 4, 1, 333 ]
+[ 10@0, 4, 2, 333 ]
+[ 11@0, 4, 3, 333 ]
+!MALException:array.series:illegal range
+
+
# 10:51:36 >
# 10:51:36 > Done.
diff --git a/monetdb5/modules/mal/Tests/array01.mal
b/monetdb5/modules/mal/Tests/array01.mal
--- a/monetdb5/modules/mal/Tests/array01.mal
+++ b/monetdb5/modules/mal/Tests/array01.mal
@@ -1,13 +1,14 @@
#extraction of cell positions from arrays
-#create array v(i int dimension[0:1:4])
+#create array v(i int dimension[0:1:4], payload:int)
v:= array.series(0,1,4,1,1);
-io.print(v);
+vv:= array.series(0,3,12,1,1);
+io.print(v,vv);
#create array M(x int dimension[0:2:6], y int dimension[0:1:4], int default
333);
mx:= array.series(0,2,6,4,1);
my:= array.series(0,1,4,1,3);
-mv:= array.filler(mx,333);
+mv:= array.series(0,1,12,1,1);
io.print(mx,my,mv);
#extract the indices from both
@@ -21,9 +22,9 @@
#fetch the position of an element in a vector
z1:= array.map(v,x);
-io.print(z1);
+io.print(z1,vv);
z1:= array.map(v,y);
-io.print(z1);
+io.print(z1,vv);
#get the original cell oids
x1:= array.map(v,v);
diff --git a/monetdb5/modules/mal/Tests/array01.stable.out
b/monetdb5/modules/mal/Tests/array01.stable.out
--- a/monetdb5/modules/mal/Tests/array01.stable.out
+++ b/monetdb5/modules/mal/Tests/array01.stable.out
@@ -20,11 +20,12 @@
#extraction of cell positions from arrays
#create array v(i int dimension[0:1:4])
v := array.series(0,1,4,1,1);
- io.print(v);
+ vv := array.series(0,3,12,1,1);
+ io.print(v,vv);
#create array M(x int dimension[0:2:6], y int dimension[0:1:4], int default
333);
mx := array.series(0,2,6,4,1);
my := array.series(0,1,4,1,3);
- mv := array.filler(mx,333);
+ mv := array.series(0,1,12,1,1);
io.print(mx,my,mv);
#extract the indices from both
#do a point select
@@ -36,9 +37,9 @@
io.print(y);
#fetch the position of an element in a vector
z1 := array.map(v,x);
- io.print(z1);
+ io.print(z1,vv);
z1 := array.map(v,y);
- io.print(z1);
+ io.print(z1,vv);
#get the original cell oids
x1 := array.map(v,v);
io.print(x1);
@@ -57,30 +58,30 @@
x5 := array.map(v,v,mx,my);
io.print(x5);
end main;
-#-----------------#
-# h t # name
-# void int # type
-#-----------------#
-[ 0@0, 0 ]
-[ 1@0, 1 ]
-[ 2@0, 2 ]
-[ 3@0, 3 ]
+#-------------------------#
+# h t t # name
+# void int int # type
+#-------------------------#
+[ 0@0, 0, 0 ]
+[ 1@0, 1, 3 ]
+[ 2@0, 2, 6 ]
+[ 3@0, 3, 9 ]
#---------------------------------#
# h t t t # name
# void int int int # type
#---------------------------------#
-[ 0@0, 0, 0, 333 ]
-[ 1@0, 0, 1, 333 ]
-[ 2@0, 0, 2, 333 ]
-[ 3@0, 0, 3, 333 ]
-[ 4@0, 2, 0, 333 ]
-[ 5@0, 2, 1, 333 ]
-[ 6@0, 2, 2, 333 ]
-[ 7@0, 2, 3, 333 ]
-[ 8@0, 4, 0, 333 ]
-[ 9@0, 4, 1, 333 ]
-[ 10@0, 4, 2, 333 ]
-[ 11@0, 4, 3, 333 ]
+[ 0@0, 0, 0, 0 ]
+[ 1@0, 0, 1, 1 ]
+[ 2@0, 0, 2, 2 ]
+[ 3@0, 0, 3, 3 ]
+[ 4@0, 2, 0, 4 ]
+[ 5@0, 2, 1, 5 ]
+[ 6@0, 2, 2, 6 ]
+[ 7@0, 2, 3, 7 ]
+[ 8@0, 4, 0, 8 ]
+[ 9@0, 4, 1, 9 ]
+[ 10@0, 4, 2, 10 ]
+[ 11@0, 4, 3, 11 ]
#-----------------#
# h t # name
# void int # type
@@ -91,18 +92,18 @@
# void int # type
#-----------------#
[ 0@0, 2 ]
+#-------------------------#
+# h t t # name
+# oid void int # type
+#-------------------------#
+[ 1@0, 0@0, 3 ]
+#-------------------------#
+# h t t # name
+# oid void int # type
+#-------------------------#
+[ 2@0, 0@0, 6 ]
#-----------------#
-# t h # name
-# void oid # type
-#-----------------#
-[ 0@0, 1@0 ]
-#-----------------#
-# t h # name
-# void oid # type
-#-----------------#
-[ 0@0, 2@0 ]
-#-----------------#
-# t h # name
+# h t # name
# void void # type
#-----------------#
[ 0@0, 0@0 ]
@@ -129,28 +130,28 @@
# t h # name
# void oid # type
#-----------------#
-[ 0@0, 4@0 ]
-[ 1@0, 5@0 ]
-[ 2@0, 6@0 ]
-[ 3@0, 7@0 ]
+[ 4@0, 0@0 ]
+[ 5@0, 1@0 ]
+[ 6@0, 2@0 ]
+[ 7@0, 3@0 ]
#-----------------#
# t h # name
# void oid # type
#-----------------#
-[ 0@0, 2@0 ]
-[ 1@0, 6@0 ]
+[ 2@0, 0@0 ]
+[ 6@0, 1@0 ]
#-----------------#
# t h # name
# void oid # type
#-----------------#
[ 0@0, 0@0 ]
-[ 1@0, 2@0 ]
+[ 2@0, 1@0 ]
#-----------------#
# t h # name
# void oid # type
#-----------------#
[ 0@0, 0@0 ]
-[ 1@0, 2@0 ]
+[ 2@0, 1@0 ]
# 20:40:09 >
# 20:40:09 > Done.
diff --git a/monetdb5/modules/mal/Tests/array02.mal
b/monetdb5/modules/mal/Tests/array02.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/array02.mal
@@ -0,0 +1,32 @@
+#extraction of cell positions from arrays
+
+#create array v(i int dimension[0:1:4], payload:int)
+v:= array.series(0,1,4,1,1);
+vv:= array.series(0,3,12,1,1);
+io.print(v,vv);
+
+#create array M(x int dimension[0:2:6], y int dimension[0:1:4], int default
333);
+mx:= array.series(0,2,6,4,1);
+my:= array.series(0,1,4,1,3);
+mv:= array.series(0,1,12,1,1);
+io.print(mx,my,mv);
+
+#create a cell identifier vector
+#do a point select
+x:= bat.new(:oid,:oid);
+bat.insert(x, 1@0,0@0);
+io.print(x);
+y:= bat.new(:oid,:oid);
+bat.insert(y, 2@0,0@0);
+bat.insert(y, 3@0,1@0);
+bat.insert(y, 7@0,2@0);
+io.print(y);
+
+#fetch the index column
+z1:= array.map(x,v);
+io.print(z1);
+
+(zx:bat[:oid,:int],zy:bat[:oid,:int]):= array.map(y,mx,my);
+io.print(zx);
+io.print(zy);
+io.print(zx,zy);
diff --git a/monetdb5/modules/mal/Tests/array02.stable.err
b/monetdb5/modules/mal/Tests/array02.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/array02.stable.err
@@ -0,0 +1,31 @@
+stderr of test 'array02` in directory 'modules/mal` itself:
+
+
+# 21:54:55 >
+# 21:54:55 > mserver5 --debug=10 --set gdk_nr_threads=0 --set
"gdk_dbfarm=/ufs/mk/sciql//Linux/var/MonetDB" --set mapi_open=true --set
mapi_port=37601 --set monet_prompt= --trace --forcemito --set mal_listing=2
--dbname=mTests_modules_mal array02.mal
+# 21:54:55 >
+
+# builtin opt gdk_dbname = demo
+# builtin opt gdk_dbfarm = /ufs/mk/sciql//Linux/var/monetdb5/dbfarm
+# builtin opt gdk_debug = 0
+# builtin opt gdk_alloc_map = no
+# builtin opt gdk_vmtrim = yes
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list