|
Fuzzy Logic Tools v1.0
|
00001 /* Copyright (C) 2004-2011 00002 ANTONIO JAVIER BARRAGAN, antonio.barragan@diesia.uhu.es 00003 http://uhu.es/antonio.barragan 00004 00005 Collaborators: 00006 JOSE MANUEL ANDUJAR, andujar@diesia.uhu.es 00007 MARIANO J. AZNAR, marianojose.aznar@alu.uhu.es 00008 00009 DPTO. DE ING. ELECTRONICA, DE SISTEMAS INFORMATICOS Y AUTOMATICA 00010 ETSI, UNIVERSITY OF HUELVA (SPAIN) 00011 00012 For more information, please contact with authors. 00013 00014 This software is free software: you can redistribute it and/or modify 00015 it under the terms of the GNU General Public License as published by 00016 the Free Software Foundation, either version 3 of the License, or 00017 (at your option) any later version. 00018 00019 This software is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #ifndef _AUX_MATLAB_HPP_ 00029 #define _AUX_MATLAB_HPP_ 00030 00038 #include "mex.h" // MATLABĀ© API 00039 #include <flt/utilities.hpp> 00040 00041 namespace FLT // Use the FTL (Fuzzy Logic Tools) namespace 00042 { 00048 inline void col2row_major(const double * const colM, double *rowM, size_t num_rows, size_t num_cols) 00049 { 00050 double *p = rowM; 00051 for (size_t i=0; i<num_rows; i++) 00052 for (size_t j=0; j<num_cols; j++, p++) 00053 *p = colM[i+j*num_rows]; 00054 }; 00055 00061 inline TNT::Array2D<double> col2row_major(const double * const colM, size_t num_rows, size_t num_cols) 00062 { 00063 TNT::Array2D<double> M (num_rows, num_cols); 00064 double *p = M[0]; 00065 for (size_t i=0; i<num_rows; i++) 00066 for (size_t j=0; j<num_cols; j++, p++) 00067 *p = colM[i+j*num_rows]; 00068 return M; 00069 }; 00070 00076 inline void row2col_major(const double * const rowM, double *colM, size_t num_rows, size_t num_cols) 00077 { 00078 double *p = colM; 00079 for (size_t i=0; i<num_cols; i++) 00080 for (size_t j=0; j<num_rows; j++, p++) 00081 *p = rowM[i+j*num_cols]; 00082 /* for (i=0;i<n;i++) 00083 { 00084 for (q=0;q<n;q++) 00085 { 00086 *J = Jac[q][i]; 00087 J++; 00088 } 00089 }*/ 00090 }; 00091 00097 int readModel(const mxArray *model, System &S); 00098 00104 int FIS2System(const mxArray *FIS, System &S); 00105 00111 int System2FIS(System &S, mxArray *FIS); 00112 00113 } // FLT 00114 #endif
1.7.4