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


C++ compose函数代码示例

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


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

示例1: efficient6ddifference

Twist Twist::operator-(const Twist& other) const
{
#ifdef IDYNTREE_DONT_USE_SEMANTICS
    return efficient6ddifference(*this,other);
#else
    return compose(*this,inverse(other));
#endif
}
开发者ID:smithjoshua001,项目名称:idyntree,代码行数:8,代码来源:Twist.cpp

示例2: efficient6dSum

Twist Twist::operator+(const Twist& other) const
{
#ifdef IDYNTREE_DONT_USE_SEMANTICS
    return efficient6dSum(*this,other);
#else
    return compose(*this,(other));
#endif
}
开发者ID:PerryZh,项目名称:idyntree,代码行数:8,代码来源:Twist.cpp

示例3: build_from_sbasis

/** Make a path from a d2 sbasis.
 \param p the d2 Symmetric basis polynomial
 \returns a Path

  If only_cubicbeziers is true, the resulting path may only contain CubicBezier curves.
*/
void build_from_sbasis(Geom::PathBuilder &pb, D2<SBasis> const &B, double tol, bool only_cubicbeziers) {
    if (!B.isFinite()) {
        THROW_EXCEPTION("assertion failed: B.isFinite()");
    }
    if(tail_error(B, 2) < tol || sbasis_size(B) == 2) { // nearly cubic enough
        if( !only_cubicbeziers && (sbasis_size(B) <= 1) ) {
            pb.lineTo(B.at1());
        } else {
            std::vector<Geom::Point> bez;
            sbasis_to_bezier(bez, B, 4);
            pb.curveTo(bez[1], bez[2], bez[3]);
        }
    } else {
        build_from_sbasis(pb, compose(B, Linear(0, 0.5)), tol, only_cubicbeziers);
        build_from_sbasis(pb, compose(B, Linear(0.5, 1)), tol, only_cubicbeziers);
    }
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:23,代码来源:sbasis-to-bezier.cpp

示例4: pp_def_type_mismatch

format pp_def_type_mismatch(formatter const & fmt, environment const & env, options const & opts, name const & n,
                            expr const & expected_type, expr const & given_type) {
    format r("type mismatch at definition '");
    r += format(n);
    r += format("', expected type");
    r += pp_indent_expr(fmt, env, opts, expected_type);
    r += compose(line(), format("given type:"));
    r += pp_indent_expr(fmt, env, opts, given_type);
    return r;
}
开发者ID:dumganhar,项目名称:lean-osx,代码行数:10,代码来源:error_msgs.cpp

示例5: main

int main(int argc, char *argv[])
{
    compositor *comp;
    char *dispatch;
    char *rest;
    char *comment;
    prim_source *prim;
    base_prim_source *base;
    char *output_file;
    int args_offset = 0;
    int i;

    if (argc < ARGS_START) {
        fail("usage: wfcomp output_file base:+HH+WW#RRGGBB [@comment] [args]");
    }

    output_file = argv[OUTPUT_FILENAME_ARG];

    /* Read the base */
    dispatch = arg_read_dispatch(argv[BASE_ARG], &rest);
    if (strcmp(dispatch, "base") != 0) {
        fail("bad base arg");
    }

    base = arg_read_base(rest);

    if (argv[ARGS_START][0] == '@') {
        comment = argv[ARGS_START] + 1;
        args_offset = 1;
    } else {
        comment = "";
    }

    comp = make_compositor(output_file,
                           comment,
                           base->width, base->height,
                           base->red, base->green, base->blue,
                           argc);
    if (argc >= ARGS_START + args_offset) {
        for (i = ARGS_START + args_offset; i < argc; i++) {
            dispatch = arg_read_dispatch(argv[i], &rest);
            prim = invoke_dispatch(dispatch, rest);

            add_source(comp, prim->source,
                       prim->x, prim->y,
                       prim->width, prim->height);
        }
    } else {
        fail("usage: args dispatch");
    }

    compose(comp);
    exit(0);
}
开发者ID:xach,项目名称:wfcomp,代码行数:54,代码来源:wfcomp.c

示例6: compose

void Path::setResource( const String &res )
{
   if ( res != m_device )
   {
      m_device = res;
      if ( m_device.find( ":" ) != String::npos || m_device.find( "/" ) != String::npos )
         m_bValid = false;

      compose();
   }
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:11,代码来源:path.cpp

示例7: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE( math2d__transformations, Some2dPoints )
{
    move2 m0(r0,p0);
    move2 m1(r1,p1);
    BOOMST_CHECK_APPROX_EQUAL( p2 + p1, leftOrthogonal(p2) >> m1 );
    BOOMST_CHECK_APPROX_EQUAL( m0, inverse(inverse(m0)) );
    BOOMST_CHECK_APPROX_EQUAL( move2_id, compose(inverse(m0),m0) );
    BOOMST_CHECK_APPROX_EQUAL( p1, p1 >> m0 >> inverse(m0) );
    BOOMST_CHECK_APPROX_EQUAL( p0, zero2 >> m0 );
    BOOMST_CHECK_APPROX_EQUAL( p3, move2_id.map(p3) );
}
开发者ID:laerne,项目名称:bOoM,代码行数:11,代码来源:test__math2d.cpp

示例8: main

int main()
{
    // print sin(abs(-0.5))
    std::cout << compose(Abs(),Sine())(0.5) << "\n\n";

    // print abs() of some values
    print_values(Abs());
    std::cout << '\n';

    // print sin() of some values
    print_values(Sine());
    std::cout << '\n';

    // print sin(abs()) of some values
    print_values(compose(Abs(),Sine()));
    std::cout << '\n';

    // print abs(sin()) of some values
    print_values(compose(Sine(),Abs()));
}
开发者ID:sean-wang-wenfeng,项目名称:CPP_Templates_Ex,代码行数:20,代码来源:compose2.cpp

示例9: samples

 Real GeneralStatistics::variance() const {
     Size N = samples();
     QL_REQUIRE(N > 1,
                "sample number <=1, unsufficient");
     // Subtract the mean and square. Repeat on the whole range.
     // Hopefully, the whole thing will be inlined in a single loop.
     Real s2 = expectationValue(compose(square<Real>(),
                                        subtract<Real>(mean())),
                                everywhere()).first;
     return s2*N/(N-1.0);
 }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:11,代码来源:generalstatistics.cpp

示例10: main

int main(void)
{
    init_IO();
    init_interrupts();
    oledInit();
    _delay_ms(200);

    oledSetCursor(cursX, cursY);
    putChar(66,1);
    advanceCursor(6);

    compose();

    initMenu();

    while(1)
    {
        static uint16_t butCounter = 0;
        if (butCounter++ > 65000) {
            //FIXME: Proper button debounce and handling
            butCounter = 0;
            uint8_t readButtons = BUT_PIN;
            if (~readButtons & BUT_LEFT) {
                ++goLeft;
            }
            if (~readButtons & BUT_SEL) {
                ++goSel;
            }
        }

        if (knobChange) {
            if (knobChange > 0) {
                //menuUp();
                knobLeft();
            }
            else {
                //menuDn();
                knobRight();
            }
            knobChange = 0;
        }

        if (goSel) {
            //Lookup and execute action
            doSelect[optionIndex]();
            goSel = 0;
        }
        else if (goLeft) {
            doBack();
            goLeft = 0;
        }
    }
}
开发者ID:szczys,项目名称:SloJak,代码行数:53,代码来源:main.c

示例11: asStaticText

void StaticText::update()
{
    m_messages.pop_front();
    if(m_messages.empty()) {
        // schedule removal
        auto self = asStaticText();
        g_dispatcher.addEvent([self]() { g_map.removeThing(self); });
    } else {
        compose();
        scheduleUpdate();
    }
}
开发者ID:Ablankzin,项目名称:otclient,代码行数:12,代码来源:statictext.cpp

示例12: change_goal_tactic

tactic change_goal_tactic(elaborate_fn const & elab, expr const & e) {
    return tactic([=](environment const & env, io_state const & ios, proof_state const & s) {
            proof_state new_s = s;
            goals const & gs  = new_s.get_goals();
            if (!gs) {
                throw_no_goal_if_enabled(s);
                return proof_state_seq();
            }
            expr t            = head(gs).get_type();
            bool report_unassigned = true;
            if (auto new_e = elaborate_with_respect_to(env, ios, elab, new_s, e, none_expr(), report_unassigned)) {
                goals const & gs    = new_s.get_goals();
                goal const & g      = head(gs);
                substitution subst  = new_s.get_subst();
                auto tc             = mk_type_checker(env);
                constraint_seq cs;
                if (tc->is_def_eq(t, *new_e, justification(), cs)) {
                    if (cs) {
                        unifier_config cfg(ios.get_options());
                        buffer<constraint> cs_buf;
                        cs.linearize(cs_buf);
                        to_buffer(new_s.get_postponed(), cs_buf);
                        unify_result_seq rseq = unify(env, cs_buf.size(), cs_buf.data(), subst, cfg);
                        return map2<proof_state>(rseq, [=](pair<substitution, constraints> const & p) -> proof_state {
                                substitution const & subst    = p.first;
                                constraints const & postponed = p.second;
                                substitution new_subst = subst;
                                expr final_e = new_subst.instantiate_all(*new_e);
                                expr M       = g.mk_meta(mk_fresh_name(), final_e);
                                goal new_g(M, final_e);
                                assign(new_subst, g, M);
                                return proof_state(new_s, cons(new_g, tail(gs)), new_subst, postponed);
                            });
                    }
                    expr M   = g.mk_meta(mk_fresh_name(), *new_e);
                    goal new_g(M, *new_e);
                    assign(subst, g, M);
                    return proof_state_seq(proof_state(new_s, cons(new_g, tail(gs)), subst));
                } else {
                    throw_tactic_exception_if_enabled(new_s, [=](formatter const & fmt) {
                            format r = format("invalid 'change' tactic, the given type");
                            r += pp_indent_expr(fmt, *new_e);
                            r += compose(line(), format("does not match the goal type"));
                            r += pp_indent_expr(fmt, t);
                            return r;
                        });
                    return proof_state_seq();
                }
            }
            return proof_state_seq();
        });
}
开发者ID:GallagherCommaJack,项目名称:lean,代码行数:52,代码来源:change_tactic.cpp

示例13: sqrt_internal

//-Sqrt----------------------------------------------------------
static Piecewise<SBasis> sqrt_internal(SBasis const &f, 
                                    double tol, 
                                    int order){
    SBasis sqrtf;
    if(f.isZero() || order == 0){
        return Piecewise<SBasis>(sqrtf);
    }
    if (f.at0()<-tol*tol && f.at1()<-tol*tol){
        return sqrt_internal(-f,tol,order);
    }else if (f.at0()>tol*tol && f.at1()>tol*tol){
        sqrtf.resize(order+1, Linear(0,0));
        sqrtf[0] = Linear(std::sqrt(f[0][0]), std::sqrt(f[0][1]));
        SBasis r = f - multiply(sqrtf, sqrtf); // remainder    
        for(unsigned i = 1; int(i) <= order && i<r.size(); i++) {
            Linear ci(r[i][0]/(2*sqrtf[0][0]), r[i][1]/(2*sqrtf[0][1]));
            SBasis cisi = shift(ci, i);
            r -= multiply(shift((sqrtf*2 + cisi), i), SBasis(ci));
            r.truncate(order+1);
            sqrtf[i] = ci;
            if(r.tailError(i) == 0) // if exact
                break;
        }
    }else{
        sqrtf = Linear(std::sqrt(fabs(f.at0())), std::sqrt(fabs(f.at1())));
    }

    double err = (f - multiply(sqrtf, sqrtf)).tailError(0);
    if (err<tol){
        return Piecewise<SBasis>(sqrtf);
    }

    Piecewise<SBasis> sqrtf0,sqrtf1;
    sqrtf0 = sqrt_internal(compose(f,Linear(0.,.5)),tol,order);
    sqrtf1 = sqrt_internal(compose(f,Linear(.5,1.)),tol,order);
    sqrtf0.setDomain(Interval(0.,.5));
    sqrtf1.setDomain(Interval(.5,1.));
    sqrtf0.concat(sqrtf1);
    return sqrtf0;
}
开发者ID:loveq369,项目名称:DoonSketch,代码行数:40,代码来源:sbasis-math.cpp

示例14: solve

void solve() {
    for( int i = 1; i <= n; i++ )
        inv[perm[i]] = i;

    int base[81];
    for( int i = 1; i <= n; i++ )
        base[i] = i;
    /* We will repeatedly square inv
     * and put the intermediade results in base.
     */

    while( m != 0 ) {
        if( m % 2 == 1 )
            compose( base, inv );
        compose( inv, inv );
        m >>= 1;
    }

    for( int i = 1; i <= n; i++ )
        base_solution[i] = base_str[base[i]];
    base_solution[n+1] = '\0';
}
开发者ID:royertiago,项目名称:maratona,代码行数:22,代码来源:pdecode.cpp

示例15: main

int main(int argc, char** argv)
{
  double (*input)[N] = (double (*)[N])new double[M*N];
  double (*output)[N] = (double (*)[N])new double[2*M*N];
  double (*output_ref)[N] = (double (*)[N])new double[2*M*N];

  for( int i = 0 ; i < M ; i++ )
    for( int j = 0 ; j < N ; j++ )
      input[i][j] = (double)(rand()) / (double)(RAND_MAX-1);
      
  for( int i = 0 ; i < 2*M ; i++ ) 
    for( int j = 0 ; j < N ; j++ ){
      output[i][j] = 0.0;
      output_ref[i][j] = 0.0;
    }

  compose((double*)input,M,N,(double*)output);
  ref_output(input,output_ref);
  
  printf("Input :\n");
  for( int i = 0 ; i < M ; i++ ){
    for( int j = 0 ; j < N ; j++ )
      printf(" %f",input[i][j]);
    printf("\n");
  }
  printf("Output[%d,%d] :\n",2*M,N);
  for( int i = 0 ; i < 2*M ; i++ ){
    for( int j = 0 ; j < N ; j++ )
      printf(" %f",output[i][j]);
    printf("\n");
  }
  printf("OutputRef[%d,%d] :\n",2*M,N);
  for( int i = 0 ; i < 2*M ; i++ ){
    for( int j = 0 ; j < N ; j++ )
      printf(" %f",output_ref[i][j]);
    printf("\n");
  }
  double diff = 0.0;
  for( int i = 0 ; i < 2*M ; i++ )
    for( int j = 0 ; j < N ; j++ )
      diff += fabs(output_ref[i][j] - output[i][j]);
  printf("Diff : %e\n",diff);
  if( diff > 1e-6 ){
    printf("Incorrect result\n");
    exit(1);
  }
  delete[] input;
  delete[] output;
  delete[] output_ref;
  return 0;
}
开发者ID:NVIDIA,项目名称:Forma,代码行数:51,代码来源:compose.cpp


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