首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 15 毫秒
1.
This article discusses an efficient implementation of tensors of arbitrary rank by using some of the idioms introduced by the recently published C++ ISO Standard (C++11). With the aims at providing a basic building block for high-performance computing, a single Array class template is carefully crafted, from which vectors, matrices, and even higher-order tensors can be created. An expression template facility is also built around the array class template to provide convenient mathematical syntax. As a result, by using templates, an extra high-level layer is added to the C++ language when dealing with algebraic objects and their operations, without compromising performance. The implementation is tested running on both CPU and GPU.  相似文献   

2.
    
This paper introduces NiHu, a C++ template library for boundary element methods (BEM). The library is capable of computing the coefficients of discretised boundary integral operators in a generic way with arbitrarily defined kernels and function spaces. NiHu’s template core defines the workflow of a general BEM algorithm independent of the specific application. The core provides expressive syntax, based on the operator notation of the BEM, reflecting the mathematics behind boundary elements in the C++ source code. The customisable Component library contains elements specific to particular applications such as different numerical integration techniques and regularisation methods. The library can be used for creating a standalone C++ application using external open source libraries, or compiling a Matlab toolbox through the MEX interface. By massively exploiting C++ template metaprogramming, NiHu generates optimised codes for specific applications, including heterogeneous problems. The paper introduces the main concepts of the novel development, demonstrates its versatility and flexibility and compares the implementation’s performance to that of other open source projects.  相似文献   

3.
C++程序设计课程是大学计算机基础教学系列的核心课程之一。针对目前教学过程中学生应用C++语言解决实际问题的能力较差的现状,分析导致学生实际编程能力差的原因和教学方法的不足,围绕提高学生编程能力,提出了程序调试、错误案例分类与设计等教学方法。教学实践效果表明该教学方法明显增强了学生学习C++程序设计的兴趣,并大大提高了学生的实际编程能力。  相似文献   

4.
Code bloat, one of the main issues of genetic programming (GP), slows down the search process, destroys program structures, and exhausts computer resources. To deal with these issues, two kinds of neutral offspring controlling operators are proposed—non-neutral offspring (NNO) operators and non-larger neutral offspring (NLNO) operators. Two GP benchmark problems—symbolic regression and 11-multiplexer—are used to test the new operators. Experimental results indicate that NLNO is able to confine code bloat significantly and improve performance simultaneously, which NNO cannot do.  相似文献   

5.
Generic programming is an effective methodology for developing reusable software libraries. Many programming languages provide generics and have features for describing interfaces, but none completely support the idioms used in generic programming. To address this need we developed the language G. The central feature of G is the concept, a mechanism for organizing constraints on generics that is inspired by the needs of modern C++ libraries. G provides modular type checking and separate compilation (even of generics). These characteristics support modular software development, especially the smooth integration of independently developed components. In this article we present the rationale for the design of G and demonstrate the expressiveness of G with two case studies: porting the Standard Template Library and the Boost Graph Library from C++ to G. The design of G shares much in common with the concept extension proposed for the next C++ Standard (the authors participated in its design) but there are important differences described in this article.  相似文献   

6.
This paper presents an object-oriented architecture, called the Model-View-Shape (MVS) architecture, for constructing an Integrated Visual Programming Environment (IVPE), whose constituent tools deal with (fine-grained) language semantics, as well as a mass of graphics-drawing activities. This architecture enforces a layered and loosely-coupled structure, so that the user-interface part of components may be more independent, maintainable, and reusable than those proposed in the original model-view-controller architecture. An MVS class hierarchy, systematically constructed using C++, can be reused and extended with new semantics to rapidly develop new tools for an existing IVPE, or even an IVPE supporting more than one language. The present editors developed can be used to construct programs by specifying the associated flow information in explicit (visual) or implicit (textual) ways, while the (incremental) flow analysers can help analyse incomplete program fragments to locate and inform the user of possible errors or anomalies during programming. © 1998 John Wiley & Sons, Ltd.  相似文献   

7.
Generic programming has been defined as ‘programming with concepts’ where a concept refers to a family of abstractions. The criteria for generic programming include independence of collections from data types, independence of algorithms that operate on the collection, and the adaptability of the collections. This paper examines and evaluates the support for generic programming in the Java Development Kit (JDK) in comparison to C++'s Standard Template Library (STL). The evaluation will consider both the ‘qualitative’ factors as well as certain ‘quantitative’ factors (i.e. factors that can be measured). The qualitative factors that are considered include: 1. a comparison of the structure and APIs; 2. homogeneity versus heterogeneity; and 3. ease of use (including ease of converting to collection classes, ease of changing collection type, and ease of error handling). The quantitative factors include: 1. compiled size; 2. runtime memory usage; and 3. performance. The results of our evaluative comparisons based on the above factors and certain other criteria are presented at the end. Based on the results, we conclude that the support provided for generic programming in C++'s STL is superior to that provided by JDK. Copyright © 2003 John Wiley & Sons, Ltd.  相似文献   

8.
In this paper we propose a new generic scheme CFLP풟, intended as a logical and semantic framework for lazy Constraint Functional Logic Programming over a parametrically given constraint domain 풟. As in the case of the well known CLP풟 scheme for Constraint Logic Programming, 풟 is assumed to provide domain specific data values and constraints. CFLP풟 programs are presented as sets of constrained rewrite rules that define the behavior of possibly higher order and/or non-deterministic lazy functions over 풟. As a main novelty w.r.t. previous related work, we present a Constraint Rewriting Logic CRWL풟 which provides a declarative semantics for CFLP풟 programs. This logic relies on a new formalization of constraint domains and program interpretations, which allows a flexible combination of domain specific data values and user defined data constructors, as well as a functional view of constraints. This research has been partially supported by the Spanish National Projects MELODIAS (TIC2002-01167), MERIT-FORMS (TIN2005-09207-C03-03) and PROMESAS-CAM (S-0505/TIC/0407).  相似文献   

9.
Bruno Bachelet  Loïc Yon 《Software》2017,47(11):1521-1537
Concepts are likely to be introduced in a future C++ standard. They can be used for constraining template parameters, which enables checking requirements on template parameters sooner in the compilation process, and thus providing more intelligible error messages to the user. They can also be used in the specialization of templates, thus leading to a better control over the selection of the most appropriate version of a template for a given instantiation. This latter aspect offers new possibilities in the design of template libraries, as it enhances the specialization mechanism of templates, and set it up as a solid alternative to inheritance when static binding can replace dynamic binding. This article addresses the design of expression templates (i.e., templates that represent expressions and are usually built through operator overloading) that are useful to develop an embedded domain specific language (EDSL), and can speed up the evaluation of an expression by delaying the evaluation of intermediate operations to avoid unnecessary temporary objects. We propose to use concept‐based template specialization to parse expression templates in order to ease the design of an EDSL. This approach is a static variant of the well‐known visitor design pattern that replaces the overridden methods in the double dispatch of the original design pattern by template specializations based on concepts. An example of EDSL for linear programming developed with our solution demonstrates that a concept‐based design helps producing concise and reliable code. Copyright © 2017 John Wiley & Sons, Ltd.  相似文献   

10.
Bloat is an excess of code growth without a corresponding improvement in fitness. This is a serious problem in Genetic Programming, often leading to the stagnation of the evolutionary process. Here we provide an extensive review of all the past and current theories regarding why bloat occurs. After more than 15 years of intense research, recent work is shedding new light on what may be the real reasons for the bloat phenomenon. We then introduce Dynamic Limits, our new approach to bloat control. It implements a dynamic limit that can be raised or lowered, depending on the best solution found so far, and can be applied either to the depth or size of the programs being evolved. Four problems were used as a benchmark to study the efficiency of Dynamic Limits. The quality of the results is highly dependent on the type of limit used: depth or size. The depth variants performed very well across the set of problems studied, achieving similar fitness to the baseline technique while using significantly smaller trees. Unlike many other methods available so far, Dynamic Limits does not require specific genetic operators, modifications in fitness evaluation or different selection schemes, nor does it add any parameters to the search process. Furthermore, its implementation is simple and its efficiency does not rely on the usage of a static upper limit. The results are discussed in the context of the newest bloat theory.
Sara SilvaEmail:
  相似文献   

11.
Development of integrated programming environments has faced two problems: response degression, with an incresing execution delay when more tools have been included in an environment, and poor extensibility, with difficulties in adding new tools to an environment. Framework of a multitasking C++ based programming environment MCPE has been presented here for solving these problems. MCPE contains several concurrent tasks (processes): one of them is interacting with the user and the others are simultaneously doing their jobs. Process scheduling and concurrency control in MCPE have been carefully designed: response time is then reduced, and unnecessary computations are avoided. An event-driven serving model providing flexible task communications eases the addition of tools. Shared data stores have been defined as monitor types with no nested monitor calls in preventing deadlock. Consistency among the tasks has also been assured. A prototype has also been presented to show feasibility.  相似文献   

12.
    
Model-based development (MBD) holds the promise to capture potential timing problems in embedded software during the early phases of the development, securing the production of bug-free embedded software. For most MBD approaches, the source code is just an intermediate artifact that can be generated automatically from the models. This assumption clashes with an undeniable fact: a large share of the commercial embedded software exploits existing libraries or is developed using C/C++ natively. A way to reconcile the ambitions of MBD with the use of a programming language is by offering new language constructs and an innovative compilation tool-chain that prevents model error and timing problems “by construction.” However, the persistent popularity of C/C++ among embedded programmers and the limited availability of tools have severely limited the uptake of alternative programming languages for embedded software. Therefore, we propose an original route. Our language proposal, named Tice, has been shaped as a C++ active library. Tice retains full compatibility with existing C++ code, which can be integrated easily into new Tice-based projects. The enforcement of Tice syntax and semantics can be made by a standard C++ compiler, forgoing the need for new tools. In this article, we describe Tice's syntax, semantics, and model of computation and communication. We demonstrate Tice's practical applicability on an industrial scale use-case and give ample evidence for Tice's efficient compilation using off-the-shelf C++ compilers. Finally, we show Tice's code generation process.  相似文献   

13.
Support for generic programming consists of three essential ingredients: support for overloaded functions, a run-time type representation, and a generic view on data. Different approaches to datatype-generic programming occupy different points in this design space. In this article, we revisit the “Scrap your boilerplate” approach and identify its location within the three-dimensional design space. The characteristic features of “Scrap your boilerplate” are its two generic views, the ‘spine’ view for consuming and transforming data, and the ‘type-spine’ view for producing data. We show how to combine these views with different overloading mechanisms and type representations.  相似文献   

14.
Type systems built directly into the compiler or interpreter of a programming language cannot be easily extended to keep track of run-time invariants of new abstractions. Yet, programming with domain-specific abstractions could benefit from additional static checking. This paper presents library techniques for extending the type system of C++ to support domain-specific abstractions. The main contribution is a programmable “subtype” relation. As a demonstration of the techniques, we implement a type system for defining type qualifiers in C++, as well as a type system for the XML processing language, capable of, e.g., statically guaranteeing that a program only produces valid XML documents according to a given XML schema.  相似文献   

15.
The implementation of a hierarchical, process-oriented programming language for simulation (HSL) is described. It features a hybrid approach, involving the front end of a compiler and the back end of an interpreter. An HSL program is dichotomous in structure. Source statements from each part are translated into three-address code for an abstract machine, and the resulting code is then interpreted. The algorithms and the supportive data structures that effect the translation and interpretation of HSL are detailed. The host language for HSL is C++. HSL is machine independent and can be ported to any machine on which the host language is available. Its initial implementation was carried out on an NCR Tower. More recently, it was transferred to an NCR PC916.  相似文献   

16.
可视化技术能在计算模拟中提供可观察的直观图像,是分析和研究模拟现象的重要手段。本文运用C 的范型编程思想,将OpenGL的实时3D显示功能集成在一个封闭的类模板中,使其通用化,克服了直接调用OpenGL函数导致的程序结构不清晰和代码可复用性差的缺点,大大简化了计算模拟中实现可视化的方法步骤。  相似文献   

17.
We use multi-stage programming, monads and Ocaml’s advanced module system to demonstrate how to eliminate all abstraction overhead from generic programs, while avoiding any inspection of the resulting code. We demonstrate this clearly with Gaussian Elimination as a representative family of symbolic and numeric algorithms. We parameterize our code to a great extent-over domain, input and permutation matrix representations, determinant and rank tracking, pivoting policies, result types, etc.-at no run-time cost. Because the resulting code is generated just right and not changed afterward, MetaOCaml guarantees that the generated code is well-typed. We further demonstrate that various abstraction parameters (aspects) can be made orthogonal and compositional, even in the presence of name-generation for temporaries, and “interleaving” of aspects. We also show how to encode some domain-specific knowledge so that “clearly wrong” compositions can be rejected at or before generation time, rather than during the compilation or running of the generated code.  相似文献   

18.
设计模式和泛型技术在系统重构中的应用研究   总被引:1,自引:0,他引:1  
重构是在不改变代码外在行为的前提下,对代码做出修改,以改进程序内部结构的过程.设计模式是对被用来在特定场景下解决一般设计问题的类和相互通信的对象的描述.泛型编程专注于将型别抽象化,形成功能需求方面的一个精细集合,并利用这些需求来实现算法.以一个应用系统的数据采集子系统的系统重构为例,将设计模式应用于系统重构中设计阶段,将泛型技术应用于系统重构实现阶段;讨论设计模式技术和泛型技术的结合对系统重构的作用与意义.  相似文献   

19.
骆锐  郑军 《计算机工程》1999,25(9):103-103,F003
系统介绍C++Builder4.0和OpenGL在用户图形界面和三维图形技术方面的功能和作用,并为它们的混合编程提供一个基本的框架。  相似文献   

20.
In this paper, we propose a dense stereo algorithm based on the census transform and improved dynamic programming (DP). Traditional scanline-based DP algorithms are the most efficient ones among global algorithms, but are well-known to be affected by the streak effect. To solve this problem, we improve the traditional three-state DP algorithm by taking advantage of an extended version of sequential vertical consistency constraint. Using this method, we increase the accuracy of the disparity map greatly. Optimizations have been made so that the computational cost is only increased by about 20%, and the additional memory needed for the improvement is negligible. Experimental results show that our algorithm outperforms many state-of-the-art algorithms with similar efficiency on Middlebury College’s stereo Web site. Besides, the algorithm is robust enough for image pairs with utterly different contrasts by using of census transform as the basic match metric.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号