Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

MatlabInterface.h

Go to the documentation of this file.
00001 // PLearn (A C++ Machine Learning Library) 00002 // Copyright (C) 1998 Pascal Vincent 00003 // Copyright (C) 1999-2002 Pascal Vincent, Yoshua Bengio and University of Montreal 00004 // 00005 00006 // Redistribution and use in source and binary forms, with or without 00007 // modification, are permitted provided that the following conditions are met: 00008 // 00009 // 1. Redistributions of source code must retain the above copyright 00010 // notice, this list of conditions and the following disclaimer. 00011 // 00012 // 2. Redistributions in binary form must reproduce the above copyright 00013 // notice, this list of conditions and the following disclaimer in the 00014 // documentation and/or other materials provided with the distribution. 00015 // 00016 // 3. The name of the authors may not be used to endorse or promote 00017 // products derived from this software without specific prior written 00018 // permission. 00019 // 00020 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 00021 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00022 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00023 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00025 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00027 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 // 00031 // This file is part of the PLearn library. For more information on the PLearn 00032 // library, go to the PLearn Web site at www.plearn.org 00033 00034 00035 00036 00037 /* ******************************************************* 00038 * $Id: MatlabInterface.h,v 1.5 2004/07/21 16:30:51 chrish42 Exp $ 00039 * AUTHORS: Christian Jauvin 00040 * This file is part of the PLearn library. 00041 ******************************************************* */ 00042 00043 00046 #ifndef MATLAB_INTERFACE_INC 00047 #define MATLAB_INTERFACE_INC 00048 00049 //#include <stdlib.h> 00050 //#include "stringutils.h" 00051 #include <plearn/sys/Popen.h> 00052 #include <plearn/math/RowMapSparseMatrix.h> 00053 00054 namespace PLearn { 00055 using namespace std; 00056 00135 class MatlabInterface 00136 { 00137 00138 public: 00139 00142 static string path() 00143 { 00144 char* plearndir = getenv("PLEARNDIR"); 00145 if(!plearndir) 00146 PLERROR("PLEARNDIR environment variable not defined"); 00147 return string(plearndir)+"/Contrib/matlab/"; 00148 } 00149 00179 MatlabInterface(string matlab_file_header, string matlab_file = "", string id = "", 00180 bool launch_in_background = false, bool erase_tmp_files = true); 00181 00182 MatlabInterface(vector<string> matlab_file_header, string 00183 matlab_file = "", string id = "", 00184 bool launch_in_background = false, bool erase_tmp_files = true); 00185 00202 Popen* launch(); 00203 00210 bool launchAndWaitFor(string matlab_end_answer); 00211 00213 Popen* matlab; 00214 00216 string matlab_file; 00217 00220 string matlab_file_header; 00221 00222 //eigs_r11 routine (see below). 00223 static void eigs_r11(RowMapSparseMatrix<real>& A, 00224 Mat& evectors, 00225 int d, 00226 string which_eigenvalues, 00227 bool erase_tmp_files = true); 00228 00229 static void eigs_r11(RowMapSparseMatrix<real>& A, 00230 Vec& evalues, 00231 int d, 00232 string which_eigenvalues, 00233 bool erase_tmp_files = true); 00234 00235 static void eigs_r11(RowMapSparseMatrix<real>& A, 00236 Mat& evectors, 00237 Vec& evalues, 00238 int d, 00239 string which_eigenvalues, 00240 bool erase_tmp_files = true); 00241 00242 protected: 00243 00245 string id; 00246 00248 bool launch_in_background; 00249 00250 bool erase_tmp_files; 00251 00252 }; 00253 00273 void matlabR11eigs(RowMapSparseMatrix<double>& A, Mat eigen_vectors, 00274 Vec eigen_values, string which_eigenvalues="LM"); 00275 00276 00277 } // end of namespace PLearn 00278 00279 #endif

Generated on Tue Aug 17 15:58:09 2004 for PLearn by doxygen 1.3.7