1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2009 - DIGITEO - Antoine ELIAS 4 * 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises 6 * 7 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * This file was originally licensed under the terms of the CeCILL v2.1, 10 * and continues to be available under such terms. 11 * For more information, see the COPYING file which you should have received 12 * along with this program. 13 */ 14 15 #ifndef __STACK_POLY_API__ 16 #define __STACK_POLY_API__ 17 18 #if !defined(__INTERNAL_API_SCILAB__) 19 #error Do not include api_stack_poly.h. Include api_scilab.h instead. 20 #endif 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #include "dynlib_api_scilab.h" 27 28 /*****************************/ 29 /* poly matrix functions */ 30 /*****************************/ 31 32 /** 33 * Get polynomial variable data 34 * @param[in] _piAddress variable address 35 * @param[out] _pstVarName return variable name of polynomials 36 * @param[out] _piVarNameLen return length of _pstVarName 37 * @return if the operation succeeded ( 0 ) or not ( !0 ) 38 */ 39 40 SciErr getPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen); 41 42 /** 43 * Get polynomial variable data 44 * @param[in] _piAddress variable address 45 * @param[out] _piRows return number of rows 46 * @param[out] _piCols return number of columns 47 * @param[out] _piNbCoef return number of polynomial coefficients for each element 48 * @param[out] _pdblReal return real coefficients 49 * @return if the operation succeeded ( 0 ) or not ( !0 ) 50 */ 51 52 SciErr getMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal); 53 54 /** 55 * Get complex polynomial variable data 56 * @param[in] _piAddress variable address 57 * @param[out] _piRows return number of rows 58 * @param[out] _piCols return number of columns 59 * @param[out] _piNbCoef return number of polynomial coefficients for each element 60 * @param[out] _pdblReal return real coefficients 61 * @param[out] _pdblImg return imaginary coefficients 62 * @return if the operation succeeded ( 0 ) or not ( !0 ) 63 */ 64 65 SciErr getComplexMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); 66 67 /** 68 * Create a polynomial variable 69 * @param[in] _iVar variable number 70 * @param[in] _pstVarName polynomial variable name 71 * @param[in] _iRows number of rows 72 * @param[in] _iCols number of columns 73 * @param[in] _piNbCoef number of polynomial coefficients for each element 74 * @param[in] _pdblReal pointer to real coefficients 75 * @return if the operation succeeded ( 0 ) or not ( !0 ) 76 */ 77 78 SciErr createMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal); 79 80 /** 81 * Create complex polynomial variable data 82 * @param[in] _iVar variable number 83 * @param[in] _pstVarName polynomial variable name 84 * @param[in] _iRows number of rows 85 * @param[in] _iCols number of columns 86 * @param[in] _piNbCoef number of polynomial coefficients for each element 87 * @param[in] _pdblReal pointer to real coefficients 88 * @param[in] _pdblImg pointer to imaginary coefficients 89 * @return if the operation succeeded ( 0 ) or not ( !0 ) 90 */ 91 92 SciErr createComplexMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); 93 94 /** 95 * Create polynomial named variable 96 * @param[in] _pstName variable name 97 * @param[in] _pstVarName polynomial variable name 98 * @param[in] _iRows number of rows 99 * @param[in] _iCols number of columns 100 * @param[in] _piNbCoef number of polynomial coefficients for each element 101 * @param[in] _pdblReal pointer to real coefficients 102 * @return if the operation succeeded ( 0 ) or not ( !0 ) 103 */ 104 105 SciErr createNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal); 106 107 /** 108 * Create complex polynomial named variable 109 * @param[in] _pstName variable name 110 * @param[in] _pstVarName polynomial variable name 111 * @param[in] _iRows number of rows 112 * @param[in] _iCols number of columns 113 * @param[in] _piNbCoef number of polynomial coefficients for each element 114 * @param[in] _pdblReal pointer to real coefficients 115 * @param[in] _pdblImg pointer to imaginary coefficients 116 * @return if the operation succeeded ( 0 ) or not ( !0 ) 117 */ 118 119 SciErr createNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); 120 121 /** 122 * Get named polynomial variable 123 * @param[in] _pstName variable name 124 * @param[out] _piRows return number of rows 125 * @param[out] _piCols return number of columns 126 * @param[out] _piNbCoef return number of polynomial coefficients for each element 127 * @param[out] _pdblReal return real coefficients 128 * @return if the operation succeeded ( 0 ) or not ( !0 ) 129 */ 130 131 SciErr readNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal); 132 133 /** 134 * Get named complex polynomial variable 135 * @param[in] _pstName variable name 136 * @param[out] _piRows return number of rows 137 * @param[out] _piCols return number of columns 138 * @param[out] _piNbCoef return number of polynomial coefficients for each element 139 * @param[out] _pdblReal return real coefficients 140 * @param[out] _pdblImg return imaginary coefficients 141 * @return if the operation succeeded ( 0 ) or not ( !0 ) 142 */ 143 144 SciErr readNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); 145 146 /* shortcut functions */ 147 148 /** 149 * Check if the variable type is polynomial 150 * @param[in] _piAddress variable address 151 * @return 1 for true and 0 for false 152 */ 153 int isPolyType(void* _pvCtx, int* _piAddress); 154 155 /** 156 * Check if the named variable type is polynomial 157 * @param[in] _pstName variable name 158 * @return 1 for true and 0 for false 159 */ 160 int isNamedPolyType(void* _pvCtx, const char* _pstName); 161 162 /** 163 * Get single polynomial variable data 164 * @param[in] _piAddress variable address 165 * @param[out] _piNbCoef return number of polynomial coefficients 166 * @param[out] _pdblReal pointer to real coefficients 167 * @return if the operation succeeded ( 0 ) or not ( !0 ) 168 */ 169 int getAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal); 170 171 /** 172 * Get single complex polynomial variable data 173 * @param[in] _piAddress variable address 174 * @param[out] _piNbCoef return number of polynomial coefficients 175 * @param[out] _pdblReal pointer to real coefficients 176 * @param[out] _pdblImg pointer to imaginary coefficients 177 * @return if the operation succeeded ( 0 ) or not ( !0 ) 178 */ 179 int getAllocatedSingleComplexPoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal, double** _pdblImg); 180 181 /** 182 * Get single named polynomial variable data 183 * @param[in] _pstName variable name 184 * @param[out] _piNbCoef return number of polynomial coefficients 185 * @param[out] _pdblReal pointer to real coefficients 186 * @return if the operation succeeded ( 0 ) or not ( !0 ) 187 */ 188 int getAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal); 189 190 /** 191 * Get single named complex polynomial variable data 192 * @param[in] _pstName variable name 193 * @param[out] _piNbCoef return number of polynomial coefficients 194 * @param[out] _pdblReal pointer to real coefficients 195 * @param[out] _pdblImg pointer to imaginary coefficients 196 * @return if the operation succeeded ( 0 ) or not ( !0 ) 197 */ 198 int getAllocatedNamedSingleComplexPoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal, double** _pdblImg); 199 200 /** 201 * Get matrix of polynomial variable data 202 * @param[in] _piAddress variable address 203 * @param[out] _piRows return number of rows 204 * @param[out] _piCols return number of columns 205 * @param[out] _piNbCoef return number of polynomial coefficients 206 * @param[out] _pdblReal return pointer to real coefficients 207 * @return if the operation succeeded ( 0 ) or not ( !0 ) 208 */ 209 int getAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal); 210 211 /** 212 * Get matrix of complex polynomial variable data 213 * @param[in] _piAddress variable address 214 * @param[out] _piRows return number of rows 215 * @param[out] _piCols return number of columns 216 * @param[out] _piNbCoef return number of polynomial coefficients for each element 217 * @param[out] _pdblReal return pointer to real coefficients 218 * @param[out] _pdblImg return pointer to imaginary coefficients 219 * @return if the operation succeeded ( 0 ) or not ( !0 ) 220 */ 221 int getAllocatedMatrixOfComplexPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg); 222 223 /** 224 * Get named matrix of polynomials variable data 225 * @param[in] _pstName variable name 226 * @param[out] _piRows return number of rows 227 * @param[out] _piCols return number of columns 228 * @param[out] _piNbCoef return number of polynomial coefficients for each element 229 * @param[out] _pdblReal return pointer to real coefficients 230 * @return if the operation succeeded ( 0 ) or not ( !0 ) 231 */ 232 int getAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal); 233 234 /** 235 * Get named matrix of complex polynomials variable data 236 * @param[in] _pstName variable name 237 * @param[out] _piRows return number of rows 238 * @param[out] _piCols return number of columns 239 * @param[out] _piNbCoef return number of polynomial coefficients for each element 240 * @param[out] _pdblReal return pointer to real coefficients 241 * @param[out] _pdblImg return pointer to imaginary coefficients 242 * @return if the operation succeeded ( 0 ) or not ( !0 ) 243 */ 244 int getAllocatedNamedMatrixOfComplexPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg); 245 246 /** 247 * Free memory allocated for a single polynomial variable ( named or not ) 248 * @param[in] _pdblReal pointer to real coefficients 249 */ 250 void freeAllocatedSinglePoly(double* _pdblReal); 251 252 /** 253 * Free memory allocated for a single complex polynomial variable ( named or not ) 254 * @param[in] _pdblReal pointer to real coefficients 255 * @param[in] _pdblImg pointer to imaginary coefficients 256 */ 257 void freeAllocatedSingleComplexPoly(double* _pdblReal, double* _pdblImg); 258 259 /** 260 * Free memory allocated for a polynomial matrix ( named or not ) 261 * @param[in] _iRows number of rows 262 * @param[in] _iCols number of columns 263 * @param[in] _piNbCoef number of polynomial coefficients for each element 264 * @param[in] _pdblReal pointer to real coefficients 265 */ 266 void freeAllocatedMatrixOfPoly(int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal); 267 268 /** 269 * Free memory allocated for a complex polynomial matrix ( named or not ) 270 * @param[in] _iRows number of rows 271 * @param[in] _iCols number of columns 272 * @param[in] _piNbCoef number of polynomial coefficients for each element 273 * @param[in] _pdblReal pointer to real coefficients 274 * @param[in] _pdblImg pointer to imaginary coefficients 275 */ 276 void freeAllocatedMatrixOfComplexPoly(int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); 277 #ifdef __cplusplus 278 } 279 #endif 280 #endif /* __STACK_POLY_API__ */ 281