pike.git / src / modules / Math / math_matrix.c

version» Context lines:

pike.git/src/modules/Math/math_matrix.c:8:   #include "config.h"      #include <math.h>      #include "pike_error.h"   #include "interpret.h"   #include "svalue.h"   #include "operators.h"   #include "builtin_functions.h"   #include "module_support.h" - #include "operators.h" + #include "pike_types.h"      #include "math_module.h"      #include "bignum.h"    -  + #ifdef HAVE_MPI_H + #include <mpi.h> + #endif +    /*! @module Math    */      /*! @class Matrix    *! Matrix representation with double precision floating point values.    */    - static struct pike_string *s_array; +    static struct pike_string *s__clr;   static struct pike_string *s_identity;   static struct pike_string *s_rotate;      extern struct program *math_matrix_program;   extern struct program *math_smatrix_program;   extern struct program *math_imatrix_program;   extern struct program *math_fmatrix_program; - #ifdef INT64 +    extern struct program *math_lmatrix_program; - #endif /* INT64 */ +     -  + #ifdef HAS_MPI + struct size_info { +  int x, y; + }; +  + struct op_info { +  struct object *o; +  void **data; + }; +  + extern PMOD_EXPORT struct object *mpi_ex_op(struct op_info (*create)(void *), +  struct svalue *ufun, int commute, +  void *info, int shift, int len); +  + #endif +    #define PNAME "Matrix"   #define FTYPE double   #define PTYPE tFloat   #define matrixX(X) PIKE_CONCAT(matrix,X)   #define Xmatrix(X) PIKE_CONCAT(X,matrix)   #define XmatrixY(X,Y) PIKE_CONCAT3(X,matrix,Y)   #define PUSH_ELEM( X ) push_float( (FLOAT_TYPE)(X) ) -  + #define MATRIX_MPI_TYPE MPI_DOUBLE + #define MATRIX_MPI_SHIFT (17<<3)   #include <matrix_code.h> -  + #undef MATRIX_MPI_SHIFT + #undef MATRIX_MPI_TYPE   #undef PUSH_ELEM   #undef matrixX   #undef Xmatrix   #undef XmatrixY   #undef FTYPE   #undef PTYPE   #undef PNAME      #define PNAME "IMatrix"   #define FTYPE int   #define PTYPE tInt   #define matrixX(X) PIKE_CONCAT(imatrix,X)   #define Xmatrix(X) PIKE_CONCAT(X,imatrix)   #define XmatrixY(X,Y) PIKE_CONCAT3(X,imatrix,Y)   #define PUSH_ELEM( X ) push_int( (INT_TYPE)(X) ) -  + #define MATRIX_MPI_TYPE MPI_INT + #define MATRIX_MPI_SHIFT (18<<3)   #include <matrix_code.h> -  + #undef MATRIX_MPI_SHIFT + #undef MATRIX_MPI_TYPE   #undef PUSH_ELEM   #undef Xmatrix   #undef matrixX   #undef XmatrixY   #undef FTYPE   #undef PTYPE   #undef PNAME    - #ifdef INT64 +    #define PNAME "LMatrix"   #define FTYPE INT64   #define PTYPE tInt   #define matrixX(X) PIKE_CONCAT(lmatrix,X)   #define Xmatrix(X) PIKE_CONCAT(X,lmatrix)   #define XmatrixY(X,Y) PIKE_CONCAT3(X,lmatrix,Y)   #define PUSH_ELEM( X ) push_int64( (INT64)(X) ) -  + #define MATRIX_MPI_TYPE MPI_LONG_LONG_INT + #define MATRIX_MPI_SHIFT (19<<3)   #include <matrix_code.h> -  + #undef MATRIX_MPI_SHIFT + #undef MATRIX_MPI_TYPE   #undef PUSH_ELEM   #undef Xmatrix   #undef matrixX   #undef XmatrixY   #undef FTYPE   #undef PTYPE   #undef PNAME - #endif /* INT64 */ +       #define PNAME "FMatrix"   #define FTYPE float   #define PTYPE tFloat   #define matrixX(X) PIKE_CONCAT(fmatrix,X)   #define Xmatrix(X) PIKE_CONCAT(X,fmatrix)   #define XmatrixY(X,Y) PIKE_CONCAT3(X,fmatrix,Y)   #define PUSH_ELEM( X ) push_float( (FLOAT_TYPE)(X) ) -  + #define MATRIX_MPI_TYPE MPI_FLOAT + #define MATRIX_MPI_SHIFT (20<<3)   #include <matrix_code.h> -  + #undef MATRIX_MPI_SHIFT + #undef MATRIX_MPI_TYPE   #undef PUSH_ELEM   #undef Xmatrix   #undef matrixX   #undef XmatrixY   #undef FTYPE   #undef PTYPE   #undef PNAME      #define PNAME "SMatrix"   #define FTYPE short   #define PTYPE tInt   #define matrixX(X) PIKE_CONCAT(smatrix,X)   #define Xmatrix(X) PIKE_CONCAT(X,smatrix)   #define XmatrixY(X,Y) PIKE_CONCAT3(X,smatrix,Y)   #define PUSH_ELEM( X ) push_int( (INT_TYPE)(X) ) -  + #define MATRIX_MPI_TYPE MPI_SHORT_INT + #define MATRIX_MPI_SHIFT (21<<3)   #include <matrix_code.h> -  + #undef MATRIX_MPI_SHIFT + #undef MATRIX_MPI_TYPE   #undef PUSH_ELEM   #undef Xmatrix   #undef matrixX   #undef XmatrixY   #undef FTYPE   #undef PTYPE   #undef PNAME      /*! @decl void create(array(array(int|float)) matrix_2d)    *! @decl void create(array(int|float) matrix_1d)
pike.git/src/modules/Math/math_matrix.c:145:      /*! @decl void create(string type,int size,float rads,Matrix axis)    *! @decl void create(string type,int size,float rads,float x,float y,float z)    *!    *! When @[type] is @expr{"rotate"@} the matrix is initialized as a    *! rotation matrix.    */      /* ---------------------------------------------------------------- */    - /*! @decl array(array) cast(string to_what) -  *! @decl array(array) cast(string to_what) + /*! @decl array(array(float)) cast(string to_what) +  *! @decl array(array(float)) cast(string to_what)    *!    *! It is possible to cast the matrix to an array and get back a    *! double array of floats with the matrix values.    *! @seealso    *! @[vect]    */      /*! @decl array vect()    *! Return all the elements of the matrix as an array of numbers    */