Scilab-Branch-6.1-GIT
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.
getHypermatOfInt
整数変数のハイパー行列を取得.
呼び出し手順
SciErr getHypermatOfInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char* _pcData)
SciErr getHypermatOfUnsignedInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char* _pucData)
SciErr getHypermatOfInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short* _psData)
SciErr getHypermatOfUnsignedInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short* _pusData)
SciErr getHypermatOfInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piData)
SciErr getHypermatOfUnsignedInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int* _puiData)
引数
- _pvCtx
Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.
- _piAddress
Scilab変数のアドレス.
- _dims
ハイパー行列の次元.
- _ndims
次元の数.
- _p*Data
データ.
戻り値
SciErr構造体, フィールド iErr は エラー番号を保持します (エラーがない場合は 0).
ゲートウェイのソース
#include "api_scilab.h" #include "localization.h" int hypermatIntExample(char *fname,void* pvApiCtx) { SciErr sciErr; int* piAddr = NULL; int iType = 0; int iRet = 0; CheckInputArgument(pvApiCtx, 1, 1); CheckOutputArgument(pvApiCtx, 0, 1); sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } if (isEmptyMatrix(pvApiCtx, piAddr)) { iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); if (iRet) { return iRet; } AssignOutputVariable(pvApiCtx, 1) = 0; } else if (isHypermatType(pvApiCtx, piAddr)) { int * dims = NULL; int ndims; void * data = NULL; int htype = 0; int precision; sciErr = getHypermatType(pvApiCtx, piAddr, &htype); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } if (htype == sci_ints) { sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } switch (precision) { case SCI_INT8: sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data); if(sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; case SCI_UINT8: sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data); if(sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; case SCI_INT16: sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data); if(sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; case SCI_UINT16: sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data); if(sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; case SCI_INT32: sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data); if(sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; case SCI_UINT32: sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data); if(sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; } case SCI_INT64: sciErr = getHypermatOfInteger64(pvApiCtx, piAddr, &dims, &ndims, (long long*)&data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfInteger64(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const long long*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; case SCI_UINT64: sciErr = getHypermatOfUnsignedInteger64(pvApiCtx, piAddr, &dims, &ndims, (unsigned long long*)&data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } sciErr = createHypermatOfUnsignedInteger64(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned long long*)data); if (sciErr.iErr) { printError(&sciErr, 0); return sciErr.iErr; } break; } } else { Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1); return 1; } AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; } return 0; }
Scilab テストスクリプト
a = matrix(int8(1:6), [1 2 3]); b = matrix(uint8(1:6), [1 2 3]); c = matrix(int16(1:6), [1 2 3]); d = matrix(uint16(1:6), [1 2 3]); e = matrix(int32(1:6), [1 2 3]); f = matrix(uint32(1:6), [1 2 3]); hypermatExampleInt(a) == a hypermatExampleInt(b) == b hypermatExampleInt(c) == c hypermatExampleInt(d) == d hypermatExampleInt(e) == e hypermatExampleInt(f) == f
Report an issue | ||
<< getHypermatOfDouble | hypermat | integer >> |