[Swift-commit] r8105 - SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py
wozniak at ci.uchicago.edu
wozniak at ci.uchicago.edu
Tue Aug 12 11:59:38 CDT 2014
Author: wozniak
Date: 2014-08-12 11:59:37 -0500 (Tue, 12 Aug 2014)
New Revision: 8105
Added:
SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/add.swift
Removed:
SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/numpy.swift
Modified:
SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/run-local.sh
Log:
Rename, make numpy library
Copied: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/add.swift (from rev 8104, SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/numpy.swift)
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/add.swift (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/add.swift 2014-08-12 16:59:37 UTC (rev 8105)
@@ -0,0 +1,27 @@
+
+// Swift/T libraries:
+import io;
+import python;
+import string;
+
+// This example: See ./numpy.swift
+import numpy;
+
+f()
+{
+ python(
+----
+print("Python works!")
+repr(0)
+----);
+}
+
+main
+{
+ f();
+ matrix A1 = eye(3);
+ matrix A2 = eye(3);
+ matrix sum = add(A1, A2);
+ printf("2*eye(3)=%s", sum);
+}
+
Deleted: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/numpy.swift
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/numpy.swift 2014-08-12 16:56:24 UTC (rev 8104)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/numpy.swift 2014-08-12 16:59:37 UTC (rev 8105)
@@ -1,43 +0,0 @@
-
-import io;
-import python;
-import string;
-
-f()
-{
- python(
-----
-print("Python works!")
-repr(0)
-----);
-}
-
-global const string numpy = "from numpy import *\n\n";
-
-typedef matrix string;
-
-(matrix A) eye(int n)
-{
- string command = sprintf("repr(eye(%i))", n);
- string code = numpy+command;
- matrix t = python(code);
- A = replace_all(t, "\n", "", 0);
-}
-
-(matrix R) add(matrix A1, matrix A2)
-{
- string command = sprintf("repr(%s+%s)", A1, A2);
- string code = numpy+command;
- matrix t = python(code);
- R = replace_all(t, "\n", "", 0);
-}
-
-main
-{
- f();
- matrix A1 = eye(3);
- matrix A2 = eye(3);
- matrix sum = add(A1, A2);
- printf("2*eye(3)=%s", sum);
-}
-
Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/run-local.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/run-local.sh 2014-08-12 16:56:24 UTC (rev 8104)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/04-py/run-local.sh 2014-08-12 16:59:37 UTC (rev 8105)
@@ -2,6 +2,6 @@
source ../../cfg/setup-local.sh
-PROGRAM=numpy
+PROGRAM=add
stc ${PROGRAM}.swift
turbine ${PROGRAM}.tcl
More information about the Swift-commit
mailing list