diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-05-06 18:00:03 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-05-06 18:00:03 -0400 |
commit | 53c20f9b347e9aa3b1844f194d86eb056afc2341 (patch) | |
tree | 9685434cfa3a42943760c8fed47b0c2f11594bce /tests | |
parent | 61a7a1ebdc028517db22f33741b31f63018979c2 (diff) | |
download | chroma-53c20f9b347e9aa3b1844f194d86eb056afc2341.tar.gz chroma-53c20f9b347e9aa3b1844f194d86eb056afc2341.tar.bz2 chroma-53c20f9b347e9aa3b1844f194d86eb056afc2341.zip |
added unary minus matrix; updated test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/matrix_test.cu | 5 | ||||
-rw-r--r-- | tests/matrix_test.py | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/matrix_test.cu b/tests/matrix_test.cu index 5c88a92..99e13dc 100644 --- a/tests/matrix_test.cu +++ b/tests/matrix_test.cu @@ -35,6 +35,11 @@ __global__ void inv(float *a, float *dest) matrix2array(inv(m), dest); } +__global__ void minusmatrix(float *a, float *dest) +{ + matrix2array(-array2matrix(a), dest); +} + __global__ void matrixadd(float *a, float *b, float *dest) { matrix2array(array2matrix(a)+array2matrix(b), dest); diff --git a/tests/matrix_test.py b/tests/matrix_test.py index 412acf9..bc4115e 100644 --- a/tests/matrix_test.py +++ b/tests/matrix_test.py @@ -34,6 +34,7 @@ matrixsubequalsfloat = mod.get_function('matrixsubequalsfloat') matrixmulequalsfloat = mod.get_function('matrixmulequalsfloat') matrixdivequalsfloat = mod.get_function('matrixdivequalsfloat') outer = mod.get_function('outer') +minusmatrix = mod.get_function('minusmatrix') size = {'block': (1,1,1), 'grid': (1,1)} @@ -308,3 +309,16 @@ for i in range(1): print dest else: print 'success' + + print 'testing minus matrix...', + + dest = np.copy(a) + + minusmatrix(cuda.In(a), cuda.Out(dest), **size) + + if not np.allclose(-a, dest): + print 'fail' + print -a + print dest + else: + print 'success' |