summaryrefslogtreecommitdiff
path: root/doc/swig/test/Matrix.h
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2008-08-23 23:17:23 +0000
committerStefan van der Walt <stefan@sun.ac.za>2008-08-23 23:17:23 +0000
commit5c86844c34674e3d580ac2cd12ef171e18130b13 (patch)
tree2fdf1150706c07c7e193eb7483ce58a5074e5774 /doc/swig/test/Matrix.h
parent376d483d31c4c5427510cf3a8c69fc795aef63aa (diff)
downloadnumpy-5c86844c34674e3d580ac2cd12ef171e18130b13.tar.gz
Move documentation outside of source tree. Remove `doc` import from __init__.
Diffstat (limited to 'doc/swig/test/Matrix.h')
-rw-r--r--doc/swig/test/Matrix.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/doc/swig/test/Matrix.h b/doc/swig/test/Matrix.h
new file mode 100644
index 000000000..f37836cc4
--- /dev/null
+++ b/doc/swig/test/Matrix.h
@@ -0,0 +1,52 @@
+#ifndef MATRIX_H
+#define MATRIX_H
+
+// The following macro defines the prototypes for a family of
+// functions that work with 2D arrays with the forms
+//
+// TYPE SNAMEDet( TYPE matrix[2][2]);
+// TYPE SNAMEMax( TYPE * matrix, int rows, int cols);
+// TYPE SNAMEMin( int rows, int cols, TYPE * matrix);
+// void SNAMEScale( TYPE array[3][3]);
+// void SNAMEFloor( TYPE * array, int rows, int cols, TYPE floor);
+// void SNAMECeil( int rows, int cols, TYPE * array, TYPE ceil );
+// void SNAMELUSplit(TYPE in[3][3], TYPE lower[3][3], TYPE upper[3][3]);
+//
+// for any specified type TYPE (for example: short, unsigned int, long
+// long, etc.) with given short name SNAME (for example: short, uint,
+// longLong, etc.). The macro is then expanded for the given
+// TYPE/SNAME pairs. The resulting functions are for testing numpy
+// interfaces, respectively, for:
+//
+// * 2D input arrays, hard-coded lengths
+// * 2D input arrays
+// * 2D input arrays, data last
+// * 2D in-place arrays, hard-coded lengths
+// * 2D in-place arrays
+// * 2D in-place arrays, data last
+// * 2D argout arrays, hard-coded length
+//
+#define TEST_FUNC_PROTOS(TYPE, SNAME) \
+\
+TYPE SNAME ## Det( TYPE matrix[2][2]); \
+TYPE SNAME ## Max( TYPE * matrix, int rows, int cols); \
+TYPE SNAME ## Min( int rows, int cols, TYPE * matrix); \
+void SNAME ## Scale( TYPE array[3][3], TYPE val); \
+void SNAME ## Floor( TYPE * array, int rows, int cols, TYPE floor); \
+void SNAME ## Ceil( int rows, int cols, TYPE * array, TYPE ceil ); \
+void SNAME ## LUSplit(TYPE matrix[3][3], TYPE lower[3][3], TYPE upper[3][3]);
+
+TEST_FUNC_PROTOS(signed char , schar )
+TEST_FUNC_PROTOS(unsigned char , uchar )
+TEST_FUNC_PROTOS(short , short )
+TEST_FUNC_PROTOS(unsigned short , ushort )
+TEST_FUNC_PROTOS(int , int )
+TEST_FUNC_PROTOS(unsigned int , uint )
+TEST_FUNC_PROTOS(long , long )
+TEST_FUNC_PROTOS(unsigned long , ulong )
+TEST_FUNC_PROTOS(long long , longLong )
+TEST_FUNC_PROTOS(unsigned long long, ulongLong)
+TEST_FUNC_PROTOS(float , float )
+TEST_FUNC_PROTOS(double , double )
+
+#endif