├── NOTES ├── gsbt.sample ├── .gitignore ├── test-out ├── test-analysis-1A.check ├── test-analysis-7A.check ├── test-analysis-3E.check ├── test-analysis-3C.check ├── test-analysis-8A.check ├── test-delite-1A1.check ├── test-analysis-1B.check ├── test-interpreter-3B1.check ├── test-interpreter-3A1.check ├── test-analysis-6A.check ├── test-interpreter-3B2.check ├── test-interpreter-3A2.check ├── test-analysis-2A.check ├── test-analysis-4A2.check ├── test-analysis-3D.check ├── test-analysis-3A.check ├── test-interpreter-3-LMS-A1.check ├── test-interpreter-3-LMS-B1.check ├── test-interpreter-3B3.check ├── test-interpreter-3A3.check ├── test-interpreter-4decompile1.check ├── test-analysis-4A3.check ├── test-interpreter-3-LMS-B2.check ├── test-analysis-3B.check ├── test-interpreter-3-LMS-A2.check ├── test-analysis-5A.check └── test-interpreter-4decompile2.check ├── src └── main │ └── scala │ ├── optiml │ ├── library │ │ ├── Vector.scala │ │ ├── ScalaCompanion.scala │ │ └── IndexVector.scala │ ├── Util.scala │ └── macros │ │ └── Runner.scala │ ├── lancet │ ├── core │ │ ├── Base_Comp.scala │ │ ├── Base.scala │ │ └── Base_Exec.scala │ ├── interpreter │ │ └── CCompile.scala │ └── api │ │ └── demo │ └── generated │ └── scala │ ├── IntUnsupervisedTrainingSet.scala │ ├── LongUnsupervisedTrainingSet.scala │ ├── FloatUnsupervisedTrainingSet.scala │ ├── UnsupervisedTrainingSet.scala │ ├── BooleanUnsupervisedTrainingSet.scala │ ├── DoubleUnsupervisedTrainingSet.scala │ ├── DeliteStructs.scala │ ├── IntIntSupervisedTrainingSet.scala │ ├── FloatIntSupervisedTrainingSet.scala │ ├── IntFloatSupervisedTrainingSet.scala │ ├── IntLongSupervisedTrainingSet.scala │ ├── LongIntSupervisedTrainingSet.scala │ ├── LongLongSupervisedTrainingSet.scala │ ├── BooleanIntSupervisedTrainingSet.scala │ ├── DoubleIntSupervisedTrainingSet.scala │ ├── DoubleLongSupervisedTrainingSet.scala │ ├── FloatFloatSupervisedTrainingSet.scala │ ├── FloatLongSupervisedTrainingSet.scala │ ├── IntBooleanSupervisedTrainingSet.scala │ ├── IntDoubleSupervisedTrainingSet.scala │ ├── LongDoubleSupervisedTrainingSet.scala │ ├── LongFloatSupervisedTrainingSet.scala │ ├── Similarity.scala │ ├── SupervisedTrainingSet.scala │ ├── BooleanLongSupervisedTrainingSet.scala │ ├── DoubleFloatSupervisedTrainingSet.scala │ ├── FloatDoubleSupervisedTrainingSet.scala │ ├── LongBooleanSupervisedTrainingSet.scala │ ├── BooleanDoubleSupervisedTrainingSet.scala │ ├── BooleanFloatSupervisedTrainingSet.scala │ ├── DoubleBooleanSupervisedTrainingSet.scala │ ├── DoubleDoubleSupervisedTrainingSet.scala │ ├── FloatBooleanSupervisedTrainingSet.scala │ ├── Rect.scala │ ├── BooleanBooleanSupervisedTrainingSet.scala │ ├── PairwiseRating.scala │ ├── Edge.scala │ ├── GrayscaleImage.scala │ ├── Vertex.scala │ ├── BinarizedGradientPyramid.scala │ ├── IntSparseVectorViewCSR.scala │ ├── LongSparseVectorViewCSR.scala │ ├── BiGGDetection.scala │ ├── DoubleSparseVectorViewCSR.scala │ ├── FloatSparseVectorViewCSR.scala │ ├── SparseVectorViewCSR.scala │ ├── BooleanSparseVectorViewCSR.scala │ ├── DenseVectorView.scala │ ├── IntDenseVectorView.scala │ ├── LongDenseVectorView.scala │ ├── FloatDenseVectorView.scala │ ├── DoubleDenseVectorView.scala │ ├── BooleanDenseVectorView.scala │ ├── Global.scala │ ├── IntDenseMatrix.scala │ ├── IntStreamRow.scala │ ├── LongDenseMatrix.scala │ ├── LongStreamRow.scala │ ├── StreamRow.scala │ ├── DenseMatrix.scala │ ├── FloatDenseMatrix.scala │ ├── FloatStreamRow.scala │ ├── DoubleDenseMatrix.scala │ ├── DoubleStreamRow.scala │ ├── BooleanDenseMatrix.scala │ ├── BooleanStreamRow.scala │ ├── DeliteInterfaces.scala │ ├── IntDenseVector.scala │ ├── BinarizedGradientTemplate.scala │ ├── LongDenseVector.scala │ ├── FloatDenseVector.scala │ ├── DenseVector.scala │ ├── DoubleDenseVector.scala │ ├── BooleanDenseVector.scala │ ├── Graph.scala │ ├── IntSparseVector.scala │ ├── LongSparseVector.scala │ ├── FloatSparseVector.scala │ ├── DoubleSparseVector.scala │ ├── SparseVector.scala │ ├── BooleanSparseVector.scala │ ├── IntSparseMatrixCOO.scala │ ├── LongSparseMatrixCOO.scala │ ├── FloatSparseMatrixCOO.scala │ ├── DoubleSparseMatrixCOO.scala │ ├── SparseMatrixCOO.scala │ ├── BooleanSparseMatrixCOO.scala │ ├── IntStream.scala │ ├── Stream.scala │ ├── LongStream.scala │ ├── FloatStream.scala │ ├── DoubleStream.scala │ └── IntSparseMatrixCSR.scala └── grun /NOTES: -------------------------------------------------------------------------------- 1 | (empty) -------------------------------------------------------------------------------- /gsbt.sample: -------------------------------------------------------------------------------- 1 | export JAVA_HOME=~/graalvm/jdk1.7.0-ea/product 2 | 3 | $JAVA_HOME/bin/java -graal \ 4 | -Xms512M -Xmx1G -XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled \ 5 | -jar ~/sbt/sbt-launch.jar "$@" 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | gsbt 2 | .DS_Store 3 | 4 | *.class 5 | *.log 6 | 7 | # sbt specific 8 | dist/* 9 | target/ 10 | lib_managed/ 11 | src_managed/ 12 | project/boot/ 13 | project/plugins/project/ 14 | 15 | # Scala-IDE specific 16 | .scala_dependencies 17 | -------------------------------------------------------------------------------- /test-out/test-analysis-1A.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Put(Static(0),counter,Const(1)) 3 | If(Get(Static(0),counter),{ 4 | Put(Static(1),a,New()) 5 | Put(Get(Static(1),a),foo,Const(5)) 6 | },{ 7 | Put(Static(1),a,New()) 8 | Put(Get(Static(1),a),bar,Const(5)) 9 | }) 10 | } 11 | res: Prim(0) 12 | store: Map(0 -> Map(counter -> Prim(1)), 100 -> Map(foo -> Prim(5)), 1 -> Map(a -> Ref(100))) 13 | -------------------------------------------------------------------------------- /test-out/test-analysis-7A.check: -------------------------------------------------------------------------------- 1 | 24 2 | ---- 3 | def x0:A=>B = { x1 => if (x1 == 0) { 1 } else { x1 * x0(x1 + -1) } }; x0(4) 4 | ---- 5 | def main = { 6 | // build lambda 7 | def f0()(x0)(x1) = { 8 | def f2(x0,x1) = { 9 | f1(x0,x1)(1) 10 | } 11 | def f3(x0,x1) = { 12 | val x2 = x0 + -1 13 | self.apply(x2)(Clos(f4)(x0,x1,x2)) 14 | } 15 | def f4(x0,x1,x2)(x3) = { 16 | val x4 = x0 * x3 17 | f1(x0,x1)(x4) 18 | } 19 | if (x0 == 0) f2(x0,x1) else f3(x0,x1) 20 | } 21 | def f1(x0,x1)(x2) = { 22 | x1.apply(x2) 23 | } 24 | val x0 = Clos(f0)() 25 | x0.apply(4)(Clos(f5)(x0)) 26 | } 27 | def f5(x0)(x1) = { 28 | x1 29 | } 30 | () 31 | -------------------------------------------------------------------------------- /test-out/test-analysis-3E.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(x,New(X)) 3 | Put(Ref(x),a,New(A)) 4 | Put(Get(Ref(x),a),baz,Const(3)) 5 | While(Direct(top.input),{ 6 | Put(Ref(x),a,New(B)) 7 | Put(Get(Ref(x),a),foo,Const(5)) 8 | }) 9 | Put(Get(Ref(x),a),bar,Const(7)) 10 | Assign(xbar,Get(Get(Ref(x),a),bar)) 11 | } 12 | res: undef 13 | env: 14 | allocX -> ORef(allocX0) 15 | allocB -> OWhile(top.input,ORef(allocB0),ORef(allocB0)+{bar -> 7}) 16 | &x -> OStatic(&x)+{val -> allocX} 17 | &xbar -> OStatic(&xbar)+{val -> 7} 18 | allocA -> OWhile(top.input,ONew(A)+{baz -> 3},ONew(A))+{bar -> lphi(top.input:7,undef),baz -> lphi(top.input:undef,3)} 19 | rec: 20 | allocX0 -> OWhile(top.input,ONew(X),ORef(allocX0))+{a -> lphi(top.input:allocA,allocB)} 21 | allocB0 -> OWhile(top.input,OUndef(),ONew(B_loop)+{foo -> 5}) 22 | true: Set() 23 | false: Set(top.input) 24 | ---- 25 | -------------------------------------------------------------------------------- /test-out/test-analysis-3C.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(i,Const(0)) 3 | Assign(z,New(A)) 4 | Assign(x,Ref(z)) 5 | Assign(y,New(B)) 6 | While(Less(Ref(i),Const(100)),{ 7 | Put(Ref(y),head,Ref(i)) 8 | Put(Ref(y),tail,Ref(x)) 9 | Assign(x,Ref(y)) 10 | Assign(i,Plus(Ref(i),Const(1))) 11 | }) 12 | Put(Ref(y),tail,Ref(z)) 13 | Put(Ref(y),head,Const(7)) 14 | } 15 | res: 0 16 | env: 17 | allocB -> ORef(allocB0)+{tail -> allocA,head -> 7} 18 | &x -> OStatic(&x)+{val -> &x0.val} 19 | &i -> OStatic(&i)+{val -> 100} 20 | &z -> OStatic(&z)+{val -> allocA} 21 | &y -> OStatic(&y)+{val -> allocB} 22 | allocA -> ONew(A) 23 | rec: 24 | allocB0 -> OWhile(&i0.val+1<100,ONew(B),ORef(allocB0)+{head -> &i0.val,tail -> &x0.val}) 25 | &x0 -> OStatic(&x)+{val -> lphi(&i0.val+1<100:allocA,allocB)} 26 | &i0 -> OStatic(&i)+{val -> lphi(&i0.val+1<100:0,&i0.val+1)} 27 | true: Set() 28 | false: Set(&i0.val+1<100) 29 | ---- 30 | -------------------------------------------------------------------------------- /test-out/test-analysis-8A.check: -------------------------------------------------------------------------------- 1 | var c = Zero 2 | while loop has converged to state Map(c -> Zero) 3 | --- state after program: Map(c -> Zero) 4 | var c = Zero 5 | c = Pos 6 | while loop changed state from Map(c -> Zero) to Map(c -> Pos), try again 7 | c = Pos 8 | while loop has converged to state Map(c -> Pos) 9 | --- state after program: Map(c -> Pos) 10 | var c = Pos 11 | c = Top 12 | while loop changed state from Map(c -> Pos) to Map(c -> Top), try again 13 | c = Top 14 | while loop has converged to state Map(c -> Top) 15 | --- state after program: Map(c -> Top) 16 | var c = Pos 17 | c = Top 18 | while loop changed state from Map(c -> Pos) to Map(c -> Top), try again 19 | c = Top 20 | while loop has converged to state Map(c -> Top) 21 | var x = Zero 22 | x = Pos 23 | while loop changed state from Map(c -> Top, x -> Zero) to Map(c -> Top, x -> Top), try again 24 | x = Pos 25 | while loop has converged to state Map(c -> Top, x -> Top) 26 | --- state after program: Map(c -> Top, x -> Top) 27 | done 28 | -------------------------------------------------------------------------------- /test-out/test-delite-1A1.check: -------------------------------------------------------------------------------- 1 | ================================================================================================= 2 | TEST: lancet.advanced.TestDelite1$$anonfun$testA1$1$VectorOperatorsRunner$2$@7abe232e 3 | ================================================================================================= 4 | STAGING... 5 | Delite Application Being Staged:[lancet.advanced.TestDelite1$$anonfun$testA1$1$VectorOperatorsRunner$2$] 6 | ******Generating the program****** 7 | EXECUTING... 8 | test output for: lancet.advanced.TestDelite1$$anonfun$testA1$1$VectorOperatorsRunner$2$@7abe232e 9 | Delite Runtime executing with the following arguments: 10 | lancet.advanced.TestDelite1anonfuntestA11VectorOperatorsRunner2-test.deg 11 | Delite Runtime executing with: 1 Scala thread(s), 0 Cpp thread(s), 0 Cuda(s), 0 OpenCL(s) 12 | Beginning Execution Run 1 13 | true 14 | true 15 | true 16 | true 17 | true 18 | AA 19 | BB 20 | CC 21 | !~x02$758209true,true,true,true,true!~x02$758209 22 | [METRICS]: Latest time for component all: 0.031509s 23 | CHECKING... 24 | -------------------------------------------------------------------------------- /src/main/scala/optiml/library/Vector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | -------------------------------------------------------------------------------- /src/main/scala/optiml/Util.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package optiml 23 | 24 | object Util { 25 | def printxx(x:Any) = { println(x) } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/main/scala/lancet/core/Base_Comp.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | 23 | package lancet.core 24 | 25 | 26 | trait Base_Comp extends Base { 27 | 28 | 29 | 30 | } -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntUnsupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntUnsupervisedTrainingSet(val _data: IntDenseMatrix) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongUnsupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongUnsupervisedTrainingSet(val _data: LongDenseMatrix) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatUnsupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatUnsupervisedTrainingSet(val _data: FloatDenseMatrix) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/UnsupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class UnsupervisedTrainingSet[T:Manifest](val _data: DenseMatrix[T]) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanUnsupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class BooleanUnsupervisedTrainingSet(val _data: BooleanDenseMatrix) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleUnsupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleUnsupervisedTrainingSet(val _data: DoubleDenseMatrix) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DeliteStructs.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | case class DenseVectorDouble(var _data: Array[Double], var _length: Int, var _isRow: Boolean) { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/scala/lancet/core/Base.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | 23 | package lancet.core 24 | 25 | trait Base { 26 | type Rep[+T] 27 | type TypeRep[T] 28 | def repManifest[T:Manifest]: Manifest[Rep[T]] 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntIntSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntIntSupervisedTrainingSet(val _data: IntDenseMatrix, val _labels: IntDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/lancet/core/Base_Exec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | 23 | package lancet.core 24 | 25 | trait Base_Exec extends Base { 26 | type Rep[+T] = T 27 | def repManifest[T:Manifest]: Manifest[T] = manifest[T] 28 | } 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatIntSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatIntSupervisedTrainingSet(val _data: FloatDenseMatrix, val _labels: IntDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntFloatSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntFloatSupervisedTrainingSet(val _data: IntDenseMatrix, val _labels: FloatDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntLongSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntLongSupervisedTrainingSet(val _data: IntDenseMatrix, val _labels: LongDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongIntSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongIntSupervisedTrainingSet(val _data: LongDenseMatrix, val _labels: IntDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongLongSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongLongSupervisedTrainingSet(val _data: LongDenseMatrix, val _labels: LongDenseVector) 27 | -------------------------------------------------------------------------------- /grun: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export JAVA_HOME=~/src/graal/jdk1.7.0_17/product 4 | 5 | 6 | if [ $# -lt 1 ] 7 | then 8 | echo "usage: grun " 9 | echo "example: grun optiml.apps.kmeans" 10 | exit 11 | fi 12 | 13 | # scala 14 | export JAVA_CLASSPATH=$JAVA_CLASSPATH:~/.sbt/boot/scala-2.10.0-M1-virtualized/lib/* 15 | 16 | # lms, delite 17 | export JAVA_CLASSPATH=$JAVA_CLASSPATH:lib_managed/jars/EPFL/lms_2.10.0-M1-virtualized/*:lib_managed/jars/stanford-ppl/framework_2.10.0-M1-virtualized/*:lib_managed/jars/stanford-ppl/optila_2.10.0-M1-virtualized/*:lib_managed/jars/stanford-ppl/optiml_2.10.0-M1-virtualized/*:lib_managed/jars/stanford-ppl/runtime_2.10.0-M1-virtualized/* 18 | 19 | # cluster stuff 20 | export JAVA_CLASSPATH=$JAVA_CLASSPATH:lib_managed/jars/com.google.protobuf/protobuf-java/*:lib_managed/jars/org.apache.mesos/mesos/* 21 | 22 | # lancet 23 | export JAVA_CLASSPATH=$JAVA_CLASSPATH:target/scala-2.10/classes/ 24 | 25 | export JAVA_OPTS="-Xms512M -Xmx1G -XX:+CMSClassUnloadingEnabled -Xss10m" # -XX:-BootstrapGraal 26 | export JAVA_OPTS="$JAVA_OPTS -Ddelite.home.dir=$DELITE_HOME" # -Dlms.verbosity=3" 27 | 28 | $JAVA_HOME/bin/java -graal $JAVA_OPTS -cp $JAVA_CLASSPATH "$@" 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanIntSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class BooleanIntSupervisedTrainingSet(val _data: BooleanDenseMatrix, val _labels: IntDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleIntSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleIntSupervisedTrainingSet(val _data: DoubleDenseMatrix, val _labels: IntDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleLongSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleLongSupervisedTrainingSet(val _data: DoubleDenseMatrix, val _labels: LongDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatFloatSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatFloatSupervisedTrainingSet(val _data: FloatDenseMatrix, val _labels: FloatDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatLongSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatLongSupervisedTrainingSet(val _data: FloatDenseMatrix, val _labels: LongDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntBooleanSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntBooleanSupervisedTrainingSet(val _data: IntDenseMatrix, val _labels: BooleanDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntDoubleSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntDoubleSupervisedTrainingSet(val _data: IntDenseMatrix, val _labels: DoubleDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongDoubleSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongDoubleSupervisedTrainingSet(val _data: LongDenseMatrix, val _labels: DoubleDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongFloatSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongFloatSupervisedTrainingSet(val _data: LongDenseMatrix, val _labels: FloatDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Similarity.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala.application 23 | import generated.scala._ 24 | 25 | class Similarity ( 26 | val a: Int, 27 | val b: Int, 28 | val value: Double 29 | ) 30 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/SupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class SupervisedTrainingSet[T:Manifest,L:Manifest](val _data: DenseMatrix[T], val _labels: DenseVector[L]) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanLongSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class BooleanLongSupervisedTrainingSet(val _data: BooleanDenseMatrix, val _labels: LongDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleFloatSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleFloatSupervisedTrainingSet(val _data: DoubleDenseMatrix, val _labels: FloatDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatDoubleSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatDoubleSupervisedTrainingSet(val _data: FloatDenseMatrix, val _labels: DoubleDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongBooleanSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongBooleanSupervisedTrainingSet(val _data: LongDenseMatrix, val _labels: BooleanDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanDoubleSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class BooleanDoubleSupervisedTrainingSet(val _data: BooleanDenseMatrix, val _labels: DoubleDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanFloatSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class BooleanFloatSupervisedTrainingSet(val _data: BooleanDenseMatrix, val _labels: FloatDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleBooleanSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleBooleanSupervisedTrainingSet(val _data: DoubleDenseMatrix, val _labels: BooleanDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleDoubleSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleDoubleSupervisedTrainingSet(val _data: DoubleDenseMatrix, val _labels: DoubleDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatBooleanSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatBooleanSupervisedTrainingSet(val _data: FloatDenseMatrix, val _labels: BooleanDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Rect.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala.application 23 | import generated.scala._ 24 | 25 | class Rect ( 26 | val x: Int, 27 | val y: Int, 28 | val width: Int, 29 | val height: Int 30 | ) 31 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanBooleanSupervisedTrainingSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class BooleanBooleanSupervisedTrainingSet(val _data: BooleanDenseMatrix, val _labels: BooleanDenseVector) 27 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/PairwiseRating.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala.application 23 | import generated.scala._ 24 | 25 | class PairwiseRating ( 26 | val profileA: Int, 27 | val profileB: Int, 28 | val scoreA: Int, 29 | val scoreB: Int 30 | ) 31 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Edge.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class Edge[VD:Manifest,ED:Manifest]( 27 | val _graph: Graph[VD,ED], 28 | var _inData: ED, 29 | var _outData: ED, 30 | val _v1: Vertex[VD,ED], 31 | val _v2: Vertex[VD,ED] 32 | ) 33 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/GrayscaleImage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class GrayscaleImage(nRows: Int, nCols: Int) { 27 | var _numRows = nRows 28 | var _numCols = nCols 29 | var _data: Array[Double] = new Array[Double](nRows*nCols) 30 | } 31 | -------------------------------------------------------------------------------- /test-out/test-analysis-1B.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | If(Get(Static(0),counter),{ 3 | Put(Static(1),a,New()) 4 | Put(Get(Static(1),a),foo,Const(5)) 5 | },{ 6 | Put(Static(1),a,New()) 7 | Put(Get(Static(1),a),bar,Const(5)) 8 | }) 9 | } 10 | c Set(0, 5, 1, 6, 9, 2, 7, 3, 8, 4) 11 | res: Prim(Set(0)) 12 | store: 13 | (0,Map(counter -> Prim(Set(0, 5, 1, 6, 9, 2, 7, 3, 8, 4)))) 14 | (1,Map(a -> Ref(Set(100, 101)))) 15 | (100,Map(foo -> Prim(Set(5)))) 16 | (101,Map(bar -> Prim(Set(5)))) 17 | prog: { 18 | Put(Static(1),a,New()) 19 | Put(Get(Static(1),a),baz,Const(3)) 20 | If(Get(Static(0),counter),{ 21 | Put(Static(1),a,New()) 22 | Put(Get(Static(1),a),foo,Const(5)) 23 | },{ 24 | Put(Static(1),a,New()) 25 | Put(Get(Static(1),a),bar,Const(5)) 26 | }) 27 | Put(Get(Static(1),a),bar,Const(7)) 28 | } 29 | c Set(0, 5, 1, 6, 9, 2, 7, 3, 8, 4) 30 | res: Prim(Set(0)) 31 | store: 32 | (0,Map(counter -> Prim(Set(0, 5, 1, 6, 9, 2, 7, 3, 8, 4)))) 33 | (1,Map(a -> Ref(Set(102, 103, 104)))) 34 | (102,Map(baz -> Prim(Set(3)), foo -> Prim(Set(5)), bar -> Prim(Set(5, 7)))) 35 | (103,Map(baz -> Prim(Set(3)), foo -> Prim(Set(5)), bar -> Prim(Set(7)))) 36 | (104,Map(baz -> Prim(Set(3)), bar -> Prim(Set(5, 7)), foo -> Prim(Set(5)))) 37 | imprecision due to lack of strong updates: 38 | 1.a still seems to have a baz field, but cannot! 39 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Vertex.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | import collection.mutable.ArrayBuffer 26 | 27 | class Vertex[VD:Manifest,ED:Manifest]( 28 | val _graph: Graph[VD,ED], 29 | var _data: VD) { 30 | val _tasks = new ArrayBuffer[Vertex[VD,ED]] 31 | } 32 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3B1.check: -------------------------------------------------------------------------------- 1 | // constants: ,lancet.interpreter.BaseTestInterpreter3$Bar@58e979d9 2 | class Generated0(CONST_0: lancet.interpreter.BaseTestInterpreter3$$anonfun$testB1$1$$anonfun$4,CONST_1: lancet.interpreter.BaseTestInterpreter3$Bar) extends (Int=>Int){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: Int): Int = { object BODY { 9 | var RES = null.asInstanceOf[Int] 10 | val x0 = ARG 11 | val x1 = x0.asInstanceOf[Int] 12 | val x2 = 0 >= x1 13 | if (x2) { 14 | val x4 = unsafe.getInt(CONST_1,12L) 15 | val LUB_CONST_1_intField = x4 // XXX LUBC(Some(LUB_CONST_1_intField),None) 16 | BLOCK_4(LUB_CONST_1_intField,x0,x1,x2) 17 | } else { 18 | unsafe.putInt(CONST_1,12L, 9) 19 | ;{ 20 | val LUB_CONST_1_intField = 9 // Alias(Some(LUB_CONST_1_intField),Some(9)) 21 | BLOCK_4(LUB_CONST_1_intField,x0,x1,x2) 22 | } 23 | } 24 | def BLOCK_4(LUB_CONST_1_intField:Int,x0:Int,x1:Int,x2:Boolean): Unit = { 25 | (RES = LUB_CONST_1_intField) // return to root 26 | } 27 | // (no return?) 28 | }; BODY.RES } 29 | } 30 | 31 | compilation: ok 32 | 9 33 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3A1.check: -------------------------------------------------------------------------------- 1 | // constants: , 2 | class Generated0(CONST_0: lancet.interpreter.BaseTestInterpreter3$$anonfun$testA1$1$$anonfun$1,CONST_1: lancet.interpreter.BaseTestInterpreter3$$anonfun$testA1$1) extends (Int=>Int){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: Int): Int = { object BODY { 9 | var RES = null.asInstanceOf[Int] 10 | val x0 = ARG 11 | val x1 = x0.asInstanceOf[Int] 12 | val x2 = unsafe.allocateInstance(Class.forName("lancet.interpreter.BaseTestInterpreter3$Bar")) 13 | unsafe.putInt(x2,12L, 7) 14 | val x3 = 0 >= x1 15 | if (x3) { 16 | val LUB_x2_intField = 7 // Alias(Some(LUB_x2_intField),Some(7)) 17 | BLOCK_12(LUB_x2_intField,x0,x1,x2,x3) 18 | } else { 19 | unsafe.putInt(x2,12L, 9) 20 | ;{ 21 | val LUB_x2_intField = 9 // Alias(Some(LUB_x2_intField),Some(9)) 22 | BLOCK_12(LUB_x2_intField,x0,x1,x2,x3) 23 | } 24 | } 25 | def BLOCK_12(LUB_x2_intField:Int,x0:Int,x1:Int,x2:Object,x3:Boolean): Unit = { 26 | (RES = LUB_x2_intField) // return to root 27 | } 28 | // (no return?) 29 | }; BODY.RES } 30 | } 31 | 32 | compilation: ok 33 | 9 34 | -------------------------------------------------------------------------------- /test-out/test-analysis-6A.check: -------------------------------------------------------------------------------- 1 | cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil())))))) 2 | ---- 3 | cons(d(),cons(e(),cons(f(),nil()))) 4 | ---- 5 | cons(a(),cons(b(),cons(c(),nil()))) 6 | ---- 7 | pair(nil(),cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil()))))))) 8 | pair(cons(a(),nil()),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil())))))) 9 | pair(cons(a(),cons(b(),nil())),cons(c(),cons(d(),cons(e(),cons(f(),nil()))))) 10 | pair(cons(a(),cons(b(),cons(c(),nil()))),cons(d(),cons(e(),cons(f(),nil())))) 11 | pair(cons(a(),cons(b(),cons(c(),cons(d(),nil())))),cons(e(),cons(f(),nil()))) 12 | pair(cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),nil()))))),cons(f(),nil())) 13 | pair(cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil())))))),nil()) 14 | ---- 15 | pair(nil(),cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil()))))))) 16 | pair(cons(a(),nil()),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil())))))) 17 | pair(cons(a(),cons(b(),nil())),cons(c(),cons(d(),cons(e(),cons(f(),nil()))))) 18 | pair(cons(a(),cons(b(),cons(c(),nil()))),cons(d(),cons(e(),cons(f(),nil())))) 19 | pair(cons(a(),cons(b(),cons(c(),cons(d(),nil())))),cons(e(),cons(f(),nil()))) 20 | pair(cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),nil()))))),cons(f(),nil())) 21 | pair(cons(a(),cons(b(),cons(c(),cons(d(),cons(e(),cons(f(),nil())))))),nil()) 22 | ---- 23 | pair(x1,x1) 24 | ---- 25 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BinarizedGradientPyramid.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala.application 23 | 24 | import generated.scala._ 25 | 26 | 27 | class BinarizedGradientPyramid ( 28 | val pyramid: DenseVector[GrayscaleImage], 29 | val start_level: Int, 30 | val levels: Int, 31 | val fixedLevelIndex: Int 32 | ) 33 | 34 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntSparseVectorViewCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class IntSparseVectorViewCSR(val _source: IntSparseMatrixCSR, 25 | val _start: Int, 26 | val _stride: Int, 27 | val _length: Int, 28 | val _isRow: Boolean) 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongSparseVectorViewCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class LongSparseVectorViewCSR(val _source: LongSparseMatrixCSR, 25 | val _start: Int, 26 | val _stride: Int, 27 | val _length: Int, 28 | val _isRow: Boolean) 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BiGGDetection.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala.application 23 | import generated.scala._ 24 | 25 | class BiGGDetection ( 26 | val name: String, 27 | val score: Float, 28 | val roi: Rect, 29 | val mask: GrayscaleImage, 30 | val index: Int, 31 | val x: Int, 32 | val y: Int, 33 | val tpl: BinarizedGradientTemplate, 34 | val crt_tpl: BinarizedGradientTemplate 35 | ) 36 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleSparseVectorViewCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class DoubleSparseVectorViewCSR(val _source: DoubleSparseMatrixCSR, 25 | val _start: Int, 26 | val _stride: Int, 27 | val _length: Int, 28 | val _isRow: Boolean) 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatSparseVectorViewCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class FloatSparseVectorViewCSR(val _source: FloatSparseMatrixCSR, 25 | val _start: Int, 26 | val _stride: Int, 27 | val _length: Int, 28 | val _isRow: Boolean) 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/SparseVectorViewCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class SparseVectorViewCSR[T:Manifest](val _source: SparseMatrixCSR[T], 25 | val _start: Int, 26 | val _stride: Int, 27 | val _length: Int, 28 | val _isRow: Boolean) 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanSparseVectorViewCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class BooleanSparseVectorViewCSR(val _source: BooleanSparseMatrixCSR, 25 | val _start: Int, 26 | val _stride: Int, 27 | val _length: Int, 28 | val _isRow: Boolean) 29 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DenseVectorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class DenseVectorView[T:Manifest](val _data: Array[T], val _start: Int, val _stride: Int, val _length: Int, val _isRow: Boolean) { 25 | 26 | private def idx(n: Int) = _start + n*_stride 27 | 28 | def apply(n: Int) : T = { 29 | _data(idx(n)) 30 | } 31 | 32 | def update(n: Int, x: T) { 33 | _data(idx(n)) = x 34 | } 35 | 36 | def unsafeSetData(xs: Array[T], len: Int) = throw new UnsupportedOperationException() 37 | } 38 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntDenseVectorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class IntDenseVectorView(val _data: Array[Int], val _start: Int, val _stride: Int, val _length: Int, val _isRow: Boolean) { 25 | 26 | private def idx(n: Int) = _start + n*_stride 27 | 28 | def apply(n: Int) : Int = { 29 | _data(idx(n)) 30 | } 31 | 32 | def update(n: Int, x: Int) { 33 | _data(idx(n)) = x 34 | } 35 | 36 | def unsafeSetData(xs: Array[Int], len: Int) = throw new UnsupportedOperationException() 37 | } 38 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongDenseVectorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class LongDenseVectorView(val _data: Array[Long], val _start: Int, val _stride: Int, val _length: Int, val _isRow: Boolean) { 25 | 26 | private def idx(n: Int) = _start + n*_stride 27 | 28 | def apply(n: Int) : Long = { 29 | _data(idx(n)) 30 | } 31 | 32 | def update(n: Int, x: Long) { 33 | _data(idx(n)) = x 34 | } 35 | 36 | def unsafeSetData(xs: Array[Long], len: Int) = throw new UnsupportedOperationException() 37 | } 38 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3B2.check: -------------------------------------------------------------------------------- 1 | // constants: ,lancet.interpreter.BaseTestInterpreter3$Bar@3b1566da 2 | class Generated0(CONST_0: lancet.interpreter.BaseTestInterpreter3$$anonfun$testB2$1$$anonfun$5,CONST_1: lancet.interpreter.BaseTestInterpreter3$Bar) extends (Int=>Int){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: Int): Int = { object BODY { 9 | var RES = null.asInstanceOf[Int] 10 | val x0 = ARG 11 | val x1 = x0.asInstanceOf[Int] 12 | ;{ 13 | val PHI_3_5 = x1 // LUBC(PHI_3_5:Int,x1:Int) 14 | val x10 = unsafe.getInt(CONST_1,12L) 15 | val LUB_CONST_1_intField = x10 // XXX LUBC(Some(LUB_CONST_1_intField),None) 16 | BLOCK_2(LUB_CONST_1_intField,PHI_3_5,x0,x1) 17 | } 18 | def BLOCK_2(LUB_CONST_1_intField:Int,PHI_3_5:Int,x0:Int,x1:Int): Unit = { 19 | val x6 = 0 >= PHI_3_5 20 | if (x6) { 21 | (RES = LUB_CONST_1_intField) // return to root 22 | } else { 23 | val x7 = 1 + LUB_CONST_1_intField 24 | unsafe.putInt(CONST_1,12L, x7) 25 | val x8 = -1 + PHI_3_5 26 | ;{ 27 | val PHI_3_5 = x8 // LUBC(PHI_3_5:Int,x8:Int) 28 | val LUB_CONST_1_intField = x7 // Alias(Some(LUB_CONST_1_intField),Some(x7)) 29 | BLOCK_2(LUB_CONST_1_intField,PHI_3_5,x0,x1) 30 | } 31 | } 32 | } 33 | // (no return?) 34 | }; BODY.RES } 35 | } 36 | 37 | compilation: ok 38 | 14 39 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatDenseVectorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class FloatDenseVectorView(val _data: Array[Float], val _start: Int, val _stride: Int, val _length: Int, val _isRow: Boolean) { 25 | 26 | private def idx(n: Int) = _start + n*_stride 27 | 28 | def apply(n: Int) : Float = { 29 | _data(idx(n)) 30 | } 31 | 32 | def update(n: Int, x: Float) { 33 | _data(idx(n)) = x 34 | } 35 | 36 | def unsafeSetData(xs: Array[Float], len: Int) = throw new UnsupportedOperationException() 37 | } 38 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleDenseVectorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class DoubleDenseVectorView(val _data: Array[Double], val _start: Int, val _stride: Int, val _length: Int, val _isRow: Boolean) { 25 | 26 | private def idx(n: Int) = _start + n*_stride 27 | 28 | def apply(n: Int) : Double = { 29 | _data(idx(n)) 30 | } 31 | 32 | def update(n: Int, x: Double) { 33 | _data(idx(n)) = x 34 | } 35 | 36 | def unsafeSetData(xs: Array[Double], len: Int) = throw new UnsupportedOperationException() 37 | } 38 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanDenseVectorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class BooleanDenseVectorView(val _data: Array[Boolean], val _start: Int, val _stride: Int, val _length: Int, val _isRow: Boolean) { 25 | 26 | private def idx(n: Int) = _start + n*_stride 27 | 28 | def apply(n: Int) : Boolean = { 29 | _data(idx(n)) 30 | } 31 | 32 | def update(n: Int, x: Boolean) { 33 | _data(idx(n)) = x 34 | } 35 | 36 | def unsafeSetData(xs: Array[Boolean], len: Int) = throw new UnsupportedOperationException() 37 | } 38 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3A2.check: -------------------------------------------------------------------------------- 1 | // constants: , 2 | class Generated0(CONST_0: lancet.interpreter.BaseTestInterpreter3$$anonfun$testA2$1$$anonfun$2,CONST_1: lancet.interpreter.BaseTestInterpreter3$$anonfun$testA2$1) extends (Int=>Int){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: Int): Int = { object BODY { 9 | var RES = null.asInstanceOf[Int] 10 | val x0 = ARG 11 | val x1 = x0.asInstanceOf[Int] 12 | val x2 = unsafe.allocateInstance(Class.forName("lancet.interpreter.BaseTestInterpreter3$Bar")) 13 | unsafe.putInt(x2,12L, 7) 14 | ;{ 15 | val PHI_3_6 = x1 // LUBC(PHI_3_6:Int,x1:Int) 16 | val LUB_x2_intField = 7 // Alias(Some(LUB_x2_intField),Some(7)) 17 | BLOCK_10(LUB_x2_intField,PHI_3_6,x0,x1,x2) 18 | } 19 | def BLOCK_10(LUB_x2_intField:Int,PHI_3_6:Int,x0:Int,x1:Int,x2:Object): Unit = { 20 | val x5 = 0 >= PHI_3_6 21 | if (x5) { 22 | (RES = LUB_x2_intField) // return to root 23 | } else { 24 | val x6 = 1 + LUB_x2_intField 25 | unsafe.putInt(x2,12L, x6) 26 | val x7 = -1 + PHI_3_6 27 | ;{ 28 | val PHI_3_6 = x7 // LUBC(PHI_3_6:Int,x7:Int) 29 | val LUB_x2_intField = x6 // Alias(Some(LUB_x2_intField),Some(x6)) 30 | BLOCK_10(LUB_x2_intField,PHI_3_6,x0,x1,x2) 31 | } 32 | } 33 | } 34 | // (no return?) 35 | }; BODY.RES } 36 | } 37 | 38 | compilation: ok 39 | 14 40 | -------------------------------------------------------------------------------- /test-out/test-analysis-2A.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(i,Const(0)) 3 | Assign(y,Const(0)) 4 | Assign(x,Const(8)) 5 | While(Less(Ref(i),Const(100)),{ 6 | Assign(x,Const(7)) 7 | Assign(x,Plus(Ref(x),Const(1))) 8 | Assign(y,Plus(Ref(y),Const(1))) 9 | Assign(i,Plus(Ref(i),Const(1))) 10 | }) 11 | } 12 | res: -668 13 | env: 14 | i -> 100 15 | y -> y0 16 | x -> 8 17 | rec: 18 | i0 -> lphi(i0+1<100:0,i0+1) 19 | y0 -> lphi(i0+1<100:0,y0+1) 20 | true: Set() 21 | false: Set(i0+1<100) 22 | i -> [100,100] 23 | y -> [?] 24 | x -> [8,8] 25 | ---- 26 | prog: { 27 | Assign(x,Const(900)) 28 | Assign(y,Const(0)) 29 | Assign(z,Const(0)) 30 | While(Less(Const(0),Ref(x)),{ 31 | Assign(z,Plus(Ref(z),Ref(x))) 32 | If(Less(Ref(y),Const(17)),{ 33 | Assign(y,Plus(Ref(y),Const(1))) 34 | },{ 35 | 36 | }) 37 | Assign(x,Plus(Ref(x),Const(-1))) 38 | }) 39 | Assign(r,Ref(x)) 40 | } 41 | mayZero y0<17 42 | env: 43 | x -> x0 44 | y -> y0 45 | z -> z0+x0 46 | rec: 47 | x0 -> lphi(1:900,899) 48 | y0 -> lphi(1:0,1) 49 | z0 -> lphi(1:0,900) 50 | true: Set(1) 51 | false: Set() 52 | mayZero y0<17 53 | env: 54 | x -> x0 55 | y -> y0 56 | z -> z0+x0 57 | rec: 58 | x0 -> lphi(0 lphi(0 lphi(0 0 66 | y -> y0 67 | z -> z0 68 | r -> 0 69 | rec: 70 | x0 -> lphi(0 lphi(0 lphi(0 [0,0] 76 | y -> [?] 77 | z -> [?] 78 | r -> [0,0] 79 | ---- 80 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Global.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* Global values used in generated OptiLA code. 25 | * 26 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 27 | * created: 12/30/10 28 | * 29 | * Pervasive Parallelism Laboratory (PPL) 30 | * Stanford University 31 | * 32 | */ 33 | 34 | object Global { 35 | 36 | ////////////////////////////////////// 37 | // random vars (these are thread-safe) 38 | 39 | val INITIAL_SEED = 100 40 | var randRef = new scala.util.Random(INITIAL_SEED) 41 | var intRandRef = new scala.util.Random(INITIAL_SEED) 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntDenseMatrix.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class IntDenseMatrix(nRows: Int, nCols: Int) { 25 | var _numRows = nRows 26 | var _numCols = nCols 27 | var _data: Array[Int] = new Array[Int](nRows*nCols) 28 | 29 | /** 30 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 31 | */ 32 | def unsafeSetData(xs: Array[Int], len: Int) { 33 | _data = xs 34 | // _length = len 35 | } 36 | 37 | def Clone = { 38 | val res = new IntDenseMatrix(_numRows, _numCols) 39 | res._data = _data.clone 40 | res 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntStreamRow.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | /* StreamRowImpl wraps a DenseVectorView that represents a Stream row. 27 | * 28 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 29 | * created: 3/15/11 30 | * 31 | * Pervasive Parallelism Laboratory (PPL) 32 | * Stanford University 33 | * 34 | */ 35 | 36 | class IntStreamRow(chunkRow: Int, offset: Int, stream: IntStream, x: Array[Int]) 37 | extends IntDenseVectorView(x, chunkRow*stream.numCols, 1, stream.numCols, true) { 38 | 39 | // absolute row index in the stream 40 | val index = offset*stream.chunkSize + chunkRow 41 | } 42 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongDenseMatrix.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class LongDenseMatrix(nRows: Int, nCols: Int) { 25 | var _numRows = nRows 26 | var _numCols = nCols 27 | var _data: Array[Long] = new Array[Long](nRows*nCols) 28 | 29 | /** 30 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 31 | */ 32 | def unsafeSetData(xs: Array[Long], len: Int) { 33 | _data = xs 34 | // _length = len 35 | } 36 | 37 | def Clone = { 38 | val res = new LongDenseMatrix(_numRows, _numCols) 39 | res._data = _data.clone 40 | res 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongStreamRow.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | /* StreamRowImpl wraps a DenseVectorView that represents a Stream row. 27 | * 28 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 29 | * created: 3/15/11 30 | * 31 | * Pervasive Parallelism Laboratory (PPL) 32 | * Stanford University 33 | * 34 | */ 35 | 36 | class LongStreamRow(chunkRow: Int, offset: Int, stream: LongStream, x: Array[Long]) 37 | extends LongDenseVectorView(x, chunkRow*stream.numCols, 1, stream.numCols, true) { 38 | 39 | // absolute row index in the stream 40 | val index = offset*stream.chunkSize + chunkRow 41 | } 42 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/StreamRow.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | /* StreamRowImpl wraps a DenseVectorView that represents a Stream row. 27 | * 28 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 29 | * created: 3/15/11 30 | * 31 | * Pervasive Parallelism Laboratory (PPL) 32 | * Stanford University 33 | * 34 | */ 35 | 36 | class StreamRow[T:Manifest](chunkRow: Int, offset: Int, stream: Stream[T], x: Array[T]) 37 | extends DenseVectorView[T](x, chunkRow*stream.numCols, 1, stream.numCols, true) { 38 | 39 | // absolute row index in the stream 40 | val index = offset*stream.chunkSize + chunkRow 41 | } 42 | -------------------------------------------------------------------------------- /test-out/test-analysis-4A2.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(x,Const(0)) 3 | Assign(a,New(A)) 4 | Put(Ref(a),Const(field),Times(Ref(x),Const(2))) 5 | Assign(r,Ref(a)) 6 | } 7 | val x0 = Map() 8 | val x1 = Map("val" -> 0) 9 | val x2 = Map("&x" -> x1) 10 | val x3 = Map("&x" -> x1, (A,1) -> Map()) 11 | val x4 = Map("val" -> (A,1)) 12 | val x5 = Map("&x" -> x1, "&a" -> x4) 13 | val x6 = Map("field" -> 0) 14 | val x7 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6) 15 | val x8 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6, "&r" -> x4) 16 | res: () 17 | store: x8 18 | transformed: x8 19 | sched: 20 | val x6 = Map("field" -> 0) 21 | val x4 = Map("val" -> (A,1)) 22 | val x1 = Map("val" -> 0) 23 | val x8 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6, "&r" -> x4) 24 | term: 25 | Map("&x" -> Map("val" -> 0), "&a" -> Map("val" -> (A,1)), (A,1) -> Map("field" -> 0), "&r" -> Map("val" -> (A,1))) 26 | ---- 27 | prog: { 28 | Assign(x,Const(0)) 29 | Assign(a,New(A)) 30 | Put(Ref(a),Ref(x),Times(Ref(x),Const(2))) 31 | Assign(r,Ref(a)) 32 | } 33 | val x0 = Map() 34 | val x1 = Map("val" -> 0) 35 | val x2 = Map("&x" -> x1) 36 | val x3 = Map("&x" -> x1, (A,1) -> Map()) 37 | val x4 = Map("val" -> (A,1)) 38 | val x5 = Map("&x" -> x1, "&a" -> x4) 39 | val x6 = Map(0 -> 0) 40 | val x7 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6) 41 | val x8 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6, "&r" -> x4) 42 | res: () 43 | store: x8 44 | transformed: x8 45 | sched: 46 | val x6 = Map(0 -> 0) 47 | val x4 = Map("val" -> (A,1)) 48 | val x1 = Map("val" -> 0) 49 | val x8 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6, "&r" -> x4) 50 | term: 51 | Map("&x" -> Map("val" -> 0), "&a" -> Map("val" -> (A,1)), (A,1) -> Map(0 -> 0), "&r" -> Map("val" -> (A,1))) 52 | ---- 53 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DenseMatrix.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class DenseMatrix[@specialized T: Manifest](nRows: Int, nCols: Int) { 25 | var _numRows = nRows 26 | var _numCols = nCols 27 | var _data: Array[T] = new Array[T](nRows*nCols) 28 | 29 | /** 30 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 31 | */ 32 | def unsafeSetData(xs: Array[T], len: Int) { 33 | _data = xs 34 | // _length = len 35 | } 36 | 37 | def Clone = { 38 | val res = new DenseMatrix[T](_numRows, _numCols) 39 | res._data = _data.clone 40 | res 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatDenseMatrix.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class FloatDenseMatrix(nRows: Int, nCols: Int) { 25 | var _numRows = nRows 26 | var _numCols = nCols 27 | var _data: Array[Float] = new Array[Float](nRows*nCols) 28 | 29 | /** 30 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 31 | */ 32 | def unsafeSetData(xs: Array[Float], len: Int) { 33 | _data = xs 34 | // _length = len 35 | } 36 | 37 | def Clone = { 38 | val res = new FloatDenseMatrix(_numRows, _numCols) 39 | res._data = _data.clone 40 | res 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatStreamRow.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | /* StreamRowImpl wraps a DenseVectorView that represents a Stream row. 27 | * 28 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 29 | * created: 3/15/11 30 | * 31 | * Pervasive Parallelism Laboratory (PPL) 32 | * Stanford University 33 | * 34 | */ 35 | 36 | class FloatStreamRow(chunkRow: Int, offset: Int, stream: FloatStream, x: Array[Float]) 37 | extends FloatDenseVectorView(x, chunkRow*stream.numCols, 1, stream.numCols, true) { 38 | 39 | // absolute row index in the stream 40 | val index = offset*stream.chunkSize + chunkRow 41 | } 42 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleDenseMatrix.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class DoubleDenseMatrix(nRows: Int, nCols: Int) { 25 | var _numRows = nRows 26 | var _numCols = nCols 27 | var _data: Array[Double] = new Array[Double](nRows*nCols) 28 | 29 | /** 30 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 31 | */ 32 | def unsafeSetData(xs: Array[Double], len: Int) { 33 | _data = xs 34 | // _length = len 35 | } 36 | 37 | def Clone = { 38 | val res = new DoubleDenseMatrix(_numRows, _numCols) 39 | res._data = _data.clone 40 | res 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleStreamRow.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | /* StreamRowImpl wraps a DenseVectorView that represents a Stream row. 27 | * 28 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 29 | * created: 3/15/11 30 | * 31 | * Pervasive Parallelism Laboratory (PPL) 32 | * Stanford University 33 | * 34 | */ 35 | 36 | class DoubleStreamRow(chunkRow: Int, offset: Int, stream: DoubleStream, x: Array[Double]) 37 | extends DoubleDenseVectorView(x, chunkRow*stream.numCols, 1, stream.numCols, true) { 38 | 39 | // absolute row index in the stream 40 | val index = offset*stream.chunkSize + chunkRow 41 | } 42 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanDenseMatrix.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | class BooleanDenseMatrix(nRows: Int, nCols: Int) { 25 | var _numRows = nRows 26 | var _numCols = nCols 27 | var _data: Array[Boolean] = new Array[Boolean](nRows*nCols) 28 | 29 | /** 30 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 31 | */ 32 | def unsafeSetData(xs: Array[Boolean], len: Int) { 33 | _data = xs 34 | // _length = len 35 | } 36 | 37 | def Clone = { 38 | val res = new BooleanDenseMatrix(_numRows, _numCols) 39 | res._data = _data.clone 40 | res 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanStreamRow.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | /* StreamRowImpl wraps a DenseVectorView that represents a Stream row. 27 | * 28 | * author: Arvind Sujeeth (asujeeth@stanford.edu) 29 | * created: 3/15/11 30 | * 31 | * Pervasive Parallelism Laboratory (PPL) 32 | * Stanford University 33 | * 34 | */ 35 | 36 | class BooleanStreamRow(chunkRow: Int, offset: Int, stream: BooleanStream, x: Array[Boolean]) 37 | extends BooleanDenseVectorView(x, chunkRow*stream.numCols, 1, stream.numCols, true) { 38 | 39 | // absolute row index in the stream 40 | val index = offset*stream.chunkSize + chunkRow 41 | } 42 | -------------------------------------------------------------------------------- /test-out/test-analysis-3D.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(x,New(A)) 3 | If(Direct(top.input),{ 4 | Put(Ref(x),a,New(B)) 5 | Put(Get(Ref(x),a),foo,Const(5)) 6 | },{ 7 | Put(Ref(x),a,New(C)) 8 | Put(Get(Ref(x),a),bar,Const(5)) 9 | }) 10 | Assign(foo,Get(Get(Ref(x),a),foo)) 11 | Assign(bar,Get(Get(Ref(x),a),bar)) 12 | } 13 | default case for mayZero top.input 14 | --> phi top.input allocB allocC 15 | --> phi top.input 0 0 16 | --> phi top.input 5 undef 17 | --> phi top.input undef 5 18 | res: undef 19 | env: 20 | allocB -> OIf(top.input,ONew(B)+{foo -> 5},OUndef()) 21 | &x -> OStatic(&x)+{val -> allocA} 22 | allocC -> OIf(top.input,OUndef(),ONew(C)+{bar -> 5}) 23 | &bar -> OStatic(&bar)+{val -> phi(top.input:undef,5)} 24 | &foo -> OStatic(&foo)+{val -> phi(top.input:5,undef)} 25 | allocA -> ONew(A)+{a -> phi(top.input:allocB,allocC)} 26 | rec: 27 | 28 | true: Set() 29 | false: Set() 30 | ---- 31 | prog: { 32 | Assign(x,New(A)) 33 | Put(Ref(x),a,New(A2)) 34 | Put(Get(Ref(x),a),baz,Const(3)) 35 | If(Direct(top.input),{ 36 | Put(Ref(x),a,New(B)) 37 | Put(Get(Ref(x),a),foo,Const(5)) 38 | },{ 39 | Put(Ref(x),a,New(C)) 40 | Put(Get(Ref(x),a),bar,Const(5)) 41 | }) 42 | Put(Get(Ref(x),a),bar,Const(7)) 43 | Assign(xbar,Get(Get(Ref(x),a),bar)) 44 | } 45 | default case for mayZero top.input 46 | --> phi top.input allocB allocC 47 | --> phi top.input 0 0 48 | --> phi top.input 7 7 49 | res: undef 50 | env: 51 | allocB -> OIf(top.input,ONew(B)+{foo -> 5,bar -> 7},OUndef()) 52 | &x -> OStatic(&x)+{val -> allocA} 53 | allocC -> OIf(top.input,OUndef(),ONew(C)+{foo -> undef,bar -> 7}) 54 | &xbar -> OStatic(&xbar)+{val -> 7} 55 | allocA2 -> ONew(A2)+{baz -> 3} 56 | allocA -> ONew(A)+{a -> phi(top.input:allocB,allocC)} 57 | rec: 58 | 59 | true: Set() 60 | false: Set() 61 | ---- 62 | -------------------------------------------------------------------------------- /test-out/test-analysis-3A.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(i,Const(0)) 3 | Assign(y,Const(0)) 4 | Assign(x,Const(8)) 5 | While(Less(Ref(i),Const(100)),{ 6 | Assign(x,Const(7)) 7 | Assign(x,Plus(Ref(x),Const(1))) 8 | Assign(y,Plus(Ref(y),Const(1))) 9 | Assign(i,Plus(Ref(i),Const(1))) 10 | }) 11 | } 12 | res: undef 13 | env: 14 | &i -> OStatic(&i)+{val -> 100} 15 | &y -> OStatic(&y)+{val -> &y0.val} 16 | &x -> OStatic(&x)+{val -> 8} 17 | rec: 18 | &i0 -> OStatic(&i)+{val -> lphi(&i0.val+1<100:0,&i0.val+1)} 19 | &y0 -> OStatic(&y)+{val -> lphi(&i0.val+1<100:0,&y0.val+1)} 20 | true: Set() 21 | false: Set(&i0.val+1<100) 22 | ---- 23 | prog: { 24 | Assign(x,Const(900)) 25 | Assign(y,Const(0)) 26 | Assign(z,Const(0)) 27 | While(Less(Const(0),Ref(x)),{ 28 | Assign(z,Plus(Ref(z),Ref(x))) 29 | If(Less(Ref(y),Const(17)),{ 30 | Assign(y,Plus(Ref(y),Const(1))) 31 | },{ 32 | 33 | }) 34 | Assign(x,Plus(Ref(x),Const(-1))) 35 | }) 36 | Assign(r,Ref(x)) 37 | } 38 | default case for mayZero &y0.val<17 39 | --> phi &y0.val<17 &y0.val+1 &y0.val 40 | --> phi &y0.val<17 undef undef 41 | --> phi &y0.val<17 &x0.val &x0.val 42 | --> phi &y0.val<17 &y0.val+1 &y0.val 43 | default case for mayZero &y0.val<17 44 | --> phi &y0.val<17 &y0.val+1 &y0.val 45 | --> phi &y0.val<17 undef undef 46 | --> phi &y0.val<17 &x0.val &x0.val 47 | --> phi &y0.val<17 &y0.val+1 &y0.val 48 | res: undef 49 | env: 50 | &x -> OStatic(&x)+{val -> 0} 51 | &y -> OStatic(&y)+{val -> &y0.val} 52 | &z -> OStatic(&z)+{val -> &z0.val} 53 | &r -> OStatic(&r)+{val -> 0} 54 | rec: 55 | &x0 -> OStatic(&x)+{val -> lphi(0<&x0.val+-1:900,&x0.val+-1)} 56 | &y0 -> OStatic(&y)+{val -> lphi(0<&x0.val+-1:0,phi(&y0.val<17:&y0.val+1,&y0.val))} 57 | &z0 -> OStatic(&z)+{val -> lphi(0<&x0.val+-1:0,&z0.val+&x0.val)} 58 | true: Set() 59 | false: Set(0<&x0.val+-1) 60 | ---- 61 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DeliteInterfaces.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | /** 26 | * Delite 27 | */ 28 | 29 | abstract class DeliteOpMultiLoop[A] { 30 | def size: Int 31 | var loopStart: Int 32 | var loopSize: Int 33 | def alloc: A 34 | def processRange(__act: A, start: Int, end: Int): A //init+process 35 | def init(__act: A, idx: Int, isEmpty:Boolean): A 36 | def process(__act: A, idx: Int): Unit 37 | def combine(__act: A, rhs: A): Unit 38 | def postCombine(__act: A, rhs: A): Unit 39 | def postProcInit(__act: A): Unit 40 | def postProcess(__act: A): Unit 41 | def finalize(__act: A): Unit 42 | } 43 | 44 | /** 45 | * Ref 46 | */ 47 | 48 | class Ref[@specialized(Boolean, Int, Long, Float, Double) T](v: T) { 49 | private[this] var _v = v 50 | 51 | def get = _v 52 | def set(v: T) = _v = v 53 | } 54 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3-LMS-A1.check: -------------------------------------------------------------------------------- 1 | /***************************************** 2 | Emitting Generated Code 3 | *******************************************/ 4 | class Generated extends ((Int)=>(Int)) { 5 | def apply(x96:Int): Int = { 6 | val x0 = x96; 7 | val x7 = x0.asInstanceOf[Int]; 8 | val x40 = 0 >= x7; 9 | val x98: Int = { 10 | import sun.misc.Unsafe; 11 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; }; 12 | type char = Char; 13 | def WARN = assert(false, "WARN"); 14 | def ERROR = assert(false, "ERROR"); 15 | var RES0 = null.asInstanceOf[Int]; 16 | val x10: Object = unsafe.allocateInstance(Class.forName("lancet.interpreter.BaseTestInterpreter3$Bar")); 17 | if (x10 ne null) unsafe.putInt(x10,16L, 7) else println("BUG: putInt"+x10);; 18 | if (x40) { 19 | ;{; 20 | val LUB_b12_x10_intField = 7; // Alias(Some(DynExp(LUB_b12_x10_intField)),Some(Const(7))); 21 | BLOCK_12(LUB_b12_x10_intField,x10,x7); 22 | }; 23 | } else { 24 | if (x10 ne null) unsafe.putInt(x10,16L, 9) else println("BUG: putInt"+x10);; 25 | ;{; 26 | val LUB_b12_x10_intField = 9; // Alias(Some(DynExp(LUB_b12_x10_intField)),Some(Const(9))); 27 | BLOCK_12(LUB_b12_x10_intField,x10,x7); 28 | }; 29 | } 30 | def BLOCK_12(LUB_b12_x10_intField:Int,x10:Object,x7:Int): Unit = { 31 | (RES0 = LUB_b12_x10_intField) // return to root; 32 | } 33 | // (no return?); 34 | RES0 35 | }; 36 | x98 37 | } 38 | } 39 | /***************************************** 40 | End of Generated Code 41 | *******************************************/ 42 | Vector() 43 | List() 44 | compilation: ok 45 | 9 46 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3-LMS-B1.check: -------------------------------------------------------------------------------- 1 | /***************************************** 2 | Emitting Generated Code 3 | *******************************************/ 4 | class Generated(pConst_0:Object) extends ((Int)=>(Int)) { 5 | def apply(x68:Int): Int = { 6 | val x0 = x68; 7 | val x7 = x0.asInstanceOf[Int]; 8 | val x10 = 0 >= x7; 9 | val x70: Int = { 10 | import sun.misc.Unsafe; 11 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; }; 12 | type char = Char; 13 | def WARN = assert(false, "WARN"); 14 | def ERROR = assert(false, "ERROR"); 15 | var RES0 = null.asInstanceOf[Int]; 16 | if (x10) { 17 | ;{; 18 | val x46: Int = unsafe.getInt(pConst_0,16L); 19 | val LUB_b4_pConst_1_intField = x46; // XXX LUBC(Some(DynExp(LUB_b4_pConst_1_intField)),None); 20 | BLOCK_4(LUB_b4_pConst_1_intField,x7); 21 | }; 22 | } else { 23 | if (pConst_0 ne null) unsafe.putInt(pConst_0,16L, 9) else println("BUG: putInt"+pConst_0);; 24 | ;{; 25 | val LUB_b4_pConst_1_intField = 9; // Alias(Some(DynExp(LUB_b4_pConst_1_intField)),Some(Const(9))); 26 | BLOCK_4(LUB_b4_pConst_1_intField,x7); 27 | }; 28 | } 29 | def BLOCK_4(LUB_b4_pConst_1_intField:Int,x7:Int): Unit = { 30 | (RES0 = LUB_b4_pConst_1_intField) // return to root; 31 | } 32 | // (no return?); 33 | RES0 34 | }; 35 | x70 36 | } 37 | } 38 | /***************************************** 39 | End of Generated Code 40 | *******************************************/ 41 | Vector((Sym(-1000),lancet.interpreter.BaseTestInterpreter3$Bar@78b2ba0f)) 42 | List((lancet.interpreter.BaseTestInterpreter3$Bar@78b2ba0f,class java.lang.Object)) 43 | compilation: ok 44 | 9 45 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3B3.check: -------------------------------------------------------------------------------- 1 | // constants: ,lancet.interpreter.BaseTestInterpreter3$Bar@42fe329c 2 | class Generated0(CONST_0: lancet.interpreter.BaseTestInterpreter3$$anonfun$testB3$1$$anonfun$6,CONST_1: lancet.interpreter.BaseTestInterpreter3$Bar) extends (Int=>Int){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: Int): Int = { object BODY { 9 | var RES = null.asInstanceOf[Int] 10 | val x0 = ARG 11 | val x1 = x0.asInstanceOf[Int] 12 | val x2 = 0 >= x1 13 | if (x2) { 14 | val x9 = unsafe.getInt(CONST_1,12L) 15 | val LUB_CONST_1_intField = x9 // XXX LUBC(Some(LUB_CONST_1_intField),None) 16 | BLOCK_4(LUB_CONST_1_intField,x0,x1,x2) 17 | } else { 18 | unsafe.putInt(CONST_1,12L, 9) 19 | ;{ 20 | val LUB_CONST_1_intField = 9 // Alias(Some(LUB_CONST_1_intField),Some(9)) 21 | BLOCK_4(LUB_CONST_1_intField,x0,x1,x2) 22 | } 23 | } 24 | def BLOCK_4(LUB_CONST_1_intField:Int,x0:Int,x1:Int,x2:Boolean): Unit = { 25 | val PHI_3_5 = 0 // LUBC(PHI_3_5:Int,0:Int) 26 | BLOCK_5(LUB_CONST_1_intField,PHI_3_5,x0,x1,x2) 27 | } 28 | def BLOCK_5(LUB_CONST_1_intField:Int,PHI_3_5:Int,x0:Int,x1:Int,x2:Boolean): Unit = { 29 | val x6 = 0 >= LUB_CONST_1_intField 30 | if (x6) { 31 | (RES = PHI_3_5) // return to root 32 | } else { 33 | val x7 = -1 + LUB_CONST_1_intField 34 | unsafe.putInt(CONST_1,12L, x7) 35 | val x8 = 1 + PHI_3_5 36 | ;{ 37 | val PHI_3_5 = x8 // LUBC(PHI_3_5:Int,x8:Int) 38 | val LUB_CONST_1_intField = x7 // Alias(Some(LUB_CONST_1_intField),Some(x7)) 39 | BLOCK_5(LUB_CONST_1_intField,PHI_3_5,x0,x1,x2) 40 | } 41 | } 42 | } 43 | // (no return?) 44 | }; BODY.RES } 45 | } 46 | 47 | compilation: ok 48 | 9 49 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3A3.check: -------------------------------------------------------------------------------- 1 | // constants: , 2 | class Generated0(CONST_0: lancet.interpreter.BaseTestInterpreter3$$anonfun$testA3$1$$anonfun$3,CONST_1: lancet.interpreter.BaseTestInterpreter3$$anonfun$testA3$1) extends (Int=>Int){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: Int): Int = { object BODY { 9 | var RES = null.asInstanceOf[Int] 10 | val x0 = ARG 11 | val x1 = x0.asInstanceOf[Int] 12 | val x2 = unsafe.allocateInstance(Class.forName("lancet.interpreter.BaseTestInterpreter3$Bar")) 13 | unsafe.putInt(x2,12L, 7) 14 | val x3 = 0 >= x1 15 | if (x3) { 16 | val LUB_x2_intField = 7 // Alias(Some(LUB_x2_intField),Some(7)) 17 | BLOCK_12(LUB_x2_intField,x0,x1,x2,x3) 18 | } else { 19 | unsafe.putInt(x2,12L, 9) 20 | ;{ 21 | val LUB_x2_intField = 9 // Alias(Some(LUB_x2_intField),Some(9)) 22 | BLOCK_12(LUB_x2_intField,x0,x1,x2,x3) 23 | } 24 | } 25 | def BLOCK_12(LUB_x2_intField:Int,x0:Int,x1:Int,x2:Object,x3:Boolean): Unit = { 26 | val PHI_3_6 = 0 // LUBC(PHI_3_6:Int,0:Int) 27 | BLOCK_13(LUB_x2_intField,PHI_3_6,x0,x1,x2,x3) 28 | } 29 | def BLOCK_13(LUB_x2_intField:Int,PHI_3_6:Int,x0:Int,x1:Int,x2:Object,x3:Boolean): Unit = { 30 | val x6 = 0 >= LUB_x2_intField 31 | if (x6) { 32 | (RES = PHI_3_6) // return to root 33 | } else { 34 | val x7 = -1 + LUB_x2_intField 35 | unsafe.putInt(x2,12L, x7) 36 | val x8 = 1 + PHI_3_6 37 | ;{ 38 | val PHI_3_6 = x8 // LUBC(PHI_3_6:Int,x8:Int) 39 | val LUB_x2_intField = x7 // Alias(Some(LUB_x2_intField),Some(x7)) 40 | BLOCK_13(LUB_x2_intField,PHI_3_6,x0,x1,x2,x3) 41 | } 42 | } 43 | } 44 | // (no return?) 45 | }; BODY.RES } 46 | } 47 | 48 | compilation: ok 49 | 9 50 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntDenseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class IntDenseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data: Array[Int] = new Array[Int](_length) 36 | 37 | /** 38 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 39 | */ 40 | def unsafeSetData(xs: Array[Int], len: Int) { 41 | _data = xs 42 | _length = len 43 | } 44 | 45 | def Clone = { 46 | val v = new IntDenseVector(_length, _isRow); 47 | v._data = _data.clone 48 | v 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BinarizedGradientTemplate.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala.application 23 | import generated.scala._ 24 | 25 | 26 | class BinarizedGradientTemplate ( 27 | // In the reduced image. The side of the template square is then 2*r+1. 28 | val radius: Int, 29 | 30 | // Holds a tighter bounding box of the object in the original image scale 31 | val rect: Rect, 32 | val mask_list: IntDenseVector, 33 | 34 | // Pyramid level of the template (reduction_factor = 2^level) 35 | val level: Int, 36 | 37 | // The list of gradients in the template 38 | val binary_gradients: DoubleDenseVector, 39 | 40 | // indices to use for matching (skips zeros inside binary_gradients) 41 | val match_list: IndexVectorDenseC, 42 | 43 | // This is a match list of list of sub-parts. Currently unused. 44 | val occlusions: DenseVector[IntDenseVector], 45 | 46 | val templates: DenseVector[BinarizedGradientTemplate], 47 | 48 | val hist: FloatDenseVector 49 | ) 50 | 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongDenseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class LongDenseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data: Array[Long] = new Array[Long](_length) 36 | 37 | /** 38 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 39 | */ 40 | def unsafeSetData(xs: Array[Long], len: Int) { 41 | _data = xs 42 | _length = len 43 | } 44 | 45 | def Clone = { 46 | val v = new LongDenseVector(_length, _isRow); 47 | v._data = _data.clone 48 | v 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatDenseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class FloatDenseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data: Array[Float] = new Array[Float](_length) 36 | 37 | /** 38 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 39 | */ 40 | def unsafeSetData(xs: Array[Float], len: Int) { 41 | _data = xs 42 | _length = len 43 | } 44 | 45 | def Clone = { 46 | val v = new FloatDenseVector(_length, _isRow); 47 | v._data = _data.clone 48 | v 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DenseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class DenseVector[@specialized T: Manifest](__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data: Array[T] = new Array[T](_length) 36 | 37 | /** 38 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 39 | */ 40 | def unsafeSetData(xs: Array[T], len: Int) { 41 | _data = xs 42 | _length = len 43 | } 44 | 45 | def Clone = { 46 | val v = new DenseVector[T](_length, _isRow); 47 | v._data = _data.clone 48 | v 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleDenseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class DoubleDenseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data: Array[Double] = new Array[Double](_length) 36 | 37 | /** 38 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 39 | */ 40 | def unsafeSetData(xs: Array[Double], len: Int) { 41 | _data = xs 42 | _length = len 43 | } 44 | 45 | def Clone = { 46 | val v = new DoubleDenseVector(_length, _isRow); 47 | v._data = _data.clone 48 | v 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanDenseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class BooleanDenseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data: Array[Boolean] = new Array[Boolean](_length) 36 | 37 | /** 38 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 39 | */ 40 | def unsafeSetData(xs: Array[Boolean], len: Int) { 41 | _data = xs 42 | _length = len 43 | } 44 | 45 | def Clone = { 46 | val v = new BooleanDenseVector(_length, _isRow); 47 | v._data = _data.clone 48 | v 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Graph.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | import collection.mutable.{HashMap} 26 | 27 | class Graph[VD:Manifest,ED:Manifest] { 28 | // TODO: we are storing a lot of data here. investigate reducing the footprint vs. performance. 29 | var _edgeToVertices = HashMap[Edge[VD,ED], (Vertex[VD,ED], Vertex[VD,ED])]() 30 | // var verticesToEdges = HashMap[(V, V), E]() 31 | 32 | // this is used only during construction (before frozen), for fast sorting 33 | var _adjacencies = HashMap[Vertex[VD,ED], List[(Edge[VD,ED], Vertex[VD,ED])]]() 34 | 35 | // this is used only after construction (after frozen), for fast access 36 | // Map from vertex to id 37 | val _vertexIds = HashMap[Vertex[VD,ED], Int]() 38 | 39 | var _vertices : Array[Vertex[VD,ED]] = null 40 | var _edges : Array[Edge[VD,ED]] = null 41 | 42 | var _vertexEdges : Array[DenseVector[Edge[VD,ED]]] = null 43 | var _neighbors : Array[DenseVector[Vertex[VD,ED]]] = null 44 | var _neighborsSelf : Array[DenseVector[Vertex[VD,ED]]] = null 45 | 46 | var _frozen = false 47 | } 48 | -------------------------------------------------------------------------------- /test-out/test-interpreter-4decompile1.check: -------------------------------------------------------------------------------- 1 | // constants: ,,lancet.interpreter.TestInterpreter4@a9f3894 2 | class Generated0(CONST_0: lancet.interpreter.TestInterpreter4$$anonfun$test1$1$$anonfun$1,CONST_1: lancet.interpreter.TestInterpreter4$$anonfun$test1$1,CONST_2: lancet.interpreter.TestInterpreter4) extends (scala.collection.Seq[_]=>scala.collection.Seq[_]){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: scala.collection.Seq[_]): scala.collection.Seq[_] = { object BODY { 9 | var RES = null.asInstanceOf[scala.collection.Seq[_]] 10 | val x0 = ARG 11 | val x1 = unsafe.allocateInstance(Class.forName("lancet.interpreter.TestInterpreter4$$anonfun$test1$1$$anonfun$1$$anonfun$apply$1")) 12 | unsafe.putObject(x1,12L, CONST_0) 13 | val x8 = x0.asInstanceOf[Traversable[Object]].filter { (x2:Object) => { 14 | var RES = null.asInstanceOf[Object] 15 | val x3 = x2.asInstanceOf[lancet.interpreter.TestInterpreter4$Person] // checkCast 16 | // unique method: HotSpotMethod TODO: guard 17 | val x4 = unsafe.getInt(x3,12L) 18 | val x5 = 42 <= x4 19 | if (x5) { 20 | val PHI_4_5 = 0 // LUBC(PHI_4_5:Int,0:Int) 21 | BLOCK_21(PHI_4_5,x0,x1,x2,x3,x4,x5) 22 | } else { 23 | val PHI_4_5 = 1 // LUBC(PHI_4_5:Int,1:Int) 24 | BLOCK_21(PHI_4_5,x0,x1,x2,x3,x4,x5) 25 | } 26 | def BLOCK_21(PHI_4_5:Int,x0:scala.collection.Seq[_],x1:Object,x2:Object,x3:Object,x4:Int,x5:Boolean): Unit = { 27 | val x6 = PHI_4_5 == 1 28 | val x7 = x6.asInstanceOf[java.lang.Boolean] 29 | (RES = x7) // return to root 30 | } 31 | // (no return?) 32 | RES.asInstanceOf[Boolean] 33 | }} 34 | val x9 = x8.asInstanceOf[scala.collection.Seq[_]] // checkCast 35 | (RES = x9) // return to root 36 | // (no return?) 37 | }; BODY.RES } 38 | } 39 | 40 | compilation: ok 41 | 42 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntSparseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class IntSparseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data = new Array[Int](32) 36 | var _indices = new Array[Int](32) 37 | var _nnz = 0 38 | 39 | /** 40 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 41 | */ 42 | def unsafeSetData(xs: Array[Int], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseVector not supported") 43 | 44 | def Clone = { 45 | val v = new IntSparseVector(_length, _isRow); 46 | v._data = _data.clone 47 | v._indices = _indices.clone 48 | v._nnz = _nnz 49 | v 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongSparseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class LongSparseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data = new Array[Long](32) 36 | var _indices = new Array[Int](32) 37 | var _nnz = 0 38 | 39 | /** 40 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 41 | */ 42 | def unsafeSetData(xs: Array[Long], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseVector not supported") 43 | 44 | def Clone = { 45 | val v = new LongSparseVector(_length, _isRow); 46 | v._data = _data.clone 47 | v._indices = _indices.clone 48 | v._nnz = _nnz 49 | v 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatSparseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class FloatSparseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data = new Array[Float](32) 36 | var _indices = new Array[Int](32) 37 | var _nnz = 0 38 | 39 | /** 40 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 41 | */ 42 | def unsafeSetData(xs: Array[Float], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseVector not supported") 43 | 44 | def Clone = { 45 | val v = new FloatSparseVector(_length, _isRow); 46 | v._data = _data.clone 47 | v._indices = _indices.clone 48 | v._nnz = _nnz 49 | v 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleSparseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class DoubleSparseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data = new Array[Double](32) 36 | var _indices = new Array[Int](32) 37 | var _nnz = 0 38 | 39 | /** 40 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 41 | */ 42 | def unsafeSetData(xs: Array[Double], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseVector not supported") 43 | 44 | def Clone = { 45 | val v = new DoubleSparseVector(_length, _isRow); 46 | v._data = _data.clone 47 | v._indices = _indices.clone 48 | v._nnz = _nnz 49 | v 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/SparseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class SparseVector[@specialized T: Manifest](__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data = new Array[T](32) 36 | var _indices = new Array[Int](32) 37 | var _nnz = 0 38 | 39 | /** 40 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 41 | */ 42 | def unsafeSetData(xs: Array[T], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseVector not supported") 43 | 44 | def Clone = { 45 | val v = new SparseVector[T](_length, _isRow); 46 | v._data = _data.clone 47 | v._indices = _indices.clone 48 | v._nnz = _nnz 49 | v 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanSparseVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * This is the actual class that gets instantiated in the generated code. Ops corresponding to public operations 26 | * here must have CodeGen methods defined by the DSL on them. 27 | * 28 | * Alternatively, everything in this class could be lifted, and we could generate a concrete class to be instantiated 29 | * in the generated code. 30 | */ 31 | 32 | class BooleanSparseVector(__length: Int, __isRow: Boolean) { 33 | var _length = __length 34 | var _isRow = __isRow 35 | var _data = new Array[Boolean](32) 36 | var _indices = new Array[Int](32) 37 | var _nnz = 0 38 | 39 | /** 40 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 41 | */ 42 | def unsafeSetData(xs: Array[Boolean], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseVector not supported") 43 | 44 | def Clone = { 45 | val v = new BooleanSparseVector(_length, _isRow); 46 | v._data = _data.clone 47 | v._indices = _indices.clone 48 | v._nnz = _nnz 49 | v 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /test-out/test-analysis-4A3.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(x,Const(0)) 3 | Assign(a,New(A)) 4 | Put(Ref(a),Const(field),Const(7)) 5 | While(Less(Ref(x),Const(100)),{ 6 | Put(Ref(a),Const(field),Const(7)) 7 | Assign(x,Plus(Ref(x),Const(1))) 8 | }) 9 | Assign(r,Ref(a)) 10 | } 11 | val x0 = Map() 12 | val x1 = Map("val" -> 0) 13 | val x2 = Map("&x" -> x1) 14 | val x3 = Map("&x" -> x1, (A,1) -> Map()) 15 | val x4 = Map("val" -> (A,1)) 16 | val x5 = Map("&x" -> x1, "&a" -> x4) 17 | val x6 = Map("field" -> 7) 18 | val x7 = Map("&x" -> x1, "&a" -> x4, (A,1) -> x6) 19 | val x10 = (1,x9) 20 | starting spec loop with x7 21 | val x11 = Map("val" -> 1) 22 | val x12 = Map("&x" -> x11, "&a" -> x4, (A,1) -> x6) 23 | lub(x7, x12) = ? 24 | lub_x8(x7,x7,x12) 25 | lub_x8_&x(x1,x1,x11) 26 | lub_x8_&x_val(0,0,1) 27 | 0 28 | 1 29 | 1 30 | confirmed iterative loop, d = 1 31 | val x13 = x9 + -1 32 | Set(("val",(x13,x9))) 33 | val x14 = Map("val" -> x13) 34 | val x15 = Map("val" -> x9) 35 | lub_x8_&a(x4,x4,x4) 36 | lub_x8_(A,1)(x6,x6,x6) 37 | Set(("&x",(x14,x15)), ("&a",(x4,x4)), ((A,1),(x6,x6))) 38 | val x16 = Map("&x" -> x14, "&a" -> x4, (A,1) -> x6) 39 | val x17 = Map("&x" -> x15, "&a" -> x4, (A,1) -> x6) 40 | lub(x7, x12) = x16 41 | starting spec loop with x16 42 | val x18 = x9 < 101 43 | lub(x7, x17) = ? 44 | lub_x8(x7,x16,x17) 45 | lub_x8_&x(x1,x14,x15) 46 | lub_x8_&x_val(0,x13,x9) 47 | val x19 = x9 * -1 48 | val x20 = x19 + 1 49 | x9 + -1 50 | x9 51 | 1 52 | confirmed iterative loop, d = 1 53 | Set(("val",(x13,x9))) 54 | lub_x8_&a(x4,x4,x4) 55 | lub_x8_(A,1)(x6,x6,x6) 56 | Set(("&x",(x14,x15)), ("&a",(x4,x4)), ((A,1),(x6,x6))) 57 | lub(x7, x17) = x16 58 | val x8_&x_val = { x9 => x9 } 59 | val x8 = { x9 => x17 } 60 | fixindex: 100 61 | val x21 = Map("val" -> 100) 62 | val x22 = Map("&x" -> x21, "&a" -> x4, (A,1) -> x6) 63 | val x23 = Map("&x" -> x21, "&a" -> x4, (A,1) -> x6, "&r" -> x4) 64 | res: () 65 | store: x23 66 | transformed: x23 67 | sched: 68 | val x21 = Map("val" -> 100) 69 | val x6 = Map("field" -> 7) 70 | val x4 = Map("val" -> (A,1)) 71 | val x23 = Map("&x" -> x21, "&a" -> x4, (A,1) -> x6, "&r" -> x4) 72 | term: 73 | Map("&x" -> Map("val" -> 100), "&a" -> Map("val" -> (A,1)), (A,1) -> Map("field" -> 7), "&r" -> Map("val" -> (A,1))) 74 | ---- 75 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3-LMS-B2.check: -------------------------------------------------------------------------------- 1 | /***************************************** 2 | Emitting Generated Code 3 | *******************************************/ 4 | class Generated(pConst_0:Object) extends ((Int)=>(Int)) { 5 | def apply(x119:Int): Int = { 6 | val x0 = x119; 7 | val x7 = x0.asInstanceOf[Int]; 8 | val x121: Int = { 9 | import sun.misc.Unsafe; 10 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; }; 11 | type char = Char; 12 | def WARN = assert(false, "WARN"); 13 | def ERROR = assert(false, "ERROR"); 14 | var RES0 = null.asInstanceOf[Int]; 15 | ;{; 16 | val PHI_b2_3_5 = x7 // LUBC(DynExp(PHI_b2_3_5):Int,Sym(7):Int); 17 | val x97: Int = unsafe.getInt(pConst_0,16L); 18 | val LUB_b2_pConst_1_intField = x97; // XXX LUBC(Some(DynExp(LUB_b2_pConst_1_intField)),None); 19 | BLOCK_2(LUB_b2_pConst_1_intField,PHI_b2_3_5,x7); 20 | }; 21 | def BLOCK_2(LUB_b2_pConst_1_intField:Int,PHI_b2_3_5:Int,x7:Int): Unit = { 22 | val x46 = 0 >= PHI_b2_3_5; 23 | val x60 = 1 + LUB_b2_pConst_1_intField; 24 | val x69 = -1 + PHI_b2_3_5; 25 | if (x46) { 26 | (RES0 = LUB_b2_pConst_1_intField) // return to root; 27 | } else { 28 | if (pConst_0 ne null) unsafe.putInt(pConst_0,16L, x60) else println("BUG: putInt"+pConst_0);; 29 | ;{; 30 | val PHI_b2_3_5 = x69 // LUBC(DynExp(PHI_b2_3_5):Int,Sym(69):Int); 31 | val LUB_b2_pConst_1_intField = x60; // Alias(Some(DynExp(LUB_b2_pConst_1_intField)),Some(Sym(60))); 32 | BLOCK_2(LUB_b2_pConst_1_intField,PHI_b2_3_5,x7); 33 | }; 34 | } 35 | } 36 | // (no return?); 37 | RES0 38 | }; 39 | x121 40 | } 41 | } 42 | /***************************************** 43 | End of Generated Code 44 | *******************************************/ 45 | Vector((Sym(-1000),lancet.interpreter.BaseTestInterpreter3$Bar@7df75432)) 46 | List((lancet.interpreter.BaseTestInterpreter3$Bar@7df75432,class java.lang.Object)) 47 | compilation: ok 48 | 14 49 | -------------------------------------------------------------------------------- /test-out/test-analysis-3B.check: -------------------------------------------------------------------------------- 1 | prog: { 2 | Assign(i,Const(0)) 3 | Assign(z,New(A)) 4 | Assign(x,Ref(z)) 5 | While(Less(Ref(i),Const(100)),{ 6 | Assign(y,New(B)) 7 | Put(Ref(y),head,Ref(i)) 8 | Put(Ref(y),tail,Ref(x)) 9 | Assign(x,Ref(y)) 10 | Assign(i,Plus(Ref(i),Const(1))) 11 | }) 12 | } 13 | res: undef 14 | env: 15 | allocB -> ORef(allocB0) 16 | &x -> OStatic(&x)+{val -> &x0.val} 17 | &i -> OStatic(&i)+{val -> 100} 18 | &z -> OStatic(&z)+{val -> allocA} 19 | &y -> ORef(&y0) 20 | allocA -> ONew(A) 21 | rec: 22 | allocB0 -> OWhile(&i0.val+1<100,OUndef(),ONew(B_loop)+{head -> &i0.val,tail -> &x0.val}) 23 | &x0 -> OStatic(&x)+{val -> lphi(&i0.val+1<100:allocA,allocB)} 24 | &i0 -> OStatic(&i)+{val -> lphi(&i0.val+1<100:0,&i0.val+1)} 25 | &y0 -> OWhile(&i0.val+1<100,OUndef(),OStatic(&y)+{val -> allocB}) 26 | true: Set() 27 | false: Set(&i0.val+1<100) 28 | ---- 29 | prog: { 30 | Assign(i,Const(0)) 31 | Assign(z,New(A)) 32 | Assign(x,Ref(z)) 33 | Assign(y,New(B)) 34 | While(Less(Ref(i),Const(100)),{ 35 | Put(Ref(y),head,Ref(i)) 36 | Put(Ref(y),tail,Ref(x)) 37 | Assign(x,Ref(y)) 38 | Assign(i,Plus(Ref(i),Const(1))) 39 | }) 40 | } 41 | res: undef 42 | env: 43 | allocB -> ORef(allocB0) 44 | &x -> OStatic(&x)+{val -> &x0.val} 45 | &i -> OStatic(&i)+{val -> 100} 46 | &z -> OStatic(&z)+{val -> allocA} 47 | &y -> OStatic(&y)+{val -> allocB} 48 | allocA -> ONew(A) 49 | rec: 50 | allocB0 -> OWhile(&i0.val+1<100,ONew(B),ORef(allocB0)+{head -> &i0.val,tail -> &x0.val}) 51 | &x0 -> OStatic(&x)+{val -> lphi(&i0.val+1<100:allocA,allocB)} 52 | &i0 -> OStatic(&i)+{val -> lphi(&i0.val+1<100:0,&i0.val+1)} 53 | true: Set() 54 | false: Set(&i0.val+1<100) 55 | ---- 56 | prog: { 57 | Assign(i,Const(0)) 58 | Assign(z,New(A)) 59 | Assign(x,Ref(z)) 60 | While(Less(Ref(i),Const(100)),{ 61 | Put(Ref(x),head,Ref(i)) 62 | Assign(i,Plus(Ref(i),Const(1))) 63 | }) 64 | } 65 | res: undef 66 | env: 67 | &i -> OStatic(&i)+{val -> 100} 68 | allocA -> ORef(allocA0) 69 | &z -> OStatic(&z)+{val -> allocA} 70 | &x -> OStatic(&x)+{val -> allocA} 71 | rec: 72 | &i0 -> OStatic(&i)+{val -> lphi(&i0.val+1<100:0,&i0.val+1)} 73 | allocA0 -> OWhile(&i0.val+1<100,ONew(A),ORef(allocA0)+{head -> &i0.val}) 74 | true: Set() 75 | false: Set(&i0.val+1<100) 76 | ---- 77 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntSparseMatrixCOO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* 25 | * A sparse matrix in COOrdinate format. Efficient for constructing sparse matrices 26 | * and converting to other (CSR, CSC) formats. 27 | */ 28 | class IntSparseMatrixCOO(__numRows: Int, __numCols: Int) { 29 | var _numRows = __numRows 30 | var _numCols = __numCols 31 | // non-zero values, left-to-right then top-to-bottom 32 | var _data = new Array[Int](32) 33 | // column index of each non-zero value 34 | var _colIndices = new Array[Int](32) 35 | // row index of each non-zero value 36 | var _rowIndices = new Array[Int](32) 37 | // number of non-zeros stored in the COO matrix 38 | var _nnz = 0 39 | 40 | /** 41 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 42 | */ 43 | def unsafeSetData(xs: Array[Int], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCOO not supported") 44 | 45 | def Clone = { 46 | val m = new IntSparseMatrixCOO(_numRows, _numCols) 47 | m._data = _data.clone 48 | m._colIndices = _colIndices.clone 49 | m._rowIndices = _rowIndices.clone 50 | m._nnz = _nnz 51 | m 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongSparseMatrixCOO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* 25 | * A sparse matrix in COOrdinate format. Efficient for constructing sparse matrices 26 | * and converting to other (CSR, CSC) formats. 27 | */ 28 | class LongSparseMatrixCOO(__numRows: Int, __numCols: Int) { 29 | var _numRows = __numRows 30 | var _numCols = __numCols 31 | // non-zero values, left-to-right then top-to-bottom 32 | var _data = new Array[Long](32) 33 | // column index of each non-zero value 34 | var _colIndices = new Array[Int](32) 35 | // row index of each non-zero value 36 | var _rowIndices = new Array[Int](32) 37 | // number of non-zeros stored in the COO matrix 38 | var _nnz = 0 39 | 40 | /** 41 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 42 | */ 43 | def unsafeSetData(xs: Array[Long], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCOO not supported") 44 | 45 | def Clone = { 46 | val m = new LongSparseMatrixCOO(_numRows, _numCols) 47 | m._data = _data.clone 48 | m._colIndices = _colIndices.clone 49 | m._rowIndices = _rowIndices.clone 50 | m._nnz = _nnz 51 | m 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatSparseMatrixCOO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* 25 | * A sparse matrix in COOrdinate format. Efficient for constructing sparse matrices 26 | * and converting to other (CSR, CSC) formats. 27 | */ 28 | class FloatSparseMatrixCOO(__numRows: Int, __numCols: Int) { 29 | var _numRows = __numRows 30 | var _numCols = __numCols 31 | // non-zero values, left-to-right then top-to-bottom 32 | var _data = new Array[Float](32) 33 | // column index of each non-zero value 34 | var _colIndices = new Array[Int](32) 35 | // row index of each non-zero value 36 | var _rowIndices = new Array[Int](32) 37 | // number of non-zeros stored in the COO matrix 38 | var _nnz = 0 39 | 40 | /** 41 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 42 | */ 43 | def unsafeSetData(xs: Array[Float], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCOO not supported") 44 | 45 | def Clone = { 46 | val m = new FloatSparseMatrixCOO(_numRows, _numCols) 47 | m._data = _data.clone 48 | m._colIndices = _colIndices.clone 49 | m._rowIndices = _rowIndices.clone 50 | m._nnz = _nnz 51 | m 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleSparseMatrixCOO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* 25 | * A sparse matrix in COOrdinate format. Efficient for constructing sparse matrices 26 | * and converting to other (CSR, CSC) formats. 27 | */ 28 | class DoubleSparseMatrixCOO(__numRows: Int, __numCols: Int) { 29 | var _numRows = __numRows 30 | var _numCols = __numCols 31 | // non-zero values, left-to-right then top-to-bottom 32 | var _data = new Array[Double](32) 33 | // column index of each non-zero value 34 | var _colIndices = new Array[Int](32) 35 | // row index of each non-zero value 36 | var _rowIndices = new Array[Int](32) 37 | // number of non-zeros stored in the COO matrix 38 | var _nnz = 0 39 | 40 | /** 41 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 42 | */ 43 | def unsafeSetData(xs: Array[Double], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCOO not supported") 44 | 45 | def Clone = { 46 | val m = new DoubleSparseMatrixCOO(_numRows, _numCols) 47 | m._data = _data.clone 48 | m._colIndices = _colIndices.clone 49 | m._rowIndices = _rowIndices.clone 50 | m._nnz = _nnz 51 | m 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/SparseMatrixCOO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* 25 | * A sparse matrix in COOrdinate format. Efficient for constructing sparse matrices 26 | * and converting to other (CSR, CSC) formats. 27 | */ 28 | class SparseMatrixCOO[@specialized T: Manifest](__numRows: Int, __numCols: Int) { 29 | var _numRows = __numRows 30 | var _numCols = __numCols 31 | // non-zero values, left-to-right then top-to-bottom 32 | var _data = new Array[T](32) 33 | // column index of each non-zero value 34 | var _colIndices = new Array[Int](32) 35 | // row index of each non-zero value 36 | var _rowIndices = new Array[Int](32) 37 | // number of non-zeros stored in the COO matrix 38 | var _nnz = 0 39 | 40 | /** 41 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 42 | */ 43 | def unsafeSetData(xs: Array[T], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCOO not supported") 44 | 45 | def Clone = { 46 | val m = new SparseMatrixCOO[T](_numRows, _numCols) 47 | m._data = _data.clone 48 | m._colIndices = _colIndices.clone 49 | m._rowIndices = _rowIndices.clone 50 | m._nnz = _nnz 51 | m 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/BooleanSparseMatrixCOO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /* 25 | * A sparse matrix in COOrdinate format. Efficient for constructing sparse matrices 26 | * and converting to other (CSR, CSC) formats. 27 | */ 28 | class BooleanSparseMatrixCOO(__numRows: Int, __numCols: Int) { 29 | var _numRows = __numRows 30 | var _numCols = __numCols 31 | // non-zero values, left-to-right then top-to-bottom 32 | var _data = new Array[Boolean](32) 33 | // column index of each non-zero value 34 | var _colIndices = new Array[Int](32) 35 | // row index of each non-zero value 36 | var _rowIndices = new Array[Int](32) 37 | // number of non-zeros stored in the COO matrix 38 | var _nnz = 0 39 | 40 | /** 41 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 42 | */ 43 | def unsafeSetData(xs: Array[Boolean], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCOO not supported") 44 | 45 | def Clone = { 46 | val m = new BooleanSparseMatrixCOO(_numRows, _numCols) 47 | m._data = _data.clone 48 | m._colIndices = _colIndices.clone 49 | m._rowIndices = _rowIndices.clone 50 | m._nnz = _nnz 51 | m 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /test-out/test-interpreter-3-LMS-A2.check: -------------------------------------------------------------------------------- 1 | /***************************************** 2 | Emitting Generated Code 3 | *******************************************/ 4 | class Generated extends ((Int)=>(Int)) { 5 | def apply(x144:Int): Int = { 6 | val x0 = x144; 7 | val x7 = x0.asInstanceOf[Int]; 8 | val x146: Int = { 9 | import sun.misc.Unsafe; 10 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; }; 11 | type char = Char; 12 | def WARN = assert(false, "WARN"); 13 | def ERROR = assert(false, "ERROR"); 14 | var RES0 = null.asInstanceOf[Int]; 15 | val x10: Object = unsafe.allocateInstance(Class.forName("lancet.interpreter.BaseTestInterpreter3$Bar")); 16 | if (x10 ne null) unsafe.putInt(x10,16L, 7) else println("BUG: putInt"+x10);; 17 | ;{; 18 | val PHI_b10_3_6 = x7 // LUBC(DynExp(PHI_b10_3_6):Int,Sym(7):Int); 19 | val LUB_b10_x10_intField = 7; // Alias(Some(DynExp(LUB_b10_x10_intField)),Some(Const(7))); 20 | BLOCK_10(LUB_b10_x10_intField,PHI_b10_3_6,x10,x7); 21 | }; 22 | def BLOCK_10(LUB_b10_x10_intField:Int,PHI_b10_3_6:Int,x10:Object,x7:Int): Unit = { 23 | val x73 = 0 >= PHI_b10_3_6; 24 | val x10: Object = unsafe.allocateInstance(Class.forName("lancet.interpreter.BaseTestInterpreter3$Bar")); 25 | val x87 = 1 + LUB_b10_x10_intField; 26 | val x96 = -1 + PHI_b10_3_6; 27 | if (x73) { 28 | (RES0 = LUB_b10_x10_intField) // return to root; 29 | } else { 30 | if (x10 ne null) unsafe.putInt(x10,16L, x87) else println("BUG: putInt"+x10);; 31 | ;{; 32 | val PHI_b10_3_6 = x96 // LUBC(DynExp(PHI_b10_3_6):Int,Sym(96):Int); 33 | val LUB_b10_x10_intField = x87; // Alias(Some(DynExp(LUB_b10_x10_intField)),Some(Sym(87))); 34 | BLOCK_10(LUB_b10_x10_intField,PHI_b10_3_6,x10,x7); 35 | }; 36 | } 37 | } 38 | // (no return?); 39 | RES0 40 | }; 41 | x146 42 | } 43 | } 44 | /***************************************** 45 | End of Generated Code 46 | *******************************************/ 47 | Vector() 48 | List() 49 | compilation: ok 50 | 14 51 | -------------------------------------------------------------------------------- /test-out/test-analysis-5A.check: -------------------------------------------------------------------------------- 1 | ---- 2 | *** prog: val b = new { zb => 3 | Foo -> (⊥,⊤) 4 | Inner -> (⊥,{ zi => 5 | Bar -> (⊥,⊤) 6 | z -> zi.Bar ∧ zb.Foo 7 | }) 8 | x -> zb.Foo 9 | } { } 10 | val a = new b.Inner ∧ { zf => 11 | self -> zf 12 | } { } 13 | val c = a 14 | c.self.z 15 | *** tp: c.Bar ∧ b.Foo 16 | ---- 17 | *** prog: val b = new { zb => 18 | Foo -> (⊥,⊤) 19 | Inner -> (⊥,{ zi => 20 | Bar -> (⊥,⊤) 21 | outerFoo -> (zb.Foo,zb.Foo) 22 | foo -> (x,⊤,zb.Foo) 23 | }) 24 | x -> zb.Foo 25 | } { } 26 | val a = new b.Inner ∧ { zf => 27 | self -> zf 28 | } { } 29 | val c = a 30 | val r = c.self.foo(a) 31 | r 32 | *** tp: b.Foo 33 | a.self <: b.Inner (true) 34 | true 35 | b.Inner <: a.self (false) 36 | false 37 | a.self <: c (true) 38 | true 39 | c <: a.self (true) 40 | true 41 | a.outerFoo <: b.Foo (true) 42 | true 43 | b.Foo <: a.outerFoo (true) 44 | true 45 | ---- 46 | *** prog: val z = new { zz => 47 | L -> (⊥,zz.L) 48 | } { } 49 | z 50 | *** tp: #z = { zz => 51 | L -> (⊥,zz.L) 52 | } 53 | expand z.L 54 | DObj(Map(),Map(),Map()) 55 | ---- 56 | *** prog: val u = new { zu => 57 | X -> (u.Lower,u.Upper) 58 | Lower -> (u.Bad ∧ u.Good,u.Good) 59 | Good -> ({ z1 => 60 | L -> (⊥,⊤) 61 | },{ z1 => 62 | L -> (⊥,⊤) 63 | }) 64 | Upper -> (u.Good,u.Bad ∨ u.Good) 65 | Bad -> (⊥,u.Bad) 66 | } { } 67 | u 68 | *** tp: #u = { zu => 69 | X -> (u.Lower,u.Upper) 70 | Lower -> (u.Bad ∧ u.Good,u.Good) 71 | Good -> ({ z1 => 72 | L -> (⊥,⊤) 73 | },{ z1 => 74 | L -> (⊥,⊤) 75 | }) 76 | Upper -> (u.Good,u.Bad ∨ u.Good) 77 | Bad -> (⊥,u.Bad) 78 | } 79 | Map(S -> u.Bad ∧ u.Good, T -> u.Lower, U -> u.X ∧ { z3 => 80 | L -> (⊥,⊤) 81 | }) 82 | S<:T (true) 83 | true 84 | T<:U (true) 85 | true 86 | S<:U (true) 87 | true 88 | U<:S (false) 89 | false 90 | ---- 91 | *** prog: val b = new { zb => 92 | Foo -> (⊥,⊤) 93 | Inner -> (⊥,{ zi => 94 | Bar -> (⊥,⊤) 95 | outerFoo -> (zb.Foo,zb.Foo) 96 | obj -> zi.Bar 97 | foo -> (x,zb.Inner,x.Bar) 98 | }) 99 | x -> zb.Foo 100 | } { } 101 | val a = new b.Inner ∧ { zf => 102 | self -> zf 103 | } { } 104 | val c = a 105 | val r = c.self.foo(a.self) 106 | r 107 | *** tp: a.self.Bar 108 | should have r: a.Bar = c.Bar (true) 109 | true 110 | -------------------------------------------------------------------------------- /src/main/scala/lancet/interpreter/CCompile.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | 23 | package lancet.interpreter 24 | 25 | // TODO 26 | 27 | object CCompile { 28 | 29 | val csrc = """ 30 | #import 31 | 32 | JNIEXPORT jint JNICALL Java_Foo_bar ( 33 | JNIEnv *env, /* interface pointer */ 34 | jobject obj, /* "this" pointer */ 35 | jint i); /* argument #1 */ 36 | 37 | 38 | 39 | jint Java_Foo_bar ( 40 | JNIEnv *env, /* interface pointer */ 41 | jobject obj, /* "this" pointer */ 42 | jint i) /* argument #1 */ 43 | { 44 | return 2 * i; 45 | } 46 | """ 47 | 48 | 49 | val scalasrc = """ 50 | class Foo { 51 | @native def bar(x: Int): Int 52 | } 53 | """ 54 | 55 | def compile[A,B](source: String): A=>B = { 56 | 57 | assert(false, "NOT IMPLEMENTED") 58 | 59 | 60 | // write csrc to file 61 | // ... 62 | 63 | val cmd = "gcc -shared -o /tmp/libtest.dylib -c /tmp/test.c -I /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers" 64 | 65 | // exec cmd 66 | 67 | System.load("/tmp/libtest.dylib") 68 | 69 | 70 | // ScalaCompile: compile scalasrc, load class, create object 71 | // ... 72 | 73 | val obj: { def bar(x: Int): Int } = null 74 | 75 | 76 | println(obj bar 7) 77 | 78 | obj.asInstanceOf[A=>B] 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /src/main/scala/lancet/api/demo: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | 23 | val c = lancet.api.Lancet.newInstance(global) 24 | import c._ 25 | 26 | val f = lms { x: Rep[Int] => (quote(3 * unquote(x))) } 27 | 28 | 29 | 30 | 31 | def foo(x:Int) = 3 * x + 4 32 | 33 | foo(7) 34 | 35 | val f = fun(foo _) 36 | 37 | f(7) 38 | 39 | f.printcode 40 | 41 | 42 | 43 | def foo(x:Int, y: Int) = 3 * x + y 44 | 45 | val foo6 = fun { y: Int => foo(6,y) } 46 | 47 | foo6.printcode 48 | 49 | 50 | 51 | def fooX(x: Int) = fun { y: Int => foo(x,y) } 52 | 53 | val foo6 = fooX(6) 54 | 55 | foo6.printcode 56 | 57 | 58 | 59 | 60 | // staging 61 | 62 | val f = lms { x: Rep[Int] => x * 4 } 63 | 64 | f(8) 65 | 66 | 67 | val f = lms { x: Rep[Int] => quote(3 * 4) } 68 | 69 | f(8) 70 | 71 | 72 | val f = lms { x: Rep[Int] => quote(3 * unquote(x)) } 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | // continuations 81 | 82 | 83 | def foo(x: Int) = shift((k: Int=>Int) => k(x) + k(x)) 84 | 85 | foo(7) 86 | 87 | 88 | exec { foo(7) + 3 } 89 | 90 | 91 | 92 | 93 | 94 | 95 | // slowpath 96 | 97 | 98 | def speculate(x: Int, y: Int) = shift((k:Int=>Int)=> if (x == y) k(y) else { slowpath; k(x) }) 99 | 100 | 101 | var x = 10 102 | 103 | val f = fun { speculate(x, 10) + 100 } 104 | 105 | f() 106 | 107 | x = 100 108 | 109 | f() -------------------------------------------------------------------------------- /src/main/scala/optiml/library/ScalaCompanion.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package optiml 23 | package library 24 | 25 | import java.io.{BufferedReader,FileReader} 26 | 27 | import lancet.api._ 28 | import lancet.interpreter._ 29 | import lancet.core._ 30 | 31 | class ScalaCompanion { 32 | 33 | def stringFromFile(path: String) = scala.io.Source.fromFile(path).mkString 34 | 35 | def sort(x: Array[String]) = { 36 | val z = new Array[String](x.length) 37 | System.arraycopy(x,0,z,0,x.length) 38 | //java.util.Arrays.sort(z.asInstanceOf[Array[Object]]) 39 | scala.util.Sorting.quickSort(z) 40 | z 41 | } 42 | 43 | def println(x: Any) = Console.println(x.toString) 44 | 45 | def longString(x: Int) = x.toString 46 | 47 | def field1(t: ((String,Int))) = t._1 48 | def field2(t: ((String,Int))) = t._2 49 | 50 | def zipWithIndex(a: Array[String]): Array[(String,Int)] = a.zipWithIndex 51 | 52 | def map(a: Array[String], f: String => String): Array[String] = a.map(f) 53 | def map2(a: Array[(String,Int)], f: ((String,Int)) => Int): Array[Int] = { 54 | val out = new Array[Int](a.length) 55 | for (i <- (0 until a.length).par) out(i) = f(a(i)) 56 | out 57 | //a.par.map(f).seq 58 | } 59 | def map3(a: String, f: Char => Int): Array[Int] = a.map(f).toArray 60 | 61 | def reduce(a: Array[Int], f: (Int,Int) => Int): Int = a.reduce(f) 62 | def reduce2(a: Array[Int], f: (Int,Int) => Int): Int = a.par.reduce(f) 63 | } 64 | -------------------------------------------------------------------------------- /src/main/scala/optiml/library/IndexVector.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package optiml 23 | package library 24 | 25 | import lancet.api._ 26 | import lancet.interpreter._ 27 | import lancet.core._ 28 | 29 | class IndexVectorRange(val _start: Int, val _end: Int) { 30 | /* Vector constructor */ 31 | def construct[T](f: Int => T): DenseVector[T] = { 32 | assert(_start == 0) 33 | val out = (new DenseVector[Int](_end-_start,true)).asInstanceOf[DenseVector[T]] 34 | for (i <- (0 until _end).par) { 35 | out(i) = f(i) 36 | } 37 | out 38 | } 39 | 40 | def construct2[T](f: Int => T): DenseVector[T] = { 41 | assert(_start == 0) 42 | val out = (new DenseVector[DenseVector[Double]](_end-_start,true)).asInstanceOf[DenseVector[T]] 43 | for (i <- (0 until _end).par) { 44 | out(i) = f(i) 45 | } 46 | out 47 | } 48 | 49 | /* Matrix constructor */ 50 | def constructRows[T](f: Int => DenseVector[T]): DenseMatrix[T] = { 51 | val out = (new DenseMatrix[Double](0,0)).asInstanceOf[DenseMatrix[T]] 52 | for (i <- _start until _end) { 53 | out <<= f(i) 54 | } 55 | out 56 | } 57 | 58 | def apply(n: Int): Int = _start + n 59 | 60 | def map[T](f: Int => T): DenseVector[T] = { 61 | assert(_start == 0) 62 | val out = (new DenseVector[Double](_end-_start,true)).asInstanceOf[DenseVector[T]] 63 | for (i <- 0 until _end) { 64 | out(i) = f(i) 65 | } 66 | out 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/scala/optiml/macros/Runner.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package optiml 23 | package macros 24 | 25 | import lancet.api._ 26 | import lancet.interpreter._ 27 | import lancet.core._ 28 | 29 | import ppl.delite.framework.Config 30 | 31 | import optiml._ 32 | 33 | object OptiMLLancetRunner { 34 | val OptiMLRunner = new LancetDeliteRunner 35 | 36 | OptiMLRunner.initialize() 37 | OptiMLRunner.traceMethods = true 38 | OptiMLRunner.emitUniqueOpt = true 39 | OptiMLRunner.emitCheckCast = false 40 | 41 | // add macros 42 | OptiMLRunner.install(OptiMLMacros) 43 | OptiMLRunner.install(DenseVectorMacros) 44 | OptiMLRunner.install(DenseMatrixMacros) 45 | OptiMLRunner.install(IndexVectorMacros) 46 | OptiMLRunner.install(BenchmarkAccelerationMacros) 47 | 48 | def infix_run(runner: LancetDeliteRunner) = { 49 | // now run stuff.... 50 | println("starting run") 51 | 52 | runner.VConstantPool = scala.collection.immutable.Vector.empty 53 | // Config.cacheSyms = false 54 | // runner.generateScalaSource("Generated", new java.io.PrintWriter(System.out)) 55 | // runner.globalDefs.foreach(println) 56 | // sys.exit(0) 57 | val cst = runner.VConstantPool 58 | println("constants: "+cst) 59 | 60 | //println("*** running execute ***") 61 | 62 | //runner.execute(Array()) 63 | 64 | println("*** running compileAndTest ***") 65 | 66 | DeliteRunner.verboseDefs = true 67 | DeliteRunner.compileAndTest(runner) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /test-out/test-interpreter-4decompile2.check: -------------------------------------------------------------------------------- 1 | // constants: ,,lancet.interpreter.TestInterpreter4@a9f3894 2 | class Generated0(CONST_0: lancet.interpreter.TestInterpreter4$$anonfun$test2$1$$anonfun$2,CONST_1: lancet.interpreter.TestInterpreter4$$anonfun$test2$1,CONST_2: lancet.interpreter.TestInterpreter4) extends (scala.collection.Seq[_]=>scala.collection.Seq[_]){ 3 | import sun.misc.Unsafe 4 | val unsafe = { val fld = classOf[Unsafe].getDeclaredField("theUnsafe"); fld.setAccessible(true); fld.get(classOf[Unsafe]).asInstanceOf[Unsafe]; } 5 | type char = Char 6 | def WARN = assert(false, "WARN") 7 | def ERROR = assert(false, "ERROR") 8 | def apply(ARG: scala.collection.Seq[_]): scala.collection.Seq[_] = { object BODY { 9 | var RES = null.asInstanceOf[scala.collection.Seq[_]] 10 | val x0 = ARG 11 | val x1 = unsafe.allocateInstance(Class.forName("lancet.interpreter.TestInterpreter4$$anonfun$test2$1$$anonfun$2$$anonfun$apply$2")) 12 | unsafe.putObject(x1,12L, CONST_0) 13 | val x11 = x0.asInstanceOf[Traversable[Object]].filter { (x2:Object) => { 14 | var RES = null.asInstanceOf[Object] 15 | val x3 = x2.asInstanceOf[lancet.interpreter.TestInterpreter4$Person] // checkCast 16 | // unique method: HotSpotMethod TODO: guard 17 | val x4 = unsafe.getBoolean(x3,16L) 18 | val x5 = if (x4) { 19 | 1 20 | } else { 21 | 0 22 | } 23 | val x6 = x5 == 0 24 | if (x6) { 25 | val PHI_4_5 = 1 // LUBC(PHI_4_5:Int,1:Int) 26 | BLOCK_25(PHI_4_5,x0,x1,x2,x3,x4,x6) 27 | } else { 28 | // unique method: HotSpotMethod TODO: guard 29 | val x7 = unsafe.getInt(x3,12L) 30 | val x8 = 42 <= x7 31 | if (x8) { 32 | val PHI_4_5 = 0 // LUBC(PHI_4_5:Int,0:Int) 33 | BLOCK_25(PHI_4_5,x0,x1,x2,x3,x4,x6) 34 | } else { 35 | val PHI_4_5 = 1 // LUBC(PHI_4_5:Int,1:Int) 36 | BLOCK_25(PHI_4_5,x0,x1,x2,x3,x4,x6) 37 | } 38 | } 39 | def BLOCK_25(PHI_4_5:Int,x0:scala.collection.Seq[_],x1:Object,x2:Object,x3:Object,x4:Boolean,x6:Boolean): Unit = { 40 | val x9 = PHI_4_5 == 1 41 | val x10 = x9.asInstanceOf[java.lang.Boolean] 42 | (RES = x10) // return to root 43 | } 44 | // (no return?) 45 | RES.asInstanceOf[Boolean] 46 | }} 47 | val x12 = x11.asInstanceOf[scala.collection.Seq[_]] // checkCast 48 | (RES = x12) // return to root 49 | // (no return?) 50 | }; BODY.RES } 51 | } 52 | 53 | compilation: ok 54 | 55 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntStream.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class IntStream(val numRows: Int, val numCols: Int, val chunkSize: Int, val func: (Int,Int) => Int, val isPure: Boolean) { //extends IntStream { 27 | val bufRows = math.min(numRows, chunkSize) 28 | val size = numCols*bufRows 29 | protected var _data: Array[Int] = try { new Array[Int](size) } 30 | catch { 31 | case _ => throw new RuntimeException("Stream overflowed during initialization (numCols = " + numCols + ", chunkSize = " + bufRows + ")") 32 | } 33 | def data = _data 34 | 35 | def initRow(row: Int, offset: Int) { 36 | var j = 0 37 | val lhsOff = row*numCols 38 | val rhsOff = offset*chunkSize+row 39 | while (j < numCols) { 40 | _data(lhsOff+j) = func(rhsOff,j) 41 | j += 1 42 | } 43 | } 44 | 45 | // chunk management must be done inside the op (foreachRows), not in the impl 46 | // here, we just have to assume that init has been called appropriately and idx points to the right chunk 47 | 48 | def chunkRow(idx: Int, offset: Int) = { 49 | //vview(idx*numCols, 1, numCols, true) 50 | new IntStreamRow(idx, offset, this, _data) 51 | } 52 | 53 | def rawElem(idx: Int): Int = { 54 | _data(idx) 55 | } 56 | 57 | def vview(start: Int, stride: Int, length: Int, isRow: Boolean) = { 58 | new IntDenseVectorView(_data, start, stride, length, isRow) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/Stream.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class Stream[T:Manifest](val numRows: Int, val numCols: Int, val chunkSize: Int, val func: (Int,Int) => T, val isPure: Boolean) { //extends Stream[T] { 27 | val bufRows = math.min(numRows, chunkSize) 28 | val size = numCols*bufRows 29 | protected var _data: Array[T] = try { new Array[T](size) } 30 | catch { 31 | case _ => throw new RuntimeException("Stream overflowed during initialization (numCols = " + numCols + ", chunkSize = " + bufRows + ")") 32 | } 33 | def data = _data 34 | 35 | def initRow(row: Int, offset: Int) { 36 | var j = 0 37 | val lhsOff = row*numCols 38 | val rhsOff = offset*chunkSize+row 39 | while (j < numCols) { 40 | _data(lhsOff+j) = func(rhsOff,j) 41 | j += 1 42 | } 43 | } 44 | 45 | // chunk management must be done inside the op (foreachRows), not in the impl 46 | // here, we just have to assume that init has been called appropriately and idx points to the right chunk 47 | 48 | def chunkRow(idx: Int, offset: Int) = { 49 | //vview(idx*numCols, 1, numCols, true) 50 | new StreamRow[T](idx, offset, this, _data) 51 | } 52 | 53 | def rawElem(idx: Int): T = { 54 | _data(idx) 55 | } 56 | 57 | def vview(start: Int, stride: Int, length: Int, isRow: Boolean) = { 58 | new DenseVectorView[T](_data, start, stride, length, isRow) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/LongStream.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class LongStream(val numRows: Int, val numCols: Int, val chunkSize: Int, val func: (Int,Int) => Long, val isPure: Boolean) { //extends LongStream { 27 | val bufRows = math.min(numRows, chunkSize) 28 | val size = numCols*bufRows 29 | protected var _data: Array[Long] = try { new Array[Long](size) } 30 | catch { 31 | case _ => throw new RuntimeException("Stream overflowed during initialization (numCols = " + numCols + ", chunkSize = " + bufRows + ")") 32 | } 33 | def data = _data 34 | 35 | def initRow(row: Int, offset: Int) { 36 | var j = 0 37 | val lhsOff = row*numCols 38 | val rhsOff = offset*chunkSize+row 39 | while (j < numCols) { 40 | _data(lhsOff+j) = func(rhsOff,j) 41 | j += 1 42 | } 43 | } 44 | 45 | // chunk management must be done inside the op (foreachRows), not in the impl 46 | // here, we just have to assume that init has been called appropriately and idx points to the right chunk 47 | 48 | def chunkRow(idx: Int, offset: Int) = { 49 | //vview(idx*numCols, 1, numCols, true) 50 | new LongStreamRow(idx, offset, this, _data) 51 | } 52 | 53 | def rawElem(idx: Int): Long = { 54 | _data(idx) 55 | } 56 | 57 | def vview(start: Int, stride: Int, length: Int, isRow: Boolean) = { 58 | new LongDenseVectorView(_data, start, stride, length, isRow) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/FloatStream.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class FloatStream(val numRows: Int, val numCols: Int, val chunkSize: Int, val func: (Int,Int) => Float, val isPure: Boolean) { //extends FloatStream { 27 | val bufRows = math.min(numRows, chunkSize) 28 | val size = numCols*bufRows 29 | protected var _data: Array[Float] = try { new Array[Float](size) } 30 | catch { 31 | case _ => throw new RuntimeException("Stream overflowed during initialization (numCols = " + numCols + ", chunkSize = " + bufRows + ")") 32 | } 33 | def data = _data 34 | 35 | def initRow(row: Int, offset: Int) { 36 | var j = 0 37 | val lhsOff = row*numCols 38 | val rhsOff = offset*chunkSize+row 39 | while (j < numCols) { 40 | _data(lhsOff+j) = func(rhsOff,j) 41 | j += 1 42 | } 43 | } 44 | 45 | // chunk management must be done inside the op (foreachRows), not in the impl 46 | // here, we just have to assume that init has been called appropriately and idx points to the right chunk 47 | 48 | def chunkRow(idx: Int, offset: Int) = { 49 | //vview(idx*numCols, 1, numCols, true) 50 | new FloatStreamRow(idx, offset, this, _data) 51 | } 52 | 53 | def rawElem(idx: Int): Float = { 54 | _data(idx) 55 | } 56 | 57 | def vview(start: Int, stride: Int, length: Int, isRow: Boolean) = { 58 | new FloatDenseVectorView(_data, start, stride, length, isRow) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/DoubleStream.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | 25 | 26 | class DoubleStream(val numRows: Int, val numCols: Int, val chunkSize: Int, val func: (Int,Int) => Double, val isPure: Boolean) { //extends DoubleStream { 27 | val bufRows = math.min(numRows, chunkSize) 28 | val size = numCols*bufRows 29 | protected var _data: Array[Double] = try { new Array[Double](size) } 30 | catch { 31 | case _ => throw new RuntimeException("Stream overflowed during initialization (numCols = " + numCols + ", chunkSize = " + bufRows + ")") 32 | } 33 | def data = _data 34 | 35 | def initRow(row: Int, offset: Int) { 36 | var j = 0 37 | val lhsOff = row*numCols 38 | val rhsOff = offset*chunkSize+row 39 | while (j < numCols) { 40 | _data(lhsOff+j) = func(rhsOff,j) 41 | j += 1 42 | } 43 | } 44 | 45 | // chunk management must be done inside the op (foreachRows), not in the impl 46 | // here, we just have to assume that init has been called appropriately and idx points to the right chunk 47 | 48 | def chunkRow(idx: Int, offset: Int) = { 49 | //vview(idx*numCols, 1, numCols, true) 50 | new DoubleStreamRow(idx, offset, this, _data) 51 | } 52 | 53 | def rawElem(idx: Int): Double = { 54 | _data(idx) 55 | } 56 | 57 | def vview(start: Int, stride: Int, length: Int, isRow: Boolean) = { 58 | new DoubleDenseVectorView(_data, start, stride, length, isRow) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/scala/generated/scala/IntSparseMatrixCSR.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/agpl.html. 17 | * 18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 | * or visit www.oracle.com if you need additional information or have any 20 | * questions. 21 | */ 22 | package generated.scala 23 | 24 | /** 25 | * A sparse matrix in Compressed Sparse Row (CSR) format, efficient for reads and matrix arithmetic operations. 26 | * SparseMatrixCOO should be used to construct sparse matrices. 27 | * 28 | * Should we use CSC? At the very least, we should probably have an alternative CSC implementation to experiment with. 29 | * In ML, m >> n, so CSC would require less storage. However, row slicing (to get a single training example) would be less efficient. 30 | * Since this is OptiLA, we should probably provide both. 31 | */ 32 | class IntSparseMatrixCSR(__numRows: Int, __numCols: Int) { 33 | var _numRows = __numRows 34 | var _numCols = __numCols 35 | // non-zero values, left-to-right then top-to-bottom 36 | var _data = new Array[Int](32) 37 | // column index of each non-zero value 38 | var _colIndices = new Array[Int](32) 39 | // starting location of each row, e.g. (_rowPtr(3) = 5 means that row 3 starts at value index 5) 40 | var _rowPtr = new Array[Int](_numRows+1) 41 | var _nnz = 0 42 | 43 | /** 44 | * These are temporarily needed because they are hard-coded into DeliteOp code gen. 45 | */ 46 | def unsafeSetData(xs: Array[Int], len: Int) = throw new UnsupportedOperationException("unsafeSetData in SparseMatrixCSR not supported") 47 | 48 | def Clone = { 49 | val m = new IntSparseMatrixCSR(_numRows, _numCols) 50 | m._data = _data.clone 51 | m._colIndices = _colIndices.clone 52 | m._rowPtr = _rowPtr.clone 53 | m._nnz = _nnz 54 | m 55 | } 56 | } 57 | --------------------------------------------------------------------------------