Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ee30746

Browse filesBrowse files
committed
add example for SymMatCloud paper
1 parent 88c8f12 commit ee30746
Copy full SHA for ee30746

File tree

Expand file treeCollapse file tree

6 files changed

+46
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+46
-8
lines changed
Open diff view settings
Collapse file

‎.classpath‎

Copy file name to clipboardExpand all lines: .classpath
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<classpathentry kind="lib" path="lib/libsvm.jar"/>
88
<classpathentry kind="lib" path="lib/jzlib.jar"/>
99
<classpathentry kind="lib" path="lib/netty-all-5.0.0.Alpha2.jar" sourcepath="/home/yueming/Downloads/netty-5.0.0.Alpha2/jar/all-in-one/netty-all-5.0.0.Alpha2-sources.jar"/>
10-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 7 [1.7.0_75]"/>
11-
<classpathentry combineaccessrules="false" kind="src" path="/Futureye"/>
10+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-7-oracle"/>
11+
<classpathentry combineaccessrules="false" kind="src" path="/Futureye_v2"/>
1212
<classpathentry kind="output" path="bin"/>
1313
</classpath>
Collapse file

‎conf/job1.conf‎

Copy file name to clipboard
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ec2-54-200-107-134.us-west-2.compute.amazonaws.com:8322
1+
104.130.29.188:8322
22
vm2-yliu.cloudapp.net:8322
33
104.197.57.20:8322
44
15.126.216.80:8322
5-
104.130.29.188:8322
6-
107.189.111.104:8322
5+
107.189.111.104:8322
6+
ec2-54-200-107-134.us-west-2.compute.amazonaws.com:8322
Collapse file

‎src/lambdacloud/core/lang/LCVar.java‎

Copy file name to clipboardExpand all lines: src/lambdacloud/core/lang/LCVar.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* The base type of the local variables in a compiled function.
23-
* Particular type of a local variable is defined in a sub-class of CloudVar.
23+
* Particular type of a local variable is defined in a sub-class of LCVar.
2424
* <br>
2525
*
2626
* The local variables are exactly the same as the local variables in a Java function
Collapse file

‎src/lambdacloud/examples/Example1.java‎

Copy file name to clipboardExpand all lines: src/lambdacloud/examples/Example1.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void main(String[] args) {
1414
// Set your secure configure file.
1515
// You can register an account and download it from
1616
// http://lambdacloud.io
17-
CloudConfig.setGlobalTarget("job1.conf");
17+
CloudConfig.setGlobalTarget("job_local.conf");
1818

1919
// Store myData to the cloud, which is initialized by
2020
// an array of double numbers.
Collapse file

‎src/lambdacloud/examples/Example2.java‎

Copy file name to clipboardExpand all lines: src/lambdacloud/examples/Example2.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
public class Example2 {
2828

2929
public static void main(String[] args) {
30-
CloudConfig.setGlobalTarget("job1.conf");
30+
CloudConfig.setGlobalTarget("job_local.conf");
3131

3232
LCVar x = LCVar.getDouble("x");
3333
LCVar y = LCVar.getDouble("y");
Collapse file
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package lambdacloud.examples;
2+
3+
import lambdacloud.core.CloudConfig;
4+
import lambdacloud.core.CloudFunc;
5+
import lambdacloud.core.CloudSD;
6+
import lambdacloud.core.lang.LCVar;
7+
import symjava.bytecode.BytecodeFunc;
8+
import symjava.symbolic.Expr;
9+
import symjava.symbolic.utils.JIT;
10+
11+
public class ExamplePaper {
12+
13+
public static void main(String[] args) {
14+
CloudConfig.setGlobalTarget("job_local.conf");
15+
LCVar x = LCVar.getDouble("x");
16+
LCVar y = LCVar.getDouble("y");
17+
Expr R = 0.127-(x*0.194/(y+0.194));
18+
//Derivative of expression R with respect to y
19+
Expr Rdy = R.diff(y);
20+
//Define a cloud function
21+
CloudFunc fun = new CloudFunc(new LCVar[]{x, y}, Rdy);
22+
//Evaluate the function on the cloud by providing
23+
//input and output parameters
24+
CloudSD input = new CloudSD("input").init(
25+
new double[]{0.362, 0.556});
26+
CloudSD output = new CloudSD("output").resize(1);
27+
fun.apply(output, input);
28+
if(output.fetchToLocal()) {
29+
System.out.println(output.getData()[0]);
30+
}
31+
32+
//Just-In-Time compile the symbolic expression to native code
33+
//and evaluate it locally to verify the result
34+
BytecodeFunc func = JIT.compile(new Expr[]{x,y}, Rdy);
35+
System.out.println(func.apply(0.362, 0.556));
36+
}
37+
38+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.