Пример #1
0
/**
 @brief    密行列AをHessenberg型行列Bに相似変換する.
 @param[in]  n    正方行列A,Bのサイズ
 @param[in]  A    行列
 @param[in]  LDA  Aの第1次元
 @param[out] B    相似変換により得られたHessenberg型行列
 @param[in]  LDB  Bの第1次元
 */
void chsnbrg_simtr(int n, cmulti **B, int LDB, cmulti **A, int LDA)
{
  int i,prec=53;
  rmulti *alpha=NULL;
  cmulti **h=NULL;
  // allocate
  prec=cmat_get_prec_max(n,n,B,LDB);
  alpha=rallocate_prec(prec);
  h=cvec_allocate_prec(n,prec);
  // copy
  cmat_copy(n,n,B,LDB,A,LDA);
  // compute
  for(i=0; i<n-2; i++){
    // Householder vector
    chouseholder_vec(n,i+1,h,alpha,&COL(B,i,LDB));
    // similarity transformation
    chouseholder_right(n,n,B,LDB,B,LDB,i+1,h,alpha);
    chouseholder_left(n,n,B,LDB,B,LDB,i+1,h,alpha);
    // set lower part as zeros
    cvec_set_zeros(n-2-i,&MAT(B,i+2,i,LDB));
  }
  // done
  alpha=rfree(alpha);
  h=cvec_free(n,h);
}
Пример #2
0
DrawableContext *drawable_init_context(Drawable *node, RenderEffect2D *eff)
{
	DrawableContext *ctx;
	u32 i;
	Bool skipFill;
	assert(eff->surface);

	/*switched-off geometry nodes are not rendered*/
	if (eff->trav_flags & TF_SWITCHED_OFF) return NULL;

	//Get a empty context from the current surface
	ctx = VS2D_GetDrawableContext(eff->surface);

	mx2d_copy(ctx->transform, eff->transform);
	ctx->node = node;
	if (eff->invalidate_all || node->node_changed) 
		ctx->redraw_flags |= CTX_NODE_DIRTY;

	ctx->h_texture = NULL;
	if (eff->appear) {
		ctx->appear = eff->appear;
		if (Node_GetDirty(eff->appear)) ctx->redraw_flags |= CTX_APP_DIRTY;
	}
#ifndef FIXME
	/*todo cliper*/
#else
	else {
		VS2D_RemoveLastContext(eff->surface);
		return NULL;
	}
#endif

	/*FIXME - only needed for texture*/
	cmat_copy(&ctx->cmat, &eff->color_mat);

	/*IndexedLineSet2D and PointSet2D ignores fill flag and texturing*/
	skipFill = 0;
	ctx->h_texture = NULL;
	switch (Node_GetTag(ctx->node->owner) ) {
	case TAG_MPEG4_IndexedLineSet2D: skipFill = 1; break;
	case TAG_MPEG4_PointSet2D: skipFill = 1; break;
	default:
		ctx->h_texture = drawable_get_texture(eff);
		break;
	}
	
	/*setup sensors*/
	for (i=0; i<ChainGetCount(eff->sensors); i++) 
		drawctx_add_sensor(ctx, ChainGetEntry(eff->sensors, i));

	setup_drawable_context(ctx, eff);


	/*Update texture info - draw even if texture not created (this may happen if the media is removed)*/
	if (ctx->h_texture && ctx->h_texture->needs_refresh) ctx->redraw_flags |= CTX_TEXTURE_DIRTY;

	/*not clear in the spec: what happens when a transparent node is in form/layout ?? this may 
	completely break layout of children. We consider the node should be drawn*/
	if (!eff->parent && check_transparent_skip(ctx, skipFill)) {
		VS2D_RemoveLastContext(eff->surface);
		return NULL;
	}

	//setup clipper if needed

	return ctx;
}