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


C++ AType类代码示例

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


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

示例1: kk_matvec

void kk_matvec(AType A, XType x, YType y, int rows_per_thread, int team_size, int vector_length) {

  typedef typename XType::non_const_value_type Scalar;
  typedef typename AType::execution_space execution_space;
  typedef KokkosSparse::CrsMatrix<const Scalar,int,execution_space,void,int> matrix_type ;
  typedef typename Kokkos::View<Scalar*,Kokkos::LayoutLeft,execution_space> y_type;
  typedef typename Kokkos::View<const Scalar*,Kokkos::LayoutLeft,execution_space,Kokkos::MemoryRandomAccess > x_type;

  int rows_per_team = launch_parameters<execution_space>(A.numRows(),A.nnz(),rows_per_thread,team_size,vector_length);

  double s_a = 1.0;
  double s_b = 0.0;
  SPMV_Functor<matrix_type,x_type,y_type,0,false> func (s_a,A,x,s_b,y,rows_per_team);

  int worksets = (y.extent(0)+rows_per_team-1)/rows_per_team;

  Kokkos::TeamPolicy<Kokkos::Schedule<ScheduleType> > policy(1,1);

  if(team_size>0)
    policy = Kokkos::TeamPolicy<Kokkos::Schedule<ScheduleType> >(worksets,team_size,vector_length);
  else
    policy = Kokkos::TeamPolicy<Kokkos::Schedule<ScheduleType> >(worksets,Kokkos::AUTO,vector_length);

  Kokkos::parallel_for(policy,func);
}
开发者ID:giorgiobornia,项目名称:trilinos,代码行数:25,代码来源:Kokkos_SPMV.hpp

示例2: main

int main()
{
    AType a[2][5] = {
                    AType(1,2), AType(3,4),
                    AType(5,6), AType(7,8),
                    AType(9,10), AType(11,12),
                    AType(13,14), AType(15,16),
                    AType(17,18), AType(19,20),
                    };

    AType *p;

    //p = (AType *)a;
    p = (AType *)a;

    for(int i=0;i<2;i++){
        for(int j=0;j<5;j++){
            p->show();
            p++;
        }
        cout << endl;
    }

    return 0;
}
开发者ID:sami1592,项目名称:Teach-Yourself-cPlusPlus-Exercise-And-Experiments,代码行数:25,代码来源:main.cpp

示例3: genericRelational

void TypeAnalysis::genericRelational(CallInst * ci) {
    AType * lhs = state.get(ci->getOperand(0));
    AType * rhs = state.get(ci->getOperand(1));
    if (lhs->isDoubleScalar() and rhs->isDoubleScalar()) {
        state.update(ci, AType::D1);
    } else {
        state.update(ci, AType::DV);
    }
}
开发者ID:janvitek,项目名称:rift,代码行数:9,代码来源:type_analysis.cpp

示例4: state

bool Unboxing::genericArithmetic(llvm::Instruction::BinaryOps op) {
    llvm::Value * lhs = ins->getOperand(0);
    llvm::Value * rhs = ins->getOperand(1);
    AType * lhsType = state().get(lhs);
    AType * rhsType = state().get(rhs);
    if (lhsType->isDouble() and rhsType->isDouble()) {
        return doubleArithmetic(lhs, rhs, lhsType, rhsType, op);
    }
    return false;
}
开发者ID:janvitek,项目名称:rift,代码行数:10,代码来源:unboxing.cpp

示例5: AType

void TypeAnalysis::genericRelational(CallInst * ci) {
    AType * lhs = state.get(ci->getOperand(0));
    AType * rhs = state.get(ci->getOperand(1));
    if (lhs->isScalar() and rhs->isScalar()) {
        state.update(ci,
                new AType(AType::Kind::R,
                    AType::Kind::DV,
                    AType::Kind::D));
    } else {
        state.update(ci, new AType(AType::Kind::R, AType::Kind::DV));
    }
}
开发者ID:rift-lecture,项目名称:rift,代码行数:12,代码来源:type_analysis.cpp

