|
EpetraExt
Development
|
00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // EpetraExt: Epetra Extended - Linear Algebra Services Package 00005 // Copyright (2011) Sandia Corporation 00006 // 00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00008 // the U.S. Government retains certain rights in this software. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 00042 #include "EpetraExt_MatlabEngine.h" 00043 #include "EpetraExt_PutMultiVector.h" 00044 #include "EpetraExt_PutRowMatrix.h" 00045 #include "EpetraExt_PutBlockMap.h" 00046 00047 #include "Epetra_Comm.h" 00048 #include "Epetra_MultiVector.h" 00049 #include "Epetra_SerialDenseMatrix.h" 00050 #include "Epetra_IntSerialDenseMatrix.h" 00051 #include "Epetra_IntVector.h" 00052 #include "Epetra_RowMatrix.h" 00053 #include "Epetra_DataAccess.h" 00054 #include "Epetra_Import.h" 00055 #include "Epetra_Export.h" 00056 #include "Epetra_CombineMode.h" 00057 #include "Epetra_CrsMatrix.h" 00058 #include "Epetra_Map.h" 00059 #include "Epetra_CrsMatrix.h" 00060 00061 using namespace EpetraExt; 00062 namespace EpetraExt { 00063 00064 //============================================================================= 00065 EpetraExt_MatlabEngine::EpetraExt_MatlabEngine (const Epetra_Comm& Comm):Comm_(Comm) { 00066 if (Comm_.MyPID() == 0) { 00067 // construct the MATLAB engine 00068 Engine_ = engOpen(NULL); 00069 } 00070 } 00071 00072 //============================================================================= 00073 EpetraExt_MatlabEngine::~EpetraExt_MatlabEngine (void) { 00074 if (Comm_.MyPID() == 0) { 00075 // to destruct the MATLAB engine 00076 engClose(Engine_); 00077 } 00078 } 00079 00080 //============================================================================= 00081 int EpetraExt_MatlabEngine::EvalString (char* command, char* outputBuffer, int outputBufferSize) { 00082 // send a string command to the MATLAB engine 00083 if (Comm_.MyPID() == 0) { 00084 if (outputBuffer != NULL) { 00085 if (engOutputBuffer(Engine_, outputBuffer, outputBufferSize)) { 00086 return(-4); 00087 } 00088 } 00089 if (engEvalString(Engine_, command)) { 00090 return(-3); 00091 } 00092 } 00093 00094 return(0); 00095 } 00096 00097 //============================================================================= 00098 int EpetraExt_MatlabEngine::PutMultiVector(const Epetra_MultiVector& A, const char * variableName) { 00099 mxArray* matlabA = 0; 00100 double* pr = 0; 00101 if (Comm_.MyPID() == 0) { 00102 matlabA = mxCreateDoubleMatrix(A.GlobalLength(), A.NumVectors(), mxREAL); 00103 pr = mxGetPr(matlabA); 00104 } 00105 00106 if (Matlab::CopyMultiVector(&pr, A)) { 00107 mxDestroyArray(matlabA); 00108 return(-2); 00109 } 00110 00111 if (Comm_.MyPID() == 0) 00112 if (PutIntoMatlab(variableName, matlabA)) { 00113 mxDestroyArray(matlabA); 00114 return(-1); 00115 } 00116 00117 mxDestroyArray(matlabA); 00118 return(0); 00119 } 00120 00121 //============================================================================= 00122 int EpetraExt_MatlabEngine::PutRowMatrix(const Epetra_RowMatrix& A, const char* variableName, bool transA) { 00123 mxArray* matlabA = 0; 00124 if (Comm_.MyPID() == 0) { 00125 // since matlab uses column major for matrices, switch row and column numbers 00126 matlabA = mxCreateSparse(A.OperatorDomainMap().MaxAllGID() - A.OperatorDomainMap().MinAllGID()+1, A.OperatorRangeMap().MaxAllGID() - A.OperatorRangeMap().MinAllGID() + 1, A.NumGlobalNonzeros(), mxREAL); 00127 } 00128 //cout << "numrows: " << A.RowMatrixColMap().NumGlobalElements() << " numCols: " << A.NumGlobalRows() << "numNonZeros: " << A.NumGlobalNonzeros() << "\n"; 00129 00130 //cout << "calling CopyRowMatrix\n"; 00131 if (Matlab::CopyRowMatrix(matlabA, A)) { 00132 mxDestroyArray(matlabA); 00133 return(-2); 00134 } 00135 00136 //cout << "done doing CopyRowMatrix\n"; 00137 if (Comm_.MyPID() == 0) { 00138 00139 /*cout << "printing matlabA pointers\n"; 00140 double* matlabAvaluesPtr = mxGetPr(matlabA); 00141 int* matlabAcolumnIndicesPtr = mxGetJc(matlabA); 00142 int* matlabArowIndicesPtr = mxGetIr(matlabA); 00143 for(int i=0; i < A.NumGlobalNonzeros(); i++) { 00144 cout << "*matlabAvaluesPtr: " << *matlabAvaluesPtr++ << " *matlabAcolumnIndicesPtr: " << *matlabAcolumnIndicesPtr++ << " *matlabArowIndicesPtr" << *matlabArowIndicesPtr++ << "\n"; 00145 } 00146 cout << "done printing matlabA pointers\n"; 00147 */ 00148 if (PutIntoMatlab(variableName, matlabA)) { 00149 mxDestroyArray(matlabA); 00150 return(-1); 00151 } 00152 00153 if (!transA) { 00154 char* buff = new char[128];; 00155 sprintf(buff, "%s = %s'", variableName, variableName); 00156 if (EvalString(buff)) { 00157 mxDestroyArray(matlabA); 00158 return(-3); 00159 } 00160 } 00161 } 00162 00163 //cout << "done with everything in PutRowMatrix, going to destroy matlabA\n" << "matlabA=" << matlabA << "\n"; 00164 mxDestroyArray(matlabA); 00165 //cout << "done destroying matlabA\n"; 00166 return(0); 00167 } 00168 00169 //============================================================================= 00170 int EpetraExt_MatlabEngine::PutCrsGraph(const Epetra_CrsGraph& A, const char* variableName, bool transA) { 00171 return(-9999); 00172 } 00173 00174 //============================================================================= 00175 int EpetraExt_MatlabEngine::PutSerialDenseMatrix(const Epetra_SerialDenseMatrix& A, const char* variableName, int proc) { 00176 if (proc == 0) { 00177 if (Comm_.MyPID() == 0) { 00178 mxArray* matlabA = 0; 00179 00180 int numRows = A.M(); 00181 int numCols = A.N(); 00182 00183 matlabA = mxCreateDoubleMatrix(numRows, numCols, mxREAL); 00184 00185 int row; 00186 int col; 00187 double* targetPtr = 0; 00188 double* sourcePtr = 0; 00189 double* source = (double*)A.A(); 00190 double* target = (double*)mxGetPr(matlabA); 00191 int source_LDA = A.LDA(); 00192 int target_LDA = A.LDA(); 00193 for (col = 0; col < numCols; col++) { 00194 targetPtr = target + (col * target_LDA); 00195 sourcePtr = source + (col * source_LDA); 00196 for (row = 0; row < numRows; row++) { 00197 *targetPtr++ = *sourcePtr++; 00198 } 00199 } 00200 00201 if (PutIntoMatlab(variableName, matlabA)) { 00202 mxDestroyArray(matlabA); 00203 return(-1); 00204 } 00205 00206 mxDestroyArray(matlabA); 00207 } 00208 00209 return(0); 00210 } 00211 else { 00212 Epetra_MultiVector* tempMultiVector = 0; 00213 if (proc == Comm_.MyPID()) { 00214 int* numVectors = new int[1]; 00215 int* temp = new int[1]; 00216 temp[0] = A.N(); 00217 Comm_.MaxAll (temp, numVectors, 1); 00218 const Epetra_BlockMap tempBlockMap (-1, A.LDA(), 1, 0, Comm_); 00219 tempMultiVector = new Epetra_MultiVector (View, tempBlockMap, A.A(), A.LDA(), A.N()); 00220 } 00221 else { 00222 int* numVectors = new int[1]; 00223 int* temp = new int[1]; 00224 temp[0] = 0; 00225 Comm_.MaxAll (temp, numVectors, 1); 00226 const Epetra_BlockMap tempBlockMap (-1, 0, 1, 0, Comm_); 00227 tempMultiVector = new Epetra_MultiVector (tempBlockMap, numVectors[0], false); 00228 } 00229 00230 return(PutMultiVector(*tempMultiVector, variableName)); 00231 } 00232 } 00233 00234 //============================================================================= 00235 int EpetraExt_MatlabEngine::PutIntSerialDenseMatrix(const Epetra_IntSerialDenseMatrix& A, const char* variableName, int proc) { 00236 mxArray* matlabA = 0; 00237 00238 if (proc == 0) { 00239 if (Comm_.MyPID() == 0) { 00240 int numRows = A.M(); 00241 int numCols = A.N(); 00242 00243 matlabA = mxCreateDoubleMatrix(numRows, numCols, mxREAL); 00244 00245 int row; 00246 int col; 00247 double* targetPtr = 0; 00248 int* sourcePtr = 0; 00249 int* source = (int*)A.A(); 00250 double* target = (double*)mxGetPr(matlabA); 00251 int source_LDA = A.LDA(); 00252 int target_LDA = A.LDA(); 00253 for (col = 0; col < numCols; col++) { 00254 targetPtr = target + (col * target_LDA); 00255 sourcePtr = source + (col * source_LDA); 00256 for (row = 0; row < numRows; row++) { 00257 *targetPtr++ = *sourcePtr++; 00258 } 00259 } 00260 00261 if (PutIntoMatlab(variableName, matlabA)) { 00262 mxDestroyArray(matlabA); 00263 return(-1); 00264 } 00265 } 00266 } 00267 else { 00268 int* numVectors = new int[2]; 00269 if (proc == Comm_.MyPID()) { 00270 int* temp = new int[2]; 00271 temp[0] = A.N(); 00272 temp[1] = A.M(); 00273 Comm_.MaxAll (temp, numVectors, 2); 00274 } 00275 else { 00276 int* temp = new int[2]; 00277 temp[0] = 0; 00278 temp[1] = 0; 00279 Comm_.MaxAll (temp, numVectors, 2); 00280 } 00281 00282 int numRows = numVectors[1]; 00283 int numCols = numVectors[0]; 00284 double* targetPtr = 0; 00285 int* sourcePtr = 0; 00286 int row; 00287 double* target = 0; 00288 const Epetra_BlockMap* tgBlockMap = 0; 00289 if (Comm_.MyPID() == 0) { 00290 matlabA = mxCreateDoubleMatrix(numRows, numCols, mxREAL); 00291 target = (double*)mxGetPr(matlabA); 00292 tgBlockMap = new Epetra_BlockMap(-1, numRows, 1, 0, Comm_); 00293 } 00294 else { 00295 tgBlockMap = new Epetra_BlockMap(-1, 0, 1, 0, Comm_); 00296 } 00297 00298 const Epetra_BlockMap* srcBlockMap = 0; 00299 Epetra_IntVector* srcIntVector = 0; 00300 Epetra_IntVector tgIntVector (*tgBlockMap, false); 00301 if (proc == Comm_.MyPID()) { 00302 srcBlockMap = new Epetra_BlockMap(-1, A.LDA(), 1, 0, Comm_); 00303 } 00304 else { 00305 srcBlockMap = new Epetra_BlockMap(-1, 0, 1, 0, Comm_); 00306 } 00307 00308 Epetra_Import importer (*tgBlockMap, *srcBlockMap); 00309 00310 for(int i=0; i < numVectors[0]; i++) { 00311 if (proc == Comm_.MyPID()) { 00312 srcIntVector = new Epetra_IntVector(View, *srcBlockMap, (int*)A[i]); 00313 } 00314 else { 00315 srcIntVector = new Epetra_IntVector(*srcBlockMap, false); 00316 } 00317 // need to add some error checking for this! 00318 tgIntVector.Import(*srcIntVector, importer, Insert); 00319 if (Comm_.MyPID() == 0) { 00320 targetPtr = target + (i * numRows); 00321 sourcePtr = (int*)tgIntVector.Values(); 00322 for (row = 0; row < numRows; row++) { 00323 *targetPtr++ = *sourcePtr++; 00324 } 00325 } 00326 } 00327 00328 if (PutIntoMatlab(variableName, matlabA)) { 00329 mxDestroyArray(matlabA); 00330 return(-1); 00331 } 00332 } 00333 00334 mxDestroyArray(matlabA); 00335 return(0); 00336 } 00337 00338 //============================================================================= 00339 int EpetraExt_MatlabEngine::PutBlockMap(const Epetra_BlockMap& blockMap, const char* variableName, bool transA) { 00340 mxArray* matlabA = 0; 00341 if (Comm_.MyPID() == 0) { 00342 int M = blockMap.NumGlobalElements(); 00343 int N = 1; 00344 00345 if (blockMap.MaxElementSize()>1) N = 2; // Non-trivial block map, store element sizes in second column 00346 00347 matlabA = mxCreateSparse(N, M, M*N, mxREAL); 00348 int* matlabAcolumnIndicesPtr = mxGetJc(matlabA); 00349 matlabAcolumnIndicesPtr += M; 00350 *matlabAcolumnIndicesPtr = M*N; // set max cap. 00351 } 00352 00353 if (Matlab::CopyBlockMap(matlabA, blockMap)) { 00354 mxDestroyArray(matlabA); 00355 return(-2); 00356 } 00357 00358 if (Comm_.MyPID() == 0) { 00359 if (PutIntoMatlab(variableName, matlabA)) { 00360 mxDestroyArray(matlabA); 00361 return(-1); 00362 } 00363 00364 if (!transA) { 00365 char* buff = new char[128];; 00366 sprintf(buff, "%s = %s'", variableName, variableName); 00367 if (EvalString(buff)) { 00368 mxDestroyArray(matlabA); 00369 return(-3); 00370 } 00371 } 00372 } 00373 00374 mxDestroyArray(matlabA); 00375 return(0); 00376 } 00377 00378 //============================================================================= 00379 int EpetraExt_MatlabEngine::PutIntoMatlab(const char* variableName, mxArray* matlabA) { 00380 if (Comm_.MyPID() != 0) { 00381 return(0); 00382 } 00383 #ifdef USE_ENGPUTARRAY 00384 // for matlab versions < 6.5 (release 13) 00385 mxSetName(matlabA, variableName); 00386 return(engPutArray(Engine_, matlabA)); 00387 #else 00388 // for matlab versions >= 6.5 (release 13) 00389 return(engPutVariable(Engine_, variableName, matlabA)); 00390 #endif 00391 } 00392 00393 //============================================================================= 00394 int EpetraExt_MatlabEngine::GetMultiVector(const char* variableName, Epetra_MultiVector& A) { 00395 mxArray* matlabA = 0; 00396 int ierr = 0; 00397 if (ierr = GetmxArray(variableName, &matlabA)) { 00398 mxDestroyArray(matlabA); 00399 return(ierr); 00400 } 00401 00402 bool isSparse = false; 00403 int numRows = 0; 00404 int numCols = 0; 00405 int numNonZeros = 0; 00406 00407 if (ierr = GetmxArrayDimensions(matlabA, isSparse, numRows, numCols, numNonZeros)) { 00408 mxDestroyArray(matlabA); 00409 return(ierr); 00410 } 00411 00412 if ((Comm_.MyPID() == 0) && isSparse) { 00413 mxDestroyArray(matlabA); 00414 return(-7); 00415 } 00416 00417 // tempMap is nontrivial only on PE0 00418 Epetra_Map tempMap (-1, numRows, 0, Comm_); 00419 00420 int numVectors = 0; 00421 Comm_.MaxAll (&numCols, &numVectors, 1); 00422 double* tempValues = 0; 00423 if (Comm_.MyPID() == 0) { 00424 tempValues = mxGetPr(matlabA); 00425 } 00426 Epetra_MultiVector tempMV (View, tempMap, tempValues, numRows, numVectors); 00427 Epetra_Export exporter (tempMap, A.Map()); 00428 A.Export(tempMV, exporter, Insert); 00429 00430 mxDestroyArray(matlabA); 00431 return(0); 00432 } 00433 00434 //============================================================================= 00435 int EpetraExt_MatlabEngine::GetSerialDenseMatrix(const char* variableName, Epetra_SerialDenseMatrix& A, int proc) { 00436 int ierr = 0; 00437 int numMyGIDs = 0; 00438 if (Comm_.MyPID() == proc) { 00439 numMyGIDs = A.M(); 00440 } 00441 Epetra_Map tempMap (-1, numMyGIDs, 0, Comm_); 00442 Epetra_MultiVector tempMV (View, tempMap, A.A(), numMyGIDs, A.N()); 00443 00444 if (ierr = GetMultiVector(variableName, tempMV)) { 00445 return(ierr); 00446 } 00447 00448 if (Comm_.MyPID() == proc) { 00449 double* aValues = A.A(); 00450 double* mvValues = tempMV.Values(); 00451 for(int i=0; i < A.M() * A.N(); i++) { 00452 *aValues++ = *mvValues++; 00453 } 00454 } 00455 00456 return(0); 00457 } 00458 00459 //============================================================================= 00460 int EpetraExt_MatlabEngine::GetIntSerialDenseMatrix(const char* variableName, Epetra_IntSerialDenseMatrix& A, int proc) { 00461 int ierr = 0; 00462 int numMyGIDs = 0; 00463 double* values = 0; 00464 if (Comm_.MyPID() == proc) { 00465 numMyGIDs = A.M(); 00466 int* aValues = A.A(); 00467 values = new double[A.M() * A.N()]; 00468 for (int i=0; i < A.M() * A.N(); i++) { 00469 *values++ = *aValues++; 00470 } 00471 } 00472 Epetra_Map tempMap (-1, numMyGIDs, 0, Comm_); 00473 Epetra_MultiVector tempMV (View, tempMap, values, numMyGIDs, A.N()); 00474 00475 if (ierr = GetMultiVector(variableName, tempMV)) { 00476 return(ierr); 00477 } 00478 00479 if (Comm_.MyPID() == proc) { 00480 int* aValues = A.A(); 00481 double* mvValues = tempMV.Values(); 00482 for(int i=0; i < A.M() * A.N(); i++) { 00483 *aValues++ = *mvValues++; 00484 } 00485 } 00486 00487 return(0); 00488 } 00489 00490 //============================================================================= 00491 int EpetraExt_MatlabEngine::GetCrsMatrix(const char* inVariableName, Epetra_CrsMatrix& A, bool getTrans) { 00492 const char* variableName; 00493 00494 if (!getTrans) { 00495 int inVariableNameLength = strlen(inVariableName); 00496 char* buff = new char[inVariableNameLength*2 + 11]; 00497 sprintf(buff, "TRANS_%s = %s'", inVariableName, inVariableName); 00498 if (EvalString(buff)) { 00499 return(-3); 00500 } 00501 char* tempStr = new char[inVariableNameLength + 7]; 00502 sprintf(tempStr, "TRANS_%s", inVariableName); 00503 variableName = tempStr; 00504 } 00505 else { 00506 variableName = inVariableName; 00507 } 00508 00509 mxArray* matlabA = 0; 00510 int ierr = 0; 00511 if (ierr = GetmxArray(variableName, &matlabA)) { 00512 mxDestroyArray(matlabA); 00513 return(ierr); 00514 } 00515 00516 if (!getTrans) { 00517 char* buff = new char[strlen(variableName) + 7]; 00518 sprintf(buff, "clear %s", variableName); 00519 if (EvalString(buff)) { 00520 return(-3); 00521 } 00522 } 00523 00524 bool isSparse = false; 00525 int numRows = 0; 00526 int numCols = 0; 00527 int numNonZeros = 0; 00528 00529 // note that numCols and numRows are transposed on purpose here 00530 // we will treat the column major mxArray as a row major mxArray 00531 if (ierr = GetmxArrayDimensions(matlabA, isSparse, numCols, numRows, numNonZeros)) { 00532 mxDestroyArray(matlabA); 00533 return(ierr); 00534 } 00535 00536 if ((Comm_.MyPID() == 0) && !isSparse) { 00537 mxDestroyArray(matlabA); 00538 return(-8); 00539 } 00540 00541 // tempMap is nontrivial only on PE0 00542 Epetra_Map tempMap (-1, numRows, 0, Comm_); 00543 00544 int numVectors = 0; 00545 Comm_.MaxAll (&numCols, &numVectors, 1); 00546 Epetra_CrsMatrix tempCRSM (View, tempMap, numVectors); 00547 if (Comm_.MyPID() == 0) { 00548 int* rowIndex = mxGetJc(matlabA); 00549 int* colIndex = mxGetIr(matlabA); 00550 double* values = mxGetPr(matlabA); 00551 int numCols = 0; 00552 for(int row = 0; row < numRows; row++) { 00553 numCols = *(rowIndex+1) - *rowIndex; 00554 if (numCols > 0) { 00555 int* indices = new int[numCols]; 00556 int* indicesPtr = indices; 00557 for(int col=0; col < numCols; col++) { 00558 *indicesPtr++ = *colIndex++; 00559 } 00560 tempCRSM.InsertGlobalValues(row, numCols, values, indices); 00561 } 00562 values += numCols; 00563 rowIndex++; 00564 } 00565 } 00566 00567 tempCRSM.FillComplete(); 00568 Epetra_Export exporter (tempMap, A.RowMatrixRowMap()); 00569 A.Export(tempCRSM, exporter, Insert); 00570 00571 mxDestroyArray(matlabA); 00572 return(0); 00573 } 00574 00575 //============================================================================= 00576 int EpetraExt_MatlabEngine::GetmxArrayDimensions(mxArray* matlabA, bool& isSparse, int& numRows, int& numCols, int& numNonZeros) { 00577 if (Comm_.MyPID() == 0) { 00578 if (mxGetNumberOfDimensions(matlabA) > 2) { 00579 return(-6); 00580 } 00581 00582 const int* dimensions = mxGetDimensions(matlabA); 00583 numRows = dimensions[0]; 00584 numCols = dimensions[1]; 00585 isSparse = mxIsSparse(matlabA); 00586 00587 if (isSparse) { 00588 numNonZeros = mxGetNzmax(matlabA); 00589 } 00590 else { 00591 numNonZeros = numRows * numCols; 00592 } 00593 } 00594 00595 return(0); 00596 } 00597 00598 //============================================================================= 00599 int EpetraExt_MatlabEngine::GetmxArray(const char* variableName, mxArray** matlabA) { 00600 if (Comm_.MyPID() == 0) { 00601 #ifdef USE_ENGPUTARRAY 00602 // for matlab versions < 6.5 (release 13) 00603 *matlabA = engGetArray(Engine_, variableName); 00604 #else 00605 // for matlab versions >= 6.5 (release 13) 00606 *matlabA = engGetVariable(Engine_, variableName); 00607 #endif 00608 if (matlabA == NULL) { 00609 return(-5); 00610 } 00611 } 00612 00613 return(0); 00614 } 00615 00616 } // namespace EpetraExt
1.7.6.1