本文整理匯總了C++中AssignOutputVariable函數的典型用法代碼示例。如果您正苦於以下問題:C++ AssignOutputVariable函數的具體用法?C++ AssignOutputVariable怎麽用?C++ AssignOutputVariable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AssignOutputVariable函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: sci_fftw_forget_wisdom
/*--------------------------------------------------------------------------*/
int sci_fftw_forget_wisdom(char *fname, void* pvApiCtx)
{
CheckInputArgument(pvApiCtx, 0, 0);
FreeFFTWPlan(getSci_Backward_Plan());
FreeFFTWPlan(getSci_Forward_Plan());
call_fftw_forget_wisdom();
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
}
示例2: sci_sym_getRowActivity
int sci_sym_getRowActivity(char *fname){
//error management variable
SciErr sciErr;
int iRet;
//data declarations
int numConstr;
double *rowAct;
//ensure that environment is active
if(global_sym_env==NULL){
sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
return 1;
}
//code to check arguments and get them
CheckInputArgument(pvApiCtx,0,0) ;
CheckOutputArgument(pvApiCtx,1,1) ;
//code to process input
iRet=sym_get_num_rows(global_sym_env,&numConstr);
if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
return 1;
}
rowAct=new double[numConstr];
iRet=sym_get_row_activity(global_sym_env,rowAct);
if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
delete[] rowAct;
return 1;
}
//code to give output
sciErr=createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,numConstr,1,rowAct);
if (sciErr.iErr)
{
printError(&sciErr, 0);
delete[] rowAct;
return 1;
}
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
//ReturnArguments(pvApiCtx);
delete[] rowAct;
return 0;
}
示例3: returnIntegerMatrixToScilab
int returnIntegerMatrixToScilab(int itemPos, int rows, int cols, int *dest)
{
SciErr sciErr;
//same steps as above
sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + itemPos, rows, cols, dest);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 1;
}
AssignOutputVariable(pvApiCtx, itemPos) = nbInputArgument(pvApiCtx)+itemPos;
return 0;
}
示例4: sci_mpi_init
int sci_mpi_init(char *fname, void* pvApiCtx)
{
int flag;
CheckInputArgument(pvApiCtx, 0, 0);
CheckOutputArgument(pvApiCtx, 1, 1);
mpi_init_internal();
MPI_Initialized(&flag);
if (!flag)
{
/* MPI Not yet initialized */
MPI_Init(NULL, NULL);
MPI_Comm_create_errhandler(MPIErrHandler, &errhdl);
}
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
}
示例5: write_sparse
int write_sparse(char *fname, void* pvApiCtx)
{
SciErr sciErr;
int piNbItemRow[] = {1, 2, 1};
int piColPos[] = {8, 4, 7, 2};
double pdblSReal[] = {1, 2, 3, 4};
double pdblSImg[] = {4, 3, 2, 1};
int iNbItem = 4;
sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
示例6: common_read
int common_read(char *fname, void* pvApiCtx)
{
SciErr sciErr;
int iItem = 0;
int iRet = 0;
int *piAddr = NULL;
CheckInputArgument(pvApiCtx, 1, 1);
sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
get_info(pvApiCtx, 1, NULL, piAddr, 0);
AssignOutputVariable(pvApiCtx, 1) = 0;
return 0;
}
示例7: C2F
/*--------------------------------------------------------------------------*/
int C2F(sci_getscilabmode)(char *fname, unsigned long fname_len)
{
int n1 = 0, m1 = 0;
char *output = NULL ;
int iRet = 0;
SciErr sciErr;
CheckInputArgument(pvApiCtx, 0, 0) ;
CheckOutputArgument(pvApiCtx, 1, 1) ;
switch (getScilabMode())
{
case SCILAB_API:
default :
output = strdup("API");
break;
case SCILAB_STD:
output = strdup("STD");
break;
case SCILAB_NW:
output = strdup("NW");
break;
case SCILAB_NWNI:
output = strdup("NWNI");
break;
}
/* Create the string matrix as return of the function */
iRet = createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, output);
free(output); // Data have been copied into Scilab memory
if (iRet)
{
freeAllocatedSingleString(output);
return 1;
}
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
ReturnArguments(pvApiCtx);
return 0;
}
示例8: sci_drawlater
/*--------------------------------------------------------------------------*/
int sci_drawlater(char * fname, void* pvApiCtx)
{
int iFalse = (int)FALSE;
int iParentFigureUID = 0;
int* piParentFigureUID = &iParentFigureUID;
int iSubwinUID = 0;
int iCurChildUID = 0;
int iType = -1;
int *piType = &iType;
CheckInputArgument(pvApiCtx, 0, 0);
CheckOutputArgument(pvApiCtx, 0, 1);
if (nbInputArgument(pvApiCtx) <= 0)
{
iSubwinUID = getOrCreateDefaultSubwin();
if (iSubwinUID != 0)
{
// Look for top level figure
iCurChildUID = iSubwinUID;
do
{
iParentFigureUID = getParentObject(iCurChildUID);
getGraphicObjectProperty(iParentFigureUID, __GO_TYPE__, jni_int, (void **)&piType);
iCurChildUID = iParentFigureUID;
}
while (iParentFigureUID != 0 && iType != __GO_FIGURE__);
if (iParentFigureUID != 0)
{
setGraphicObjectProperty(iParentFigureUID, __GO_IMMEDIATE_DRAWING__, &iFalse, jni_bool, 1);
}
}
}
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
}
示例9: sci_mpi_finalize
int sci_mpi_finalize(char *fname, void* pvApiCtx)
{
int iRet = 0;
CheckInputArgument(pvApiCtx, 0, 0);
CheckOutputArgument(pvApiCtx, 1, 1);
mpi_finalize_internal();
iRet = MPI_Finalize();
if (iRet != MPI_SUCCESS)
{
char error_string[MPI_MAX_ERROR_STRING];
int length_of_error_string;
MPI_Error_string(iRet, error_string, &length_of_error_string);
Scierror(999, _("%s: Could not finalize the MPI instance: %s\n"), fname, error_string);
return 0;
}
// TODO: catch les erreurs
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
}
示例10: write_poly
int write_poly(char *fname, void* pvApiCtx)
{
SciErr sciErr;
//output variable info : polynomial matrix 2 x 4
//[ x + 2 x^2 - 4x + 5 4x^3 - 14x^2 + 18 ;
// 2x^3 - 12x^2 + 64 1 8x^5 + 32x^3]
int iRows = 2;
int iCols = 3;
//varname "x"
char pstVarName[2] = {"x"};
//coeficient array
int piNbCoef[6] = {2, 4, 3, 1, 4, 6};
//data array
double *pdblReal[6] = {0};
double pdblPoly0[2] = {2, 1};
double pdblPoly1[4] = {64, 0, -12, 2};
double pdblPoly2[3] = {5, -4, 1};
double pdblPoly3[1] = {1};
double pdblPoly4[4] = {18, 0, -14, 4};
double pdblPoly5[6] = {0, 0, 0, 32, 0, 8};
pdblReal[0] = pdblPoly0;
pdblReal[1] = pdblPoly1;
pdblReal[2] = pdblPoly2;
pdblReal[3] = pdblPoly3;
pdblReal[4] = pdblPoly4;
pdblReal[5] = pdblPoly5;
sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
//assign allocated variables to Lhs position
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
示例11: xlfont_no_rhs
/*--------------------------------------------------------------------------*/
static int xlfont_no_rhs(char * fname)
{
SciErr sciErr;
int m1 = 0, n1 = 0;
int nbElements = 0;
char **fontsname = getInstalledFontsName(&nbElements);
m1 = 1;
n1 = nbElements;
sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, m1, n1, (const char * const*)fontsname);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 1;
}
freeArrayOfString(fontsname, nbElements);
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
ReturnArguments(pvApiCtx);
return 0;
}
示例12: sci_fftwlibraryisloaded
/*--------------------------------------------------------------------------*/
int sci_fftwlibraryisloaded(char *fname, void* pvApiCtx)
{
int iErr;
if ( IsLoadedFFTW() )
{
iErr = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1); // true
}
else
{
iErr = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 0); // false
}
if (iErr)
{
Scierror(999, _("%s: Memory allocation error.\n"), fname);
return iErr;
}
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
ReturnArguments(pvApiCtx);
return 0;
}
示例13: write_boolean
int write_boolean(char *fname, unsigned long fname_len)
{
SciErr sciErr;
int i, j;
//first variable info : boolean matrix of boolean 3 x 4
int iRows1 = 3;
int iCols1 = 4;
int* pboolOutput1 = NULL;
//second variable info : boolean matrix of boolean 4 x 6
int iRows2 = 4;
int iCols2 = 6;
int* pboolOutput2 = NULL;
/************************
* First variable *
************************/
//alloc array of data in OS memory
pboolOutput1 = (int*)malloc(sizeof(int) * iRows1 * iCols1);
//fill array with incremental values
//[ %t %f %t %f
// %t %f %t %f
// %t %f %t %f ]
for (i = 0 ; i < iRows1 ; i++)
{
for (j = 0 ; j < iCols1 ; j++)
{
pboolOutput1[i + iRows1 * j] = (i * iCols1 + j) % 2 == FALSE;
}
}
//can be written in a single loop
//for(i = 0 ; i < iRows1 * iCols1; i++)
//{
// pboolOutput1[i] = i % 2 == FALSE;
//}
//create a variable from a existing data array
sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pboolOutput1);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
//after creation, we can free memory.
free(pboolOutput1);
/*************************
* Second variable *
*************************/
//reserve space in scilab memory and fill it
sciErr = allocMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pboolOutput2);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
//fill array with incremental values
//[ %f %t %f %t %f %t
// %f %t %f %t %f %t
// %f %t %f %t %f %t
// %f %t %f %t %f %t ]
for (i = 0 ; i < iRows2 ; i++)
{
for (j = 0 ; j < iCols2 ; j++)
{
pboolOutput2[i + iRows2 * j] = (i * iCols2 + j) % 2 == TRUE;
}
}
//can be written in a single loop
//for(i = 0 ; i < iRows2 * iCols2; i++)
//{
// pboolOutput2[i] = i % 2 == TRUE;
//}
// /!\ DO NOT FREE MEMORY, in this case, it's the Scilab memory
//assign allocated variables to Lhs position
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2;
return 0;
}
示例14: sci_getinstalledlookandfeels
/*--------------------------------------------------------------------------*/
int sci_getinstalledlookandfeels(char *fname, unsigned long fname_len)
{
SciErr sciErr;
CheckInputArgument(pvApiCtx, 0, 0);
CheckOutputArgument(pvApiCtx, 1, 1);
org_scilab_modules_gui_utils::LookAndFeelManager * lnf = 0;
try
{
lnf = new org_scilab_modules_gui_utils::LookAndFeelManager(getScilabJavaVM());
}
catch (const GiwsException::JniException & e)
{
Scierror(999, _("%s: A Java exception arisen:\n%s"), fname, e.whatStr().c_str());
return 1;
}
if (lnf)
{
char **lookandfeels = NULL;
int nbElems = 0;
int nbCol = 0;
lookandfeels = lnf->getInstalledLookAndFeels();
nbElems = lnf->numbersOfInstalledLookAndFeels();
nbCol = 1;
sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, nbElems, nbCol, lookandfeels);
if (sciErr.iErr)
{
printError(&sciErr, 0);
Scierror(999, _("%s: Memory allocation error.\n"), fname);
return 1;
}
if (lookandfeels)
{
int i = 0;
for (i = 0; i < nbElems; i++)
{
if (lookandfeels[i])
{
delete[]lookandfeels[i];
}
}
delete[]lookandfeels;
lookandfeels = NULL;
}
delete lnf;
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
returnArguments(pvApiCtx);
}
else
{
Scierror(999, _("%s: No more memory.\n"), fname);
}
return 0;
}
示例15: sci_hdf5_listvar_v2
//.........這裏部分代碼省略.........
}
iNbItem = getVariableNames(iFile, pstVarNameList);
for (int i = 0; i < iNbItem; i++)
{
int iDataSetId = getDataSetIdFromName(iFile, pstVarNameList[i]);
if (iDataSetId == 0)
{
break;
}
strncpy(pInfo[i].varName, pstVarNameList[i], sizeof(pInfo[i].varName) - 1);
pInfo[i].iSize = 0;
b = read_data(iDataSetId, 0, NULL, &pInfo[i]) == false;
if (b)
{
break;
}
if (Lhs == 1)
{
sciprint("%s\n", pInfo[i].pstInfo);
}
}
freeArrayOfString(pstVarNameList, iNbItem);
}
else
{
//no variable returms [] for each Lhs
for (int i = 0 ; i < Lhs ; i++)
{
createEmptyMatrix(pvApiCtx, nbIn + i + 1);
AssignOutputVariable(pvApiCtx, i + 1) = nbIn + i + 1;
}
ReturnArguments(pvApiCtx);
return 0;
}
closeHDF5File(iFile);
//1st Lhs
char** pstVarName = (char**)MALLOC(sizeof(char*) * iNbItem);
for (int i = 0 ; i < iNbItem ; i++)
{
pstVarName[i] = pInfo[i].varName;
}
sciErr = createMatrixOfString(pvApiCtx, nbIn + 1, iNbItem, 1, pstVarName);
FREE(pstVarName);
if (sciErr.iErr)
{
FREE(pInfo);
printError(&sciErr, 0);
return 1;
}
AssignOutputVariable(pvApiCtx, 1) = nbIn + 1;
if (Lhs > 1)
{
//2nd Lhs
double* pdblType;
sciErr = allocMatrixOfDouble(pvApiCtx, nbIn + 2, iNbItem, 1, &pdblType);
if (sciErr.iErr)