Permalink
Browse files

moved UTPS and CTPS to experimental folder, also move SConstruct.EXAM…

…PLE and added __install_path__ to algopy.__init__.py
  • Loading branch information...
1 parent 2985c20 commit 4a9f171f607b39c6186ba1edbf0ba227b3ab58e8 @b45ch1 committed Jul 25, 2010
View
@@ -39,6 +39,9 @@
"""
+import os
+__install_path__ = os.path.realpath(__file__)
+
# testing
from numpy.testing import Tester
test = Tester().test
@@ -61,3 +64,5 @@
__version__ = 'nobuild'
+
+
View
@@ -3,48 +3,48 @@
import numpy.random
from algopy.utpm import UTPM
-from algopy.utps import UTPS
+# from algopy.utps import UTPS
from algopy.utils import *
-class TestUtils ( TestCase ):
- def test_utpm2utps(self):
- x = UTPM( numpy.zeros((2,5,3,7),dtype=float))
- y = utpm2utps(x)
+# class TestUtils ( TestCase ):
+# def test_utpm2utps(self):
+# x = UTPM( numpy.zeros((2,5,3,7),dtype=float))
+# y = utpm2utps(x)
- assert_array_equal(y.shape, (3,7))
+# assert_array_equal(y.shape, (3,7))
- def test_utps2utpm(self):
- D,P,N,M = 2,5,3,7
- x = numpy.array([[UTPS(numpy.random.rand(D,P)) for m in range(M)] for n in range(N)])
- y = utps2utpm(x)
+# def test_utps2utpm(self):
+# D,P,N,M = 2,5,3,7
+# x = numpy.array([[UTPS(numpy.random.rand(D,P)) for m in range(M)] for n in range(N)])
+# y = utps2utpm(x)
- assert_array_equal(y.data.shape, (D,P,N,M))
+# assert_array_equal(y.data.shape, (D,P,N,M))
- def test_utps2base_and_dirs2utps(self):
- N,P,D = 2,5,3
- x = numpy.array([UTPS(numpy.random.rand(D,P)) for n in range(N)])
- y,W = utps2base_and_dirs(x)
- x2= base_and_dirs2utps(y,W)
- y2,W2= utps2base_and_dirs(x2)
+# def test_utps2base_and_dirs2utps(self):
+# N,P,D = 2,5,3
+# x = numpy.array([UTPS(numpy.random.rand(D,P)) for n in range(N)])
+# y,W = utps2base_and_dirs(x)
+# x2= base_and_dirs2utps(y,W)
+# y2,W2= utps2base_and_dirs(x2)
- assert_array_almost_equal(y,y2)
- assert_array_almost_equal(W,W2)
+# assert_array_almost_equal(y,y2)
+# assert_array_almost_equal(W,W2)
- def test_utpm2base_and_dirs(self):
- D,P,N,M,K = 2,3,4,5,6
- u = UTPM( numpy.arange(D*P*N*M*K).reshape((D,P,N,M,K)))
- x,V = utpm2base_and_dirs(u)
- assert_array_almost_equal(x, numpy.arange(N*M*K).reshape((N,M,K)))
- assert_array_almost_equal(V, numpy.arange(P*N*M*K,D*P*N*M*K).reshape((D-1,P,N,M,K)).transpose((2,3,4,1,0)))
+# def test_utpm2base_and_dirs(self):
+# D,P,N,M,K = 2,3,4,5,6
+# u = UTPM( numpy.arange(D*P*N*M*K).reshape((D,P,N,M,K)))
+# x,V = utpm2base_and_dirs(u)
+# assert_array_almost_equal(x, numpy.arange(N*M*K).reshape((N,M,K)))
+# assert_array_almost_equal(V, numpy.arange(P*N*M*K,D*P*N*M*K).reshape((D-1,P,N,M,K)).transpose((2,3,4,1,0)))
- def test_utpm2dirs(self):
- D,P,N,M,K = 2,3,4,5,6
- u = UTPM( numpy.arange(D*P*N*M*K).reshape((D,P,N,M,K)))
- Vbar = utpm2dirs(u)
- assert_array_almost_equal(Vbar, numpy.arange(D*P*N*M*K).reshape((D,P,N,M,K)).transpose((2,3,4,1,0)) )
+# def test_utpm2dirs(self):
+# D,P,N,M,K = 2,3,4,5,6
+# u = UTPM( numpy.arange(D*P*N*M*K).reshape((D,P,N,M,K)))
+# Vbar = utpm2dirs(u)
+# assert_array_almost_equal(Vbar, numpy.arange(D*P*N*M*K).reshape((D,P,N,M,K)).transpose((2,3,4,1,0)) )
if __name__ == "__main__":
run_module_suite()
@@ -4,8 +4,6 @@
from algopy.tracer.tracer import *
from algopy.utpm import UTPM
-from algopy.utps import UTPS
-from algopy.ctps import CTPS
from algopy import dot, eigh, qr, trace, solve, inv
@@ -216,22 +214,7 @@ def test_gradient(self):
fv2 = (fv1 * fx + fy)*fv1
cg.independentFunctionList = [fx,fy]
cg.dependentFunctionList = [fv2]
-
-
-class TestCGraph_on_UTPS(TestCase):
- def test_forward(self):
- cg = CGraph()
- ax = UTPS([3.,1.])
- ay = UTPS([7.,0.])
- fx = Function(ax)
- fy = Function(ay)
- fv1 = fx * fy
- fv2 = (fv1 * fx + fy)*fv1
- cg.independentFunctionList = [fx,fy]
- cg.dependentFunctionList = [fv2]
- cg.push_forward([ax,ay])
- assert_array_almost_equal(cg.dependentFunctionList[0].x.data, ((ax*ay * ax + ay)*ax*ay).data)
-
+
class Test_CGgraph_on_UTPM(TestCase):
def test_push_forward(self):
@@ -1202,25 +1185,7 @@ def test_pullback_gradient2(self):
h1 = y.x.data[2]
h2 = numpy.array(tmp)
assert_array_almost_equal(2*h1, h2)
-
-
-
-
-class TestCGraphOnCTPS(TestCase):
- def test_forward(self):
- cg = CGraph()
- ax = CTPS([3.,1.,0.,0.])
- ay = CTPS([7.,0.,0.,0.])
- fx = Function(ax)
- fy = Function(ay)
- fv1 = fx * fy
- fv2 = (fv1 * fx + fy)*fv1
- cg.independentFunctionList = [fx,fy]
- cg.dependentFunctionList = [fv2]
- cg.push_forward([ax,ay])
- assert_array_almost_equal(cg.dependentFunctionList[0].x.data, ((ax*ay * ax + ay)*ax*ay).data)
-
-
+
class Test_CGraph_Plotting(TestCase):
def test_simple(self):
View
@@ -1,49 +1,8 @@
import numpy
import numpy.testing
-from utps import UTPS
from utpm import UTPM
-
-def utpm2utps(x):
- """
- converts an instance of UTPM with x.data.shape = P,D,N,M
- to a (N,M) array of UTPS instances y_ij, where y_ij.data.shape = (P,D)
- """
- P,D,N,M = x.data.shape
-
- tmp_n = []
- for n in range(N):
- tmp_m = []
- for m in range(M):
- tmp_m.append( UTPS(x.data[:,:,n,m]))
- tmp_n.append(tmp_m)
-
- return numpy.array(tmp_n)
-
-
-def utps2utpm(x):
- """
- converts a 2D array x of UTPS instances with x.shape = (N,M)
- and x_ij.data.shape = (D,P)
- to a UTPM instance y where y.data.shape = (D,P,N,M)
-
- if x is a 1D array it is converted to a (D,P,N,1) matrix
-
- """
-
- if numpy.ndim(x) == 1:
- x = numpy.reshape(x, (numpy.size(x),1))
-
- N,M = numpy.shape(x)
- P,D = numpy.shape(x[0,0].data)
-
- tmp = numpy.zeros((P,D,N,M),dtype=float)
-
- for n in range(N):
- for m in range(M):
- tmp[:,:,n,m] = x[n,m].data[:,:]
-
- return UTPM(tmp)
+
def utps2base_and_dirs(x):
"""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -48,8 +48,8 @@
AUTHOR_EMAIL = "sebastian.walter@gmail.com"
PLATFORMS = ["Linux"]
MAJOR = 0
-MINOR = 1
-MICRO = 0
+MINOR = 1
+MICRO = 1
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
@@ -144,8 +144,8 @@ def setup_package():
keywords = KEYWORDS,
url=URL,
packages = packages,
- ext_package='algopy.ctps',
- ext_modules=[Extension('libctps', ['algopy/ctps/src/ctps.c'])],
+ # ext_package='algopy.ctps',
+ # ext_modules=[Extension('libctps', ['algopy/ctps/src/ctps.c'])],
)
finally:

0 comments on commit 4a9f171

Please sign in to comment.