示例6: if

void TypeAnalysis::genericGetElement(CallInst * ci) {
    AType * from = state.get(ci->getOperand(0));
    AType * index = state.get(ci->getOperand(1));
    if (from->isDouble()) {
        if (index->isDoubleScalar()) {
            state.update(ci, AType::D1);
        } else {
            state.update(ci, AType::DV);
        }
    } else if (from->isCharacter()) {
        state.update(ci, AType::CV);
    } else {
        state.update(ci, AType::T);
    }
}
开发者ID:janvitek,项目名称:rift,代码行数:15,代码来源:type_analysis.cpp

示例7: kk_inspector_matvec

void kk_inspector_matvec(AType A, XType x, YType y, int rows_per_thread, int team_size, int vector_length) {

  typedef typename XType::non_const_value_type Scalar;
  typedef typename AType::execution_space execution_space;
  typedef KokkosSparse::CrsMatrix<const Scalar,int,execution_space,void,int> matrix_type ;
  typedef typename Kokkos::View<Scalar*,Kokkos::LayoutLeft,execution_space> y_type;
  typedef typename Kokkos::View<const Scalar*,Kokkos::LayoutLeft,execution_space,Kokkos::MemoryRandomAccess > x_type;

  //int rows_per_team = launch_parameters<execution_space>(A.numRows(),A.nnz(),rows_per_thread,team_size,vector_length);
  //static int worksets = (y.extent(0)+rows_per_team-1)/rows_per_team;
  static int worksets = std::is_same<Schedule,Kokkos::Static>::value ?
                        team_size>0?execution_space::concurrency()/team_size:execution_space::concurrency() : //static
                        team_size>0?execution_space::concurrency()*32/team_size:execution_space::concurrency()*32 ; //dynamic
  static Kokkos::View<int*> workset_offsets;
  if(workset_offsets.extent(0) == 0) {
    workset_offsets = Kokkos::View<int*> ("WorksetOffsets",worksets+1);
    const size_t nnz = A.nnz();
    int nnz_per_workset = (nnz+worksets-1)/worksets;
    workset_offsets(0) = 0;
    int ws = 1;
    for(int row = 0; row<A.numRows(); row++) {
      if(A.graph.row_map(row) > ws*nnz_per_workset) {
        workset_offsets(ws) = row;
        ws++;
      }
    }
    if(workset_offsets(ws-1) < A.numRows()) {
      workset_offsets(ws) = A.numRows();
    }
    printf("Worksets: %i %i\n",worksets,ws);
    worksets = ws;
  }
  double s_a = 1.0;
  double s_b = 0.0;
  SPMV_Inspector_Functor<matrix_type,x_type,y_type,0,false,int> func (s_a,A,x,workset_offsets,s_b,y);

  Kokkos::TeamPolicy<Kokkos::Schedule<Schedule> > policy(1,1);

  if(team_size>0)
    policy = Kokkos::TeamPolicy<Kokkos::Schedule<Schedule> >(worksets,team_size,vector_length);
  else
    policy = Kokkos::TeamPolicy<Kokkos::Schedule<Schedule> >(worksets,Kokkos::AUTO,vector_length);

  Kokkos::parallel_for("KokkosSparse::PerfTest::SpMV_Inspector", policy,func);
}
开发者ID:jwillenbring,项目名称:Trilinos,代码行数:45,代码来源:Kokkos_SPMV_Inspector.hpp

示例8: project4

 /** Checks that a dot operator result type is correctly set to be double scalar by the type analysis. */
 void project4() {
     char const * source = "function(a, b) { a %*% b }";
     try {
         Environment * env = new Environment(nullptr);
         RVal * actual = eval(env, source);
         llvm::Function * f = actual->f->bitcode;
         // run type analysis on the function
         //auto pm = llvm::legacy::FunctionPassManager(f->getParent());
         TypeAnalysis ta;
         ta.runOnFunction(*f);
         // check the type of the genericDot intrinsic call
         for (auto & b : *f) {
             for (auto & i : b) {
                 if (llvm::CallInst * ci = llvm::dyn_cast<llvm::CallInst>(&i)) {
                     llvm::StringRef s = ci->getCalledFunction()->getName();
                     if (s == "genericDot") {
                         AType * t = ta.state.get(ci);
                         if (t->kind != AType::Kind::R or not t->isScalar())
                             throw "Generic dot does not have correct type";
                         if (ta.state.getLocation(t) != ci)
                             throw "Location attached to the generic dot type is invalid";
                         t = t->payload;
                         if (ta.state.getLocation(t) != nullptr)
                             throw "Generic dot payload cannot have location";
                         t = t->payload;
                         if (ta.state.getLocation(t) != nullptr)
                             throw "Generic dot payload cannot have location";
                         return;
                     }
                 }
             }
         }
         throw "Generic dot not found";
     } catch (char const * e) {
         cout << "ERROR at line " << __LINE__ << " : " << e << endl;
         cout << source << endl << endl;
     } catch (...) {
         cout << "ERROR at line " << __LINE__ << " : " << endl;
         cout << source << endl << endl;
     }
 }
开发者ID:evandar,项目名称:project,代码行数:42,代码来源:tests.cpp

示例9: isend

	static bool isend(AType &a, IType it)
	{
		return it == a.end();
	}
开发者ID:AshleyPeterson,项目名称:netbee-lite,代码行数:4,代码来源:sft_basic_iterator.hpp

示例10: end

	static IType end(AType &a)
	{
		return a.end();
	}
开发者ID:AshleyPeterson,项目名称:netbee-lite,代码行数:4,代码来源:sft_basic_iterator.hpp

示例11: begin

	static IType begin(AType &a)
	{
		return a.begin();
	}
开发者ID:AshleyPeterson,项目名称:netbee-lite,代码行数:4,代码来源:sft_basic_iterator.hpp

示例12: RelationData


//.........这里部分代码省略.........
            result->original_id = id;

            if (! strcmp(k, "oid")) {
                // a sub lib is imported as a part of the imported lib
                (void) read_id(st);
                k = read_keyword(st);
            }
        }
        else if (! strcmp(k, "oid")) {
            result->original_id = read_id(st);
            k = read_keyword(st);
        }

        bool assoc = isa_association(result->type);

        if (strcmp(k, "a"))
            wrong_keyword(k, "a");

        read_role(result->a, assoc, st, k, result);		// updates k
        result->start = BrowserRelation::read_ref(st, k);

        read_keyword(st, "b");

        if (!RelationData::uni_directional(result->type)) {
            read_role(result->b, assoc, st, k, result);	// updates k
            result->end = BrowserRelation::read_ref(st, k);
            // 'end' may be read before 'start' : relation's type was unknown
            result->end->set_name(0);
            result->end->set_name(result->name);
        }
        else {
            k = read_keyword(st);

            if (!strcmp(k, "multiplicity")) {
                result->b.multiplicity = read_string(st);
                k = read_keyword(st);
            }
            else
                result->b.multiplicity = 0;

            if (strcmp(k, "parent"))
                wrong_keyword(k, "parent");

            result->end_removed_from = BrowserClass::read_ref(st);
            result->b.uml_visibility =
                ((BrowserNode *) result->end_removed_from->parent())->get_visibility(UmlRelations);
            connect(result->end_removed_from->get_data(), SIGNAL(deleted()),
                    result, SLOT(end_deleted()));
            result->end = 0;

            // manage old declarations
            switch (result->type) {
            case UmlRealize:
            case UmlGeneralisation:
                if (result->a.cpp_decl == "Generated")
                    result->a.cpp_decl = "${type}";

                if (result->a.java_decl == "Generated")
                    result->a.java_decl = "${type}";

                if (result->a.idl_decl == "Generated")
                    result->a.idl_decl = "${type}";

                break;

            case UmlDependency:
                if (!result->a.cpp_decl.isEmpty()) {
                    if (result->stereotype == "friend")
                        result->a.cpp_decl = "${type}";
                    else if ((result->a.cpp_decl == "Generated") ||
                             (result->a.cpp_decl == "${type}"))
                        result->a.cpp_decl = "#include in header";
                    else if ((result->a.cpp_decl == "#include in source") &&
                             (read_file_format() < 56))
                        IncludeToHeaderIfExternal.append(result);
                }

                break;

            default:
                break;
            }
        }

        k = read_keyword(st);

        AType t;

        if (!strcmp(k, "association_type") ||
            !strcmp(k, "association_explicit_type")) {
            t.read(st, "association_type", "association_explicit_type", k);
            result->set_association(t);
            k = read_keyword(st);
        }

        return result;
    }
    else
        return 0;
}
开发者ID:harmegnies,项目名称:douml,代码行数:101,代码来源:RelationData.cpp

示例13: read_keyword

void AttributeData::read(char *& st, char *& k)
{
    if (!strcmp(k, "class_attribute") ||
        !strcmp(k, "class_attribut")) {
        isa_class_attribute = TRUE;
        k = read_keyword(st);
    }
    else
        isa_class_attribute = FALSE;

    if (!strcmp(k, "volatile")) {
        isa_volatile_attribute = TRUE;
        k = read_keyword(st);
    }
    else
        isa_volatile_attribute = FALSE;

    if (!strcmp(k, "const_attribute") ||
        !strcmp(k, "const_attribut")) {
        isa_const_attribute = TRUE;
        k = read_keyword(st);
    }
    else
        isa_const_attribute = FALSE;

    if (!strcmp(k, "derivedunion")) {
        is_derived = TRUE;
        is_derivedunion = TRUE;
        k = read_keyword(st);
    }
    else if (!strcmp(k, "derived")) {
        is_derived = TRUE;
        is_derivedunion = FALSE;
        k = read_keyword(st);
    }
    else
        is_derived = is_derivedunion = FALSE;

    if (!strcmp(k, "ordered")) {
        is_ordered = TRUE;
        k = read_keyword(st);
    }
    else
        is_ordered = FALSE;

    if (!strcmp(k, "unique")) {
        is_unique = TRUE;
        k = read_keyword(st);
    }
    else
        is_unique = FALSE;

    uml_visibility = ::visibility(k);

    k = read_keyword(st);

    AType t;

    t.read(st, "type", "explicit_type", k);
    set_type(t);

    k = read_keyword(st);

    if (!strcmp(k, "multiplicity")) {
        multiplicity = read_string(st);
        k = read_keyword(st);
    }
    else
        multiplicity = 0;

    if (!strcmp(k, "init_value")) {
        init_value = QString(QTextCodec::codecForName(codec().toLatin1().constData())->fromUnicode(read_string(st)));
//        init_value = read_string(st);
        k = read_keyword(st);
    }
    else
        init_value = QString();

    if (!strcmp(k, "constraint")) {
        constraint = read_string(st);
        k = read_keyword(st);
    }
    else
        constraint = QString();

    BasicData::read(st, k);	// updates k

    if (!strcmp(k, "cpp_volatile")) {
        // old version
        isa_volatile_attribute = TRUE;
        k = read_keyword(st);
    }

    if (!strcmp(k, "cpp_mutable")) {
        cpp_mutable = TRUE;
        k = read_keyword(st);
    }
    else
        cpp_mutable = FALSE;

//.........这里部分代码省略.........
开发者ID:gilbertoca,项目名称:douml,代码行数:101,代码来源:AttributeData.cpp

示例14: isend

	static bool isend(AType &a, IType &it)
	{
		return it == a.arc_end();
	}
开发者ID:gerpe,项目名称:fresdwn,代码行数:4,代码来源:sft_traits.hpp

示例15: end

	static IType end(AType &a)
	{
		return a.arc_end();
	}
开发者ID:gerpe,项目名称:fresdwn,代码行数:4,代码来源:sft_traits.hpp


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