/* * Pure Data Packet system implementation. matrix packet interface * Copyright (c) by Tom Schouten * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef PF_MATRIX_H #define PF_MATRIX_H /** * @file matrix.h * @brief Matrix packet class * * Matrix type: all elements are stored in colum major order, * i.e. the standard way c handles them, and opposite to fortran. * This is compatible with both gsl and OpenGL, and is also fits * very well with forth (matrix post multiply operates on rows). */ #include /** \brief Matrix packet subheader Note that we follow standard linear algebra ROWS x COLUMNS notation, even if all other packets use the reverse notation. Best of both worlds :) */ struct pf_matrix { pf_header_t super; /* meta data */ u32 type; ///< encoding u32 rows; ///< number of rows (dim1) u32 columns; ///< number of columns (dim2) void *data; }; #define PF_MATRIX 7 #define PF_MATRIX_COMPLEX_MASK (1<<0) #define PF_MATRIX_DOUBLE_MASK (1<<1) #define PF_MATRIX_RFLOAT (0) ///< real valued single precision floating point #define PF_MATRIX_CFLOAT (0|PF_MATRIX_COMPLEX_MASK) ///< complex valued single precision floating point #define PF_MATRIX_RDOUBLE (0|PF_MATRIX_DOUBLE_MASK) ///< real valued double precision floating point #define PF_MATRIX_CDOUBLE (0|PF_MATRIX_COMPLEX_MASK|PF_MATRIX_DOUBLE_MASK) ///< complex valued double precision floating point #endif