当前位置: 首页>>代码示例>>C++>>正文


C++ GET_INDEX函数代码示例

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


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


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