您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ stk函数代码示例

51自学网 2021-06-03 08:23:50
  C++
这篇教程C++ stk函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中stk函数的典型用法代码示例。如果您正苦于以下问题:C++ stk函数的具体用法?C++ stk怎么用?C++ stk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了stk函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: empty

int empty(void){    int m, n;    int k;    int m1, n1, p1;    int m2, n2, p2;    int NZMAX = 1;    int jc = 5;    int ir;    int *header;    double *value;    GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &p1);    GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &p2);    m = (int) * stk(p1);    n = (int) * stk(p2);    CreateData(3, (6 + n + 1)*sizeof(int) + sizeof(double));    header = (int *) GetData(3);    value = (double *) header;    header[0] = 7;    header[1] = m;    header[2] = n;    header[3] = 0;    header[4] = NZMAX;    header[jc] = 0;    ir = jc + n + 1;    for (k = 0; k < n; ++k)    {        header[jc + k + 1] = 0;    }    header[ir] = 0;    value[(5 + header[2] + header[4]) / 2 + 1] = 0.0;    LhsVar(1) = 3;    PutLhsVar();    return 1;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:35,


示例2: interface_gravite

int interface_gravite(char *fname){  static int un = 1, nddl = N_DOF;  static int n, nbis;  static int q, G;  /*    Define minls=1, maxlhs, minrhs, maxrhs   */  static int minlhs = 1, minrhs = 1, maxlhs = 1, maxrhs = 1;  /*   Check rhs and lhs   */  CheckRhs(minrhs, maxrhs) ;  CheckLhs(minlhs, maxlhs) ;  GetRhsVar(1, "d", &n, &nbis, &q);  if (n * nbis != N_DOF)  {    sciprint("Wrong size!/r/n");    Error(999);    return 0;  }  CreateVar(2, "d", &nddl, &un, &G);  modele_gravite(stk(q), stk(G));  LhsVar(1) = 2;  return 0;}
开发者ID:radarsat1,项目名称:siconos,代码行数:28,


示例3: TagsInterface

int TagsInterface(char *fname){  static int one = 1, ndof = NDOF;  static int n, nbis;  static int q, N;  /*    Define minls=1, maxlhs, minrhs, maxrhs   */  static int minlhs = 1, minrhs = 2, maxlhs = 1, maxrhs = 2;  /*   Check rhs and lhs   */  CheckRhs(minrhs, maxrhs) ;  CheckLhs(minlhs, maxlhs) ;  GetRhsVar(1, "d", &n, &nbis, &q);  if (n * nbis != NDOF)  {    sciprint("Wrong size!/r/n");    Error(999);    return 0;  }  CreateVar(2, "d", &ndof, &one, &N);  Tags(stk(N), stk(q));  LhsVar(1) = 2;  return 0;}
开发者ID:radarsat1,项目名称:siconos,代码行数:30,


示例4: sci_multiply_by_two

int sci_multiply_by_two(char * fname){    int m_in_var, n_in_var, l_in_var;    int m_out_var, n_out_var, l_out_var;    int i_row, j_col;    // First, access to the input variable (a matrix of doubles)    GetRhsVar(1, "d", &m_in_var, &n_in_var, &l_in_var);    // Create the returned variable (a matrix of doubles)    m_out_var = m_in_var;    n_out_var = n_in_var;    CreateVar(2, "d", &m_out_var, &n_out_var, &l_out_var);    // Perform some simple operations on the matrix    for (i_row = 0; i_row < m_in_var; i_row++)    {        for (j_col = 0; j_col < n_in_var; j_col++)        {            *stk(l_out_var + i_row + j_col * m_out_var) = 2 * (*stk(l_in_var + i_row + j_col * m_in_var));        }    }    // Return the output variable    LhsVar(1) = 2;    return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:28,


示例5: InertiaInterface

int InertiaInterface(char *fname){    static int ndof = NDOF;    static int n, nbis;    static int q, M;    /*    Define minls=1, maxlhs, minrhs, maxrhs   */    static int minlhs = 1, minrhs = 1, maxlhs = 1, maxrhs = 1;    /*   Check rhs and lhs   */    CheckRhs(minrhs, maxrhs) ;    CheckLhs(minlhs, maxlhs) ;    GetRhsVar(1, "d", &n, &nbis, &q);    if (n * nbis != NDOF)    {        sciprint("Wrong size!/r/n");        Error(999);        return 0;    }    CreateVar(2, "d", &ndof, &ndof, &M);    Inertia(stk(M), stk(q));    LhsVar(1) = 2;    return 0;}
开发者ID:radarsat1,项目名称:siconos,代码行数:28,


示例6: IsEqualOverloaded

/**IsEqualOverloaded* Used to call the overloading function when testing unknown data type  for equality* @param double *d1: pointer on the beginning of the first variable structure* @param int n1: memory size used by the first variable, only used for overloading* @param double *d2: pointer on the beginning of the first variable structure* @param int n2: memory size used by the second variable, only used for overloading* @return 0 is the variables differ and 1 if they are identical, -1 for recursion purpose* @author Serge Steer* @see IsEqualVar*/int IsEqualOverloaded(double *d1, int n1, double *d2, int n2){    int *id1 = (int *) d1;    int *id2 = (int *) d2;    int il, lw;    int l1, l2;    initStackParameters();    if (Rstk[Pt] == 914 || Rstk[Pt] == 915) /* coming back after evaluation of overloading function */    {        /* Get the computed value */        il = iadr(*Lstk(Top));        Top--;        Pt--;        return  *istk(il + 3);    }    /* Prepare stack for calling overloading function */    /* put references to d1 and d2 variable at the top of the stack */    l1 = *Lstk(1) + (int)(d1 - stk(*Lstk(1))); /*compute index in stk from absolute adress value */    l2 = *Lstk(1) + (int)(d2 - stk(*Lstk(1))); /*compute index in stk from absolute adress value */    Top = Top + 1;    il = iadr(*Lstk(Top));    *istk(il) = -id1[0];    *istk(il + 1) = l1; /* index othe first element of the variable in stk */    *istk(il + 2) = 0; /* variable number unknown */    *istk(il + 3) = n1; /* variable memory size  */    *Lstk(Top + 1) = *Lstk(Top) + 2;    Top = Top + 1;    il = iadr(*Lstk(Top));    *istk(il) = -id2[0];    *istk(il + 1) = l2; /* index othe first element of the variable in stk */    *istk(il + 2) = 0; /*variable number unknown */    *istk(il + 3) = n2; /*variable memory size */    *Lstk(Top + 1) = *Lstk(Top) + 2;    Ptover(1);    Rhs = 2;    lw = Top - 1;    if ( GetDoubleCompMode() == 0)    {        C2F(overload)(&lw, "isequalbitwise", 14L);        Rstk[Pt] = 914;    }    else    {        C2F(overload)(&lw, "isequal", 7L);        Rstk[Pt] = 915;    }    /*DEBUG_OVERLOADING("IsEqualVar Overloaded calls the parser Top=%d, Rhs=%d, Pt=%d/n",Top,Rhs,Pt);*/    return -1;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:69,


示例7: main

int main(int, char**){//  Test the explicit deduction guides    {    std::vector<int> v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };    std::stack stk(v);    static_assert(std::is_same_v<decltype(stk), std::stack<int, std::vector<int>>>, "");    assert(stk.size() == v.size());    assert(stk.top() == v.back());    }    {    std::list<long, test_allocator<long>> l{10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };    std::stack stk(l, test_allocator<long>(0,2)); // different allocator    static_assert(std::is_same_v<decltype(stk)::container_type, std::list<long, test_allocator<long>>>, "");    static_assert(std::is_same_v<decltype(stk)::value_type, long>, "");    assert(stk.size() == 10);    assert(stk.top() == 19);//  I'd like to assert that we've gotten the right allocator in the stack, but//  I don't know how to get at the underlying container.    }//  Test the implicit deduction guides    {//  We don't expect this one to work - no way to implicitly get value_type//  std::stack stk(std::allocator<int>()); // stack (allocator &)    }    {    std::stack<A> source;    std::stack stk(source); // stack(stack &)    static_assert(std::is_same_v<decltype(stk)::value_type, A>, "");    static_assert(std::is_same_v<decltype(stk)::container_type, std::deque<A>>, "");    assert(stk.size() == 0);    }    {//  This one is odd - you can pass an allocator in to use, but the allocator//  has to match the type of the one used by the underlying container    typedef short T;    typedef test_allocator<T> A;    typedef std::deque<T, A> C;    C c{0,1,2,3};    std::stack<T, C> source(c);    std::stack stk(source, A(2)); // stack(stack &, allocator)    static_assert(std::is_same_v<decltype(stk)::value_type, T>, "");    static_assert(std::is_same_v<decltype(stk)::container_type, C>, "");    assert(stk.size() == 4);    assert(stk.top() == 3);    }  return 0;}
开发者ID:ingowald,项目名称:llvm-project,代码行数:58,


示例8: sci_get_if

int sci_get_if(char *fname){    static int l1, m1, n1;    void *p_sci;    static int l2, m2, n2;    static int lr3, lc3;    static int minrhs=2, maxrhs=2;    static int minlhs=0, maxlhs=1;    static int err;    struct sci_var s_v;    debug_3 ("[if_sci_get] ..................... /r/n");    CheckRhs(minrhs,maxrhs);    CheckLhs(minlhs,maxlhs);    // example: pfir1    m1=1;    n1=1;    GetRhsVar(1,"p",&m1,&n1,&l1);    // example: SCI_TAPS    GetRhsVar(2, "i", &m2, &n2, &l2);    p_sci = (void *) ((unsigned long int) *stk(l1));    s_v = sci_get_ifcpp(p_sci, *istk(l2));    if (sci_err) {        sciprint("/n%s:/n info:%d/n",sci_err_msg,sci_info);        Scierror(999,"%s failed err=%d", fname, sci_err);        return 0;    }    // now when m3,n3 are set - create [mxn] sci variable on stack (it=is_complex)    if (s_v.is_double)    {   CreateCVar(3,"d", &s_v.is_complex, &s_v.m, &s_v.n, &lr3, &lc3);        // alocated mem on scilab stack for [mxn] of (complex) double        s_v.p_re=stk(lr3);        s_v.p_im=stk(lc3);    }    else if (s_v.is_boolean)    {   CreateVar(3,"b", &s_v.m, &s_v.n, &lr3);        // alocated mem on scilab stack for [mxn] boolean        s_v.p_re=istk(lr3);        s_v.p_im=NULL;    }    else    {   lr3 = I_INT32;;        CreateVar(3,"I", &s_v.m, &s_v.n, &lr3);        // alocated mem on scilab stack for [mxn] of U_INT32        s_v.p_re=istk(lr3);        s_v.p_im=NULL;    }    // copy values    sci_pop_var(&s_v);    // remove data from heap    sci_delete_var(&s_v);    LhsVar(1) = 3; /* return var */    debug_3 ("[if_sci_get] +++++++++++++++++++++ /r/n");    return 0;}
开发者ID:maki63,项目名称:c_sci,代码行数:58,


示例9: intfun1

int intfun1(char *fname){    int m1, n1, l1;    CheckRhs(1, 1);    CheckLhs(1, 1);    GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);    fun1(stk(l1), stk(l1));    LhsVar(1) = 1;    return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:10,


示例10: sci_emptystr_two_rhs

/*--------------------------------------------------------------------------*/static int sci_emptystr_two_rhs(char *fname){    /*value_param_pos_1 is the number of row ; value_param_pos_2 is the number of col*/    int Type_One = GetType(1);    int Type_Two = GetType(2);    if ((Type_One == sci_matrix) && (Type_Two == sci_matrix))    {        double value_param_pos_1 = 0;        double value_param_pos_2 = 0;        int matrixdimension = 0;        int m1 = 0, n1 = 0, l1 = 0;        int m2 = 0, n2 = 0, l2 = 0;        GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);        GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &l2);        value_param_pos_1 = *stk(l1);        value_param_pos_2 = *stk(l2);        matrixdimension = (int)(value_param_pos_1 * value_param_pos_2);        if (matrixdimension > 0)        {            int m = (int)value_param_pos_1;            int n = (int)value_param_pos_2;            CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &m, &n, NULL);        }        else        {            /* returns [] */            int l = 0;            int m = 0;            int n = 0;            CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &m, &n, &l);        }        LhsVar(1) = Rhs + 1;        PutLhsVar();    }    else    {        if (Type_One != sci_matrix)        {            Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of integers expected./n"), fname, 1);        }        else /* Type_Two */        {            Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of integers expected./n"), fname, 2);        }    }    return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:55,


示例11: sci_create_list

int sci_create_list(char * fname){    int m_list_out, n_list_out;    int m_var1,     n_var1,     l_var1,  l_list_var1;    int m_var2,     n_var2,     l_var2,  l_list_var2;    int m_mlist,    n_mlist,    l_mlist;    // The labels of our mlist    static const char * ListLabels [] = {"mylist", "var1", "var2"};    // First, we create the variables using a classical way    // The size of the Scilab variables    m_var1  = 1;    n_var1  = strlen("a string") + 1; // a null terminated string    m_var2  = 2;    n_var2  = 2; // A 2x2 double matrix    m_mlist = 3;    n_mlist = 1; // A mlist with 3 elements    // Creation of the Scilab variables    // A('var1')    CreateVar(1, "c", &m_var1,  &n_var1,  &l_var1);    // A('var2')    CreateVar(2, "d", &m_var2,  &n_var2,  &l_var2);    // A    CreateVar(3, "m", &m_mlist, &n_mlist, &l_mlist);    // We store values in the create variables    // The matrix will be stored in A('var2')    *stk(l_var2 + 0) = 1;    *stk(l_var2 + 1) = 2;    *stk(l_var2 + 2) = 3;    *stk(l_var2 + 3) = 4;    // The string will be stored in A('var1')    strncpy(cstk(l_var1), "a string/0", n_var1);    m_list_out = 3;    n_list_out = 1;    // now, affect the variable  to the mlist    // The labels (it corresponds to A = mlist(['mylist','var1','var2'], ...    CreateListVarFromPtr(3, 1, "S", &m_list_out, &n_list_out, ListLabels);    // The value stored in A('var1') (it corresponds to A = ...,'a string', ...    CreateListVarFrom(3, 2, "c", &m_var1, &n_var1, &l_list_var1, &l_var1);    // The value stored in A('var2') (it corresponds to A = ...,[1 2,3 4]);    CreateListVarFrom(3, 3, "d", &m_var2, &n_var2, &l_list_var2, &l_var2);    // We return only the mlist which has been created at position 3    LhsVar(1) = 3;    return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:53,


示例12: get_rect_arg

/*--------------------------------------------------------------------------*/int get_rect_arg(char *fname,int pos,rhs_opts opts[], double ** rect ){	int m,n,l,first_opt=FirstOpt(),kopt,i;	if (pos < first_opt)		{			if (VarType(pos)) {				GetRhsVar(pos,MATRIX_OF_DOUBLE_DATATYPE, &m, &n, &l);				if (m * n != 4) {					Scierror(999,"%s: Wrong size for input argument #%d: %d expected/n",fname,pos,4);					return 0;				}				*rect = stk(l);				for(i=0;i<4;i++)					if(finite((*rect)[i]) == 0){						Scierror(999,"%s: Wrong values (Nan or Inf) for input argument: %d finite values expected/n",fname,4);						return 0;					}			}			else				{					/** global value can be modified  **/					double zeros[4] = { 0.0, 0.0, 0.0, 0.0 } ;					setDefRect( zeros ) ;					*rect = getDefRect() ;				}		}	else if ((kopt=FindOpt("rect",opts))) {/* named argument: rect=value */		GetRhsVar(kopt,MATRIX_OF_DOUBLE_DATATYPE, &m, &n, &l);		if (m * n != 4) {			Scierror(999,"%s: Wrong size for input argument #%d: %d expected/n",fname,kopt,4);			return 0;		}		*rect = stk(l);		for(i=0;i<4;i++)			if(finite((*rect)[i]) == 0){				Scierror(999,"%s: Wrong values (Nan or Inf) for input argument: %d finite values expected/n",fname,4);				return 0;			}	}	else		{			/** global value can be modified  **/			double zeros[4] = { 0.0, 0.0, 0.0, 0.0 } ;			setDefRect( zeros ) ;			*rect = getDefRect() ;		}	return 1;}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:53,


示例13: ext8c

int ext8c(double *y){    static int m, n, lp, i;    GetMatrixptr("param", &m, &n, &lp);    /* param can be changed */    *stk(lp) = 18.0;    /* param can be read */    for (i = 0; i < m * n ; i++ )    {        y[i] = (*stk(lp + i));    }    return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:13,


示例14: cre_hmat

static int cre_hmat(int pos, HyperMat *H){    /*  dans cette version, seuls les champs dimsize, size et it sont definis     *  et on alloue alors la memoire des champs dims, R (et I si it=1) dans     *  la pile scilab (juste 
C++ stm32_configgpio函数代码示例
C++ stime函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。