本文整理汇总了C++中FR函数的典型用法代码示例。如果您正苦于以下问题:C++ FR函数的具体用法?C++ FR怎么用?C++ FR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: func_args_rm_add_pow1
func_t *func_expand_mul1_add1(func_t *f)
{
int i,j,k;
func_t *h=NULL,*g=NULL;
if(func_is_mul(f) && func_power(f)==1 && func_a_has_op_pow1(f,func_is_add)){
// get terms without (add)^1
g=func_clone(FR(f));
func_args_rm_add_pow1(g);
func_a_rm_null(g);
g=func_mul_eval(g);
// loop
for(i=0; i<func_asize(f); i++){
if(func_is_add(f->a[i]) && func_power(f->a[i])==1){
if(func_is_add(g) && func_power(g)==1){
h=func_zero();
for(k=0; k<func_asize(g); k++){
for(j=0; j<func_asize(f->a[i]); j++){
h=func_add(h,func_expand(func_mul(FR(g->a[k]),FR(f->a[i]->a[j]))));
}
}
}else{
h=func_zero();
for(j=0; j<func_asize(f->a[i]); j++){
h=func_add(h,func_expand(func_mul(FR(g),FR(f->a[i]->a[j]))));
}
}
g=func_del(g); g=h; h=NULL;
}
}
}else{ FUNC_ERROR_ARG1("func_expand_mul1_add1",f); }
f=func_del(f);
return g;
}
示例2:
func_t *func_diff_tanh_pow1(func_t *f, int var)
{
func_t *fx=NULL,*g=NULL,*gx=NULL;
if(!func_is(f,"tanh") || func_power(f)!=1){ FUNC_ERROR_ARG1("func_diff_tanh",f); }
g=f->a[0];
gx=func_diff(FR(g),func_var1(var,1));
fx=func_mul(func_pow_n(func_cosh(FR(g)),-2),gx);
f=func_del(f);
return fx;
}
示例3:
//h={q,r}
func_t *func_poly_div_r_and_q(func_t *f, func_t *g)
{
func_t *h=NULL;
h=func_list(2);
h->a[0]=func_poly_div_q(FR(f),FR(g));
h->a[1]=func_poly_div_r(FR(f),FR(g));
f=func_del(f);
g=func_del(g);
return h;
}
示例4: func_add_args_collect
void func_add_args_collect(func_t *f, func_is_t *fis)
{
int i,j;
func_t *g=NULL;
if(!func_is_add(f)){ FUNC_ERROR_ARG1("func_add_args_collect",f); }
// convert args to split list
for(i=0; i<func_asize(f); i++){
g=func_mul_split_list(FR(func_aget(f,i)),fis);
func_aset(f,i,FR(g));
g=func_del(g);
}
// add a arg to same arg
for(i=0; i<func_asize(f); i++){
for(j=i+1; func_aget(f,i)!=NULL && !func_is_one(func_aget(func_aget(f,i),1)) && j<func_asize(f); j++){
if(func_aget(f,j)!=NULL && func_cmp(func_aget(func_aget(f,i),1),func_aget(func_aget(f,j),1))==0){
g=func_list(2);
func_aset(g,0,func_add(FR(func_aget(func_aget(f,i),0)),FR(func_aget(func_aget(f,j),0))));
func_aset(g,1,FR(func_aget(func_aget(f,i),1)));
func_aset(f,i,FR(g));
func_adel(f,j);
g=func_del(g);
}
}
}
// convert list to mul
for(i=0; i<func_asize(f); i++){
if(func_aget(f,i)!=NULL){
g=func_mul(FR(func_aget(func_aget(f,i),0)),FR(func_aget(func_aget(f,i),1)));
func_aset(f,i,FR(g));
g=func_del(g);
}
}
func_a_rm_null(f);
}
示例5: func_clone
func_t *func_poly_clone_coeff_ntarm(func_t *f,int n)
{
func_t *a;
if(!func_is_poly(f)){ return NULL; }
a=func_poly_get_mono_ntarm(f,n);
if(a==NULL){ return func_zero(); }
if(func_is_number(a)){ return func_clone(FR(a)); }
a=func_mono_get_coeff(a);
if(a==NULL){ return func_one(); }
return func_clone(FR(a));
}
示例6: func_a_insert
void func_a_insert(func_t *f, int n, func_t *g)
{
int i,k;
func_t **a;
if(f==NULL){ FUNC_ERROR_ARG1("func_a_insert",f); }
a=(func_t**)malloc(sizeof(func_t*)*(func_asize(f)+1));
for(k=0,i=0; k<func_asize(f)+1; ){
if(i==n){ a[k++]=g; a[k++]=FR(f->a[i++]); }
else { a[k++]=FR(f->a[i++]); }
}
func_a_replace(f,func_asize(f)+1,a);
}
示例7: func_aset
func_t *func_poly_list_monic(func_t *f)
{
int i;
func_t *g=NULL;
if(!(func_is_poly_list(f))){ FUNC_ERROR_ARG1("func_poly_list_monic",f); }
g=func_clone(FR(f));
for(i=0; i<func_asize(g); i++){
func_aset(g,i,func_poly_monic(FR(g->a[i])));
}
f=func_del(f);
return g;
}
示例8: func_add_args
void func_add_args(func_t *f, func_is_t *fis, func_is_t *fin)
{
int i,j;
if(!func_is_add(f)){ FUNC_ERROR_ARG1("func_add_args",f); }
for(i=0; i<func_asize(f); i++){
for(j=0; fis(func_aget(f,i)) && j<func_asize(f); j++){
if(i!=j && fin(func_aget(f,j))){
func_aset(f,i,func_add(FR(func_aget(f,i)),FR(func_aget(f,j))));
func_adel(f,j);
}
}
}
func_a_rm_null(f);
}
示例9: Follower
Enemy::Enemy(LPCWSTR _meshName, LPCWSTR _textureName, LPCWSTR _normalTexName,
char* _attackSound, char* _deathSound, char* _getHitSound,
D3DXVECTOR3 _startPosition, float _healthMax, float _radius, D3DXVECTOR3 _meshScale) :
Follower(_meshName, _textureName, _normalTexName, _startPosition, _healthMax,
_radius, _meshScale), mLoseSightPlayer(10.0f), mLoseSightFollower(10.0f)
{
mState = PSTATE_WANDER;
// TODO BUG: As far as I know, this is causing a memory every time an enemy is created
FR(gSound->getSystem()->createSound(_attackSound, FMOD_DEFAULT, 0, &enemyAttack));
FR(gSound->getSystem()->createSound(_deathSound, FMOD_DEFAULT, 0, &enemyDeath));
FR(gSound->getSystem()->createSound(_getHitSound, FMOD_DEFAULT, 0, &enemyGetHit));
// TODO: this needs to be moved to a point where the enemy begins to move or is still
bIsMoving = true;
}
示例10: func_set_power
func_t *func_diff_pow_n(func_t *f, int var)
{
func_t *fx=NULL,*g=NULL;
if(!func_has_power(f) || func_power(f)==1){ FUNC_ERROR_ARG1("func_diff_pow_n",f); }
g=func_clone(FR(f));
func_set_power(g,1);
g=func_diff(g,func_var1(var,1));
fx=func_clone(FR(f));
func_set_power(fx,func_power(fx)-1);
fx=func_mul(func_bigint_int(func_power(f),1),fx);
fx=func_mul(fx,g);
f=func_del(f);
return fx;
}
示例11: lapackglue_geev
void lapackglue_geev(char jobvl, char jobvr, int n,
scalar *A, int fdA, scalar_complex *w,
scalar *VL, int fdVL, scalar *VR, int fdVR,
scalar *work, int lwork, real *rwork)
{
int info;
#ifdef SCALAR_COMPLEX
F(geev,GEEV) (&jobvl, &jobvr, &n, A, &fdA, w, VL, &fdVL, VR, &fdVR,
work, &lwork, rwork, &info);
#else
int i;
real *wr, *wi;
CHK_MALLOC(wr, real, 2*n);
wi = wr + n;
(void) rwork; /* unused */
FR(geev,GEEV) (&jobvl, &jobvr, &n, A, &fdA, wr, wi, VL, &fdVL, VR, &fdVR,
work, &lwork, &info);
for (i = 0; i < n; ++i)
CASSIGN_SCALAR(w[i], wr[i], wi[i]);
free(wr);
#endif
CHECK(info >= 0, "invalid argument in geev");
CHECK(info <= 0, "failure to converge in geev");
}
示例12: Pawn
Player::Player(LPCWSTR _meshName, LPCWSTR _textureName, LPCWSTR _normalTexName,
D3DXVECTOR3 _startPosition, float _healthMax, float _radius, D3DXVECTOR3 _meshScale) :
Pawn(_meshName, _textureName, _normalTexName, _startPosition, _healthMax, _radius,
_meshScale),
//starting with full ammo here, but that won't be the case in the actual game
mAmmoSeeds(0), mAmmoSeedsMax(100), mAmmoFire(0), mAmmoFireMax(100), mScore(0),
mLeftAttack(A_MELEE), mRightAttack(A_SEED)
{
mSpeed = 400.0f;
mAttackDelay = 0.9f;
FR(gSound->getSystem()->createSound("Content/Audio/sndPlayerAttackFire.wav", FMOD_DEFAULT, 0, &playerAttackFire));
FR(gSound->getSystem()->createSound("Content/Audio/sndPlayerAttackMelee.wav", FMOD_DEFAULT, 0, &playerAttackMelee));
FR(gSound->getSystem()->createSound("Content/Audio/sndPlayerAttackSeed.wav", FMOD_DEFAULT, 0, &playerAttackSeed));
FR(gSound->getSystem()->createSound("Content/Audio/sndPlayerDeath.wav", FMOD_DEFAULT, 0, &playerDeath)); //(for later use)
}
示例13: GEMENI_charsent
void GEMENI_charsent() {
unsigned long r = s->log[s->lc];
if (UCA0IFG & UCTXIFG) {
s->nch++;
switch (s->nch) {
case 1:
UCA0TXBUF = SL(r) << 5 |TL(r)<<4|KL(r)<<3|PL(r)<<2|WL(r)<<1|HL(r);
break;
case 2:
UCA0TXBUF = RL(r)<<6 | AL(r)<<5 | OL(r)<<4 | STAR(r)<<3;
break;
case 3:
UCA0TXBUF = ER(r)<<3 | UR(r)<<2 | FR(r)<<1 | RR(r);
break;
case 4:
UCA0TXBUF = PR(r)<<6 | BR(r)<<5 | LR(r)<<4 | GR(r)<<3 | TR(r)<<2 | SR(r)<<1 | DRS(r);
break;
case 5:
UCA0TXBUF = POUND(r)<<1 | ZRS(r);
break;
default:
s->lc++;
if (s->lc != s->nc-1) {
s->nch = 0;
UCA0TXBUF = 1 << 7; // first packet, no fn or '#'
} else {
s->flags &= ~CSEND;
}
}
}
}
示例14: func_expand
func_t *func_poly_monic(func_t *f)
{
func_t *a=NULL;
if(!(func_is_poly(f))){ FUNC_ERROR_ARG1("func_poly_monic",f); }
a=func_poly_get_lc(f);
if(a==NULL || func_is_one(a)){ return f; }
return func_expand(func_mul(func_inv(FR(a)),f));
}
示例15: func_init
func_t *func_set_eval(func_t *f)
{
func_init();
if(f==NULL || !func_is(f,"set") || func_asize(f)!=1){ FUNC_ERROR_ARG1("func_set_eval",f); }
func_scope_set(0,FR(func_aget(f,0)));
f=func_del(f);
return f;
}