• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GET_INDEX函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: matrix_set_many_on_column

void matrix_set_many_on_column(matrix_type * matrix , int row_offset , int elements , const double * data , int column) {
  if ((row_offset + elements) <= matrix->rows) {
    if (matrix->row_stride == 1)  /* Memory is continous ... */
      memcpy( &matrix->data[ GET_INDEX( matrix , row_offset , column) ] , data , elements * sizeof * data);
    else {
      int i;
      for (i = 0; i < elements; i++)
        matrix->data[ row_offset + GET_INDEX( matrix , i , column) ] = data[i];
    }
  } else
    util_abort("%s: range violation \n" , __func__);
}
开发者ID:danielfmva,项目名称:ert,代码行数:12,代码来源:matrix.c


示例2: matrix_det2

double matrix_det2( const matrix_type * A) {
  if ((A->rows == 2) && (A->columns == 2)) {
    double a00 = A->data[GET_INDEX(A,0,0)];
    double a01 = A->data[GET_INDEX(A,0,1)];
    double a10 = A->data[GET_INDEX(A,1,0)];
    double a11 = A->data[GET_INDEX(A,1,1)];

    return a00 * a11 - a10 * a01;
  } else {
    util_abort("%s: hardcoded for 2x2 matrices A is: %d x %d \n",__func__, A->rows , A->columns);
    return 0;
  }
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:13,代码来源:matrix.c


示例3: matrix_row_column_dot_product

double matrix_row_column_dot_product(const matrix_type * m1 , int row1 , const matrix_type * m2 , int col2) {
  if (m1->columns != m2->rows)
    util_abort("%s: size mismatch: m1:[%d,%d]   m2:[%d,%d] \n",__func__ , matrix_get_rows( m1 ) , matrix_get_columns( m1 ) , matrix_get_rows( m2 ) , matrix_get_columns( m2 ));

  {
    int k;
    double sum = 0;
    for( k = 0; k < m1->columns; k++)
      sum += m1->data[ GET_INDEX(m1 , row1 , k) ] * m2->data[ GET_INDEX(m2, k , col2) ];

    return sum;
  }
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:13,代码来源:matrix.c


示例4: matrix_columns_equal

bool matrix_columns_equal( const matrix_type * m1 , int col1 , const matrix_type * m2 , int col2) {
  if (m1->rows != m2->rows)
    return false;

  {
    int row;
    for (row=0; row < m1->rows; row++) {
      if (memcmp( &m1->data[ GET_INDEX(m1 , row , col1)]  , &m2->data[ GET_INDEX(m2 , row , col2)] , sizeof * m1->data) != 0)
        return false;
    }
  }

  return true;
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:14,代码来源:matrix.c


示例5: matrix_transpose

void matrix_transpose(const matrix_type * A , matrix_type * T) {
  if ((A->columns == T->rows) && (A->rows == T->columns)) {
    int i,j;
    for (i=0; i < A->rows; i++) {
      for (j=0; j < A->columns; j++) {
        size_t src_index    = GET_INDEX(A , i , j );
        size_t target_index = GET_INDEX(T , j , i );

        T->data[ target_index ] = A->data[ src_index ];
      }
    }
  } else
    util_abort("%s: size mismatch\n",__func__);
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:14,代码来源:matrix.c


示例6: reset_pnodes

int reset_pnodes(int curr, int pnode)
{
	struct msm_bus_inode_info *info;
	struct msm_bus_fabric_device *fabdev;
	int index, next_pnode;
	fabdev = msm_bus_get_fabric_device(GET_FABID(curr));
	index = GET_INDEX(pnode);
	info = fabdev->algo->find_node(fabdev, curr);
	if (!info) {
		MSM_BUS_ERR("Cannot find node info!\n");
		return -ENXIO;
	}

	MSM_BUS_DBG("Starting the loop--remove\n");
	do {
		struct msm_bus_inode_info *hop;
		fabdev = msm_bus_get_fabric_device(GET_FABID(curr));
		if (!fabdev) {
			MSM_BUS_ERR("Fabric not found\n");
				return -ENXIO;
		}

		next_pnode = info->pnode[index].next;
		info->pnode[index].next = -2;
		curr = GET_NODE(next_pnode);
		index = GET_INDEX(next_pnode);
		if (IS_NODE(curr))
			hop = fabdev->algo->find_node(fabdev, curr);
		else
			hop = fabdev->algo->find_gw_node(fabdev, curr);
		if (!hop) {
			MSM_BUS_ERR("Null Info found for hop\n");
			return -ENXIO;
		}

		MSM_BUS_DBG("%d[%d] = %d\n", info->node_info->priv_id, index,
			info->pnode[index].next);
		MSM_BUS_DBG("num_pnodes: %d: %d\n", info->node_info->priv_id,
			info->num_pnodes);
		info = hop;
	} while (GET_NODE(info->pnode[index].next) != info->node_info->priv_id);

	info->pnode[index].next = -2;
	MSM_BUS_DBG("%d[%d] = %d\n", info->node_info->priv_id, index,
		info->pnode[index].next);
	MSM_BUS_DBG("num_pnodes: %d: %d\n", info->node_info->priv_id,
		info->num_pnodes);
	return 0;
}
开发者ID:cooldudezach,项目名称:android_kernel_zte_warplte,代码行数:49,代码来源:msm_bus_arb.c


示例7: matrix_inplace_diag_sqrt

// Comment
void matrix_inplace_diag_sqrt(matrix_type *Cd)
{
  int nrows = Cd->rows;

  if (Cd->rows != Cd->columns) {
    util_abort("%s: size mismatch \n",__func__);
  }
  else{
    int i;
    for ( i=0; i<nrows; i++)
      {
        Cd->data[GET_INDEX(Cd , i , i)] = sqrt(Cd->data[GET_INDEX(Cd , i , i)]);
      }
  }
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:16,代码来源:matrix.c


示例8: matrix_column_column_dot_product

double matrix_column_column_dot_product(const matrix_type * m1 , int col1 , const matrix_type * m2 , int col2) {
  if (m1->rows != m2->rows)
    util_abort("%s: size mismatch \n",__func__);

  if (col1 >= m1->columns || col2 >= m2->columns)
    util_abort("%s: size mismatch \n",__func__);
  {
    int row;
    double sum = 0;
    for( row = 0; row < m1->rows; row++)
      sum += m1->data[ GET_INDEX(m1 , row , col1) ] * m2->data[ GET_INDEX(m2, row , col2) ];

    return sum;
  }
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:15,代码来源:matrix.c


示例9: matrix_inplace_sub

/* Updates matrix A by subtracting matrix B - elementwise. */
void matrix_inplace_sub(matrix_type * A , const matrix_type * B) {
  if ((A->rows == B->rows) && (A->columns == B->columns)) {
    int i,j;

    for (j = 0; j < A->columns; j++)
      for (i=0; i < A->rows; i++)
        A->data[ GET_INDEX(A,i,j) ] -= B->data[ GET_INDEX(B,i,j) ];

  } else
    util_abort("%s: size mismatch  A:[%d,%d]   B:[%d,%d]\n",__func__ ,
               matrix_get_rows(A),
               matrix_get_columns(A),
               matrix_get_rows(B),
               matrix_get_columns(B));
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:16,代码来源:matrix.c


示例10: file_geo_nappe

/*****************************************
 * Read nappe characterization in a file *
 *****************************************/
GEO *
file_geo_nappe (BYTE Type, FILE *File)
{
  GEO_NAPPE  *Geo;
  PNT        *Pnt, *PntA, *PntB, *PntC, *PntD;
  FCT        *Fct;
  VECTOR     U, V;
  REAL       Real;
  INDEX      Index;

  INIT_MEM (Geo, 1, GEO_NAPPE);
  Geo->Type = Type;
  GET_INDEX (Geo->NbrPnt);
  INIT_MEM (Geo->TabPnt, Geo->NbrPnt, PNT);
  GET_INDEX (Geo->NbrFct);
  INIT_MEM (Geo->TabFct, Geo->NbrFct, FCT);
  Geo->Min.x = Geo->Min.y = Geo->Min.z =  INFINITY;
  Geo->Max.x = Geo->Max.y = Geo->Max.z = -INFINITY;

  for (Index = 0, Pnt = Geo->TabPnt; Index < Geo->NbrPnt; Index++, Pnt++) {
    GET_VECTOR (Pnt->Point);
    VEC_MIN (Geo->Min, Pnt->Point);
    VEC_MAX (Geo->Max, Pnt->Point);
  }

  for (Index = 0, Fct = Geo->TabFct; Index < Geo->NbrFct; Index++, Fct++) {
    if (fscanf (File, " ( %d %d %d %d )", &Fct->i, &Fct->j, &Fct->k, &Fct->l) < 4)
      return (FALSE);
    Fct->NumFct = Index;
    PntA = Geo->TabPnt + Fct->i; 
    PntB = Geo->TabPnt + Fct->j;
    PntC = Geo->TabPnt + Fct->k;
    PntD = Geo->TabPnt + Fct->l;
    VEC_SUB (U, PntC->Point, PntA->Point);
    VEC_SUB (V, PntD->Point, PntB->Point);
    VEC_CROSS (Fct->Normal, U, V);
    VEC_UNIT (Fct->Normal, Real);
    VEC_INC (PntA->Normal, Fct->Normal);
    VEC_INC (PntB->Normal, Fct->Normal);
    VEC_INC (PntC->Normal, Fct->Normal);
    VEC_INC (PntD->Normal, Fct->Normal);
  }

  for (Index = 0, Pnt = Geo->TabPnt; Index < Geo->NbrPnt; Index++, Pnt++)
    VEC_UNIT (Pnt->Normal, Real);

  return ((GEO *) Geo);
}
开发者ID:Moeryn,项目名称:PRCD-TP5,代码行数:51,代码来源:geo.nappe.c


示例11: ubidi_getVisualRun

U_CAPI UBiDiDirection U_EXPORT2
ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
                   int32_t *pLogicalStart, int32_t *pLength)
{
    int32_t start;
    UErrorCode errorCode = U_ZERO_ERROR;
    RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, errorCode, UBIDI_LTR);
    ubidi_getRuns(pBiDi, &errorCode);
    if(U_FAILURE(errorCode)) {
        return UBIDI_LTR;
    }
    RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR);

    start=pBiDi->runs[runIndex].logicalStart;
    if(pLogicalStart!=NULL) {
        *pLogicalStart=GET_INDEX(start);
    }
    if(pLength!=NULL) {
        if(runIndex>0) {
            *pLength=pBiDi->runs[runIndex].visualLimit-
                     pBiDi->runs[runIndex-1].visualLimit;
        } else {
            *pLength=pBiDi->runs[0].visualLimit;
        }
    }
    return (UBiDiDirection)GET_ODD_BIT(start);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:27,代码来源:ubidiln.c


示例12: output_line

static void output_line(FILE *out_file, DATA *data, DPOINT *where, 
		double *est, int n_outfl) {
	int i;

	assert(out_file != NULL);
	assert(out_file != stdout);

	if (data->mode & X_BIT_SET) {
		fprintf(out_file, " ");
		fprintf(out_file, gl_format, where->x);
	}
	if (data->mode & Y_BIT_SET) {
		fprintf(out_file, " ");
		fprintf(out_file, gl_format, where->y);
	}
	if (data->mode & Z_BIT_SET) {
		fprintf(out_file, " ");
		fprintf(out_file, gl_format, where->z);
	}
	if (data->mode & S_BIT_SET)
		fprintf(out_file, " %d", where->u.stratum + strata_min);
	if (data->colnvalue > 0) {
		fprintf(out_file, " ");
		fprintf(out_file, gl_format, where->attr);
	}
	for (i = 0; i < n_outfl; i++)
		fprintf(out_file, " %s", my_dtoa(gl_format, &(est[i])));

    if (data->point_ids)
        fprintf(out_file, " %s",data->point_ids[GET_INDEX(where)]);
    
	fprintf(out_file, "\n");
	return;
}
开发者ID:Andlon,项目名称:cs267FinalProject,代码行数:34,代码来源:report.c


示例13: matrix_get_column_abssum

double matrix_get_column_abssum(const matrix_type * matrix , int column) {
  double sum = 0;
  int i;
  for (i=0; i < matrix->rows; i++)
    sum += fabs( matrix->data[ GET_INDEX( matrix , i , column ) ] );
  return sum;
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:7,代码来源:matrix.c


示例14: matrix_get_row_sum

double matrix_get_row_sum(const matrix_type * matrix , int row) {
  double sum = 0;
  int j;
  for (j=0; j < matrix->columns; j++)
    sum += matrix->data[ GET_INDEX( matrix , row , j ) ];
  return sum;
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:7,代码来源:matrix.c


示例15: run_experiment_ji

double run_experiment_ji ( mtype_t * matrix , mtype_t scalar , int buffer_size ) {
    int i, j, iter;
    hptimer_t start , end;
    double final_time ;
    
    start = get_time ();
    for ( iter = 0; iter < MAX_ITERS ; ++ iter ) {
        for (j = 0; j < buffer_size ; ++j ) {
            for (i = 0; i < buffer_size ; ++i ) {
                matrix [ GET_INDEX (i, j, buffer_size ) ] = scalar * matrix [ GET_INDEX (i, j, buffer_size ) ];
            }
        }
    }
    end = get_time ();
    return final_time = diff_timers (start , end) / MAX_ITERS ;
}
开发者ID:drinkintiger,项目名称:CS441_Project_3.1,代码行数:16,代码来源:scalarmult.c


示例16: choice

static
int
choice( void )
{
    int i, n;

    rb->yield();

    for( n = i = 0 ; i < 81 ; ++i )
        if( IS_EMPTY( i ) )
        {
            possible[ n ] = SET_INDEX( i ) | SET_DIGIT( numset( board[ i ] ) );

            /* Inconsistency if square unknown, but nothing possible */
            if( 9 == GET_DIGIT( possible[ n ] ) )
                return -2;
            ++n;
        }

    if( 0 == n )
        return -1;      /* All squares known */

    rb->qsort( possible, n, sizeof( possible[ 0 ] ), cmp );
    return GET_INDEX( possible[ 0 ] );
}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:25,代码来源:generator.c


示例17: project

/***************************************************************
 * Ensures the velocity field is non divergent i.e. incompressible:
 * Solves a poisson equation to compute a gradient field and then
 * subtracts this from the current velocity field to obtain an
 * incompressible field. When solving for pressure it sets the
 * cells pressure field.
 ***************************************************************/
void FGS_Fluid_Solver2DS :: project (FLUID_DATA ux, FLUID_DATA uy, FLUID_DATA pressure, FLUID_DATA divergence){

    double h           = 1.0 / N * -0.5;
    double half_width  = width   * 0.5;
    double half_height = height  * 0.5;
    int    cell;
    double north, south, east, west;
    
    for (int i=1 ; i <= width; i++ )
        for (int j=1 ; j <= height; j++ ){
            cell  = GET_INDEX(i,j);
            north = grid[GET_INDEX(i,j-1)].data[uy];
            south = grid[GET_INDEX(i,j+1)].data[uy];
            east  = grid[GET_INDEX(i+1,j)].data[ux];
            west  = grid[GET_INDEX(i-1,j)].data[ux];
            
            grid[cell].data[divergence] = h * (east-west+south-north);
            grid[cell].data[pressure]   = 0;
        }
    
    set_boundary (SET_FOR_NON_VELOCITY_COMPONENT, divergence);
    set_boundary (SET_FOR_NON_VELOCITY_COMPONENT, pressure);
    
    computing_pressure = true;
    linear_solve (SET_FOR_NON_VELOCITY_COMPONENT, pressure, divergence, 1, 0.25);
    computing_pressure = false;
    
    for (int i = 1; i <= width; i++)
        for (int j = 1; j <= height; j++){
            
            cell  = GET_INDEX(i,j);
            north = grid[GET_INDEX(i,j-1)].data[pressure];
            south = grid[GET_INDEX(i,j+1)].data[pressure];
            east  = grid[GET_INDEX(i+1,j)].data[pressure];
            west  = grid[GET_INDEX(i-1,j)].data[pressure];
            
            double u_in_cell = grid[cell].data[ux],
                   v_in_cell = grid[cell].data[uy];
            
            grid[cell].data[ux] = u_in_cell - (half_width  * (east  - west));
            grid[cell].data[uy] = v_in_cell - (half_height * (south - north));
            
        }
    set_boundary(SET_FOR_HORIZONTAL_COMPONENT, ux);
    set_boundary(SET_FOR_VERTICAL_COMPONENT,   uy);

}
开发者ID:schanq,项目名称:FLUIDITI,代码行数:54,代码来源:FGS_Fluid_Solver2DS.cpp


示例18: linear_solve

/***************************************************************
 * Computes a Gauss seidel relaxation to solve AX=B for the
 * unknowns X using forward substitution (the higher the number
 * of iterations the closer the resultant vector X will be
 * to convergence). 
 ***************************************************************/
void FGS_Fluid_Solver2DS :: linear_solve (BOUNDARY_CONDITION  b, FLUID_DATA to, FLUID_DATA from, double a, double coef){
    for (int k = 0 ; k < iterations; k++){
        for (int i = 1 ; i <= width; i++){
            for (int j = 1 ; j <= height; j++){
                int    cell_ij_index = GET_INDEX(i, j);
                double w             = grid[GET_INDEX(i-1, j)].data[to], e = grid[GET_INDEX(i+1, j)].data[to],
                       n             = grid[GET_INDEX(i, j-1)].data[to], s = grid[GET_INDEX(i, j+1)].data[to],
                       c0            = grid[cell_ij_index].data[from];
                
                grid[cell_ij_index].data[to] = coef * (c0 + a * (w+e+s+n));
                
                if (computing_pressure) grid[cell_ij_index].data[PRESSURE] = grid[cell_ij_index].data[to];
            }
        }
        set_boundary(b, to);
    }
}
开发者ID:schanq,项目名称:FLUIDITI,代码行数:23,代码来源:FGS_Fluid_Solver2DS.cpp


示例19: matrix_copy_row

void matrix_copy_row(matrix_type * target_matrix, const matrix_type * src_matrix , int target_row, int src_row) {
  matrix_assert_equal_columns( target_matrix , src_matrix );
  {
    int col;
    for(col = 0; col < target_matrix->columns; col++)
      target_matrix->data[ GET_INDEX( target_matrix , target_row , col)] = src_matrix->data[ GET_INDEX( src_matrix, src_row, col)];
  }
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:8,代码来源:matrix.c


示例20: matrix_copy_column

void matrix_copy_column(matrix_type * target_matrix, const matrix_type * src_matrix , int target_column, int src_column) {
  matrix_assert_equal_rows( target_matrix , src_matrix );
  {
    int row;
    for(row = 0; row < target_matrix->rows; row++)
      target_matrix->data[ GET_INDEX( target_matrix, row , target_column)] = src_matrix->data[ GET_INDEX( src_matrix, row, src_column)];
  }
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:8,代码来源:matrix.c



注:本文中的GET_INDEX函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GET_INT函数代码示例发布时间:2022-05-30
下一篇:
C++ GET_HTTP_CONTEXT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap