首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 0 毫秒
1.
Generic programming with C++ templates results in efficient but inflexible code: efficient, because the exact types of inputs to generic functions are known at compile time; inflexible because they must be known at compile time. We show how to achieve run-time polymorphism without compromising performance by instantiating the generic algorithm with a comprehensive set of possible parameter types, and choosing the appropriate instantiation at run time. Applying this approach naïvely can result in excessive template bloat: a large number of template instantiations, many of which are identical at the assembly level. We show practical examples of this approach quickly approaching the limits of the compiler. Consequently, we combine this method of run-time polymorphism for generic programming, with a strategy for reducing the number of necessary template instantiations. We report on using our approach in GIL, Adobe’s open source Generic Image Library. We observed a notable reduction, up to 70% at times, in executable sizes of our test programs. This was the case even with compilers that perform aggressive template hoisting at the compiler level, due to significantly smaller dispatching code. The framework draws from both the generic and generative programming paradigms, using static metaprogramming to fine tune the compilation of a generic library. Our test bed, GIL, is deployed in a real world industrial setting, where code size is often an important factor.  相似文献   

2.
最优化设计的程序实现方法决定了优化算法的执行效率及代码可读性,进而影响到优化设计在工程中的应用前景.最优化设计算法中常涉及到复杂的矩阵运算.通过分析比较几类实现矩阵运算的常用方法的优缺点,提出了基于C 表达式模板的最优化设计程序实现方法.最后,以DFP变尺度优化程序为实例,从程序可读性及执行效率上将几类方法进行了对比.结果表明,基于C 表达式模板实现的最优化设计程序在保证程序执行效率的基础上,能够提高程序的可重用性及可读性.  相似文献   

3.
Class templates represent a difficulty for C++ garbage collectors since relevant information is available only very late, at instantiation time. Current collectors therefore either fail to work with class templates or have to run in a non‐optimized mode. This paper introduces the template garbage collector (TGC), the first mostly‐copying collector that can handle class templates. It discusses the design decisions that are suggested by the specifics of generic template programming and presents performance results and memory measurements of tests with MTL and GTL, two generic C++ libraries based on the Standard Template Library. The tests show that TGC substantially improves the run times of programs with many small objects with short lifetimes or large objects with long lifetimes. The memory usage at the same time is reasonable. Since TGC modifies the mostly‐copying technique, the heap sizes are in many cases considerably smaller than they are for traditional mostly‐copying collectors. The tests also show that TGC is competitive with the Boehm–Demers–Weiser collector, the most widely used collector for C++. Copyright © 2001 John Wiley & Sons, Ltd.  相似文献   

4.
Template decomposition techniques can be useful for improving the efficiency of imageprocessing algorithms. The improved efficiency can be realized either by reorganizing a computation to fit a specialized structure, such as an image-processing pipeline, or by reducing the number of operations used. In this paper two techniques are described for decomposing templates into sequences of 3×3 templates with respect to gray-scale morphological operations. Both techniques use linear programming and are guaranteed to find a decomposition of one exists.This work was supported in part by the U.S. Air Force Armament Laboratory of Eglin Air Force Base under contract F08635-89-C-0134.  相似文献   

5.
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.  相似文献   

6.
A key benefit of generic programming is its support for producing modules with clean separation. In particular, generic algorithms are written to work with a wide variety of types without requiring modifications to them. The Runtime concept idiom extends this support by allowing unmodified concrete types to behave in a runtime polymorphic manner. In this paper, we describe one implementation of the runtime concept idiom, in the domain of the C++ standard template library (STL). We complement the runtime concept idiom with an algorithm library that considers both type and concept information to maximize performance when selecting algorithm implementations. We present two implementations, one in ISO C++ and one using an experimental language extension. We use our implementations to describe and measure the performance of runtime-polymorphic analogs of several STL algorithms. The tests demonstrate the effects of different compile-time vs. run-time algorithm selection choices.  相似文献   

7.
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.  相似文献   

8.
《国际计算机数学杂志》2012,89(10):2024-2038
ABSTRACT

In many research literatures, the dynamical behaviour of cellular neural networks (CNNs) is simplified by using cloning template. However, the flaws of cloning template are obvious, because the correlation between weights of cells in CNNs is enhanced. In order to overcome the shortcomings of cloning template, value-varying templates can be used in CNNs. In this paper, associative memories based on CNNs with value-varying templates are investigated. A criterion about stability of CNNs is presented. Then, the problem about obtaining parameters of CNNs can be translated into a problem of solving linear equations for each cell. A design procedure of associative memories is given by our theories and methods. From the procedure, the parameters of CNNs can be obtained. Finally, three examples are used to demonstrate the effectiveness of our theories and methods. And the results show that success rate of associative memories is higher than previous methods.  相似文献   

9.
文章针对合肥市农业休闲观光园景观现状进行思考,提出了依托当地特色农业产业,构筑独有的多维度景观空间景观,树立特色休闲观光农业旅游品牌的特色农业观光园景观设计对策,并将其运用于特色农业休闲观光园的建设中,并以合肥肥西老母鸡家园的设计实例证明该对策的有效性。  相似文献   

10.
Palmprint identification system commonly stores multiple templates for each subject to improve the identification accuracy. The system then recognizes a query palmprint image by searching for its nearest neighbor from all of the templates. When applied on moderate or large scale identification system, it is often necessary to speed up this process. In this paper, to speed up the identification process, we propose to utilize the intrinsic characteristics of the templates of each subject to build a tree, and then perform fast nearest neighbor searching with assistance of the tree structure. Furthermore, we propose a novel method to generate the ‘virtual’ template from all the real templates of each subject. The tree constructed by the virtual template and the real templates can further speed up the identification process. Two representative coding-based methods, competitive code and ordinal code, are adopted to demonstrate the effectiveness of our proposed strategies. Using the Hong Kong PolyU palmprint database (version 2) and a large scale palmprint database, our experimental results show that the proposed method searches for nearest neighbors faster than brute force searching, and the speedup becomes larger when there are more templates per subject in the database. Results also show that our method is very promising for embedded system based moderate scale and PC based large scale identification systems.  相似文献   

11.
传统基于表达式树ET的基因评估从性能角度讲主要缺点是:重复遍历表达式树和进行大量重复计算。提出基于Scale的基因评估。变量矩阵用来避免基因评估中的重复计算。实验表明,在绝大多数数据分布下和参数选择情况下:基于Scale的基因评估较基于 ET 的基因评估快 3~5 倍。  相似文献   

12.
表情特征提取是面部表情识别的一个关键步骤。针对目前特征提取效率低的情况,通过分析Gabor特征提取的性质和积分图像计算效率高的特点,提出一种利用积分图像技术和矩形模板计算面部特征点特征的方法,模板模拟Gabor的多尺度性,每个模板定义相应的权值,表情图像按照Gabor的各个方向旋转,使用旋转图像积分图和加权模板而不是在积分图上旋转模板提取特征点的特征值,最后将此特征值用于表情分类。实验结果表明,该方法在识别结果相当的情况下极大地提高了特征提取的效率。  相似文献   

13.
There has been considerable interest in predicting the properties of nitro‐energetic materials to improve their performance. Not to mention insightful physical knowledge, computational‐aided molecular studies can expedite the synthesis of novel energetic materials through cost reduction labours and risky experimental tests. In this paper, quantitative structure–property relationship based on multi‐expression programming employed to correlate the formation enthalpies of frequently used nitro‐energetic materials with their molecular properties. The simple yet accurate obtained model is able to correlate the formation enthalpies of nitro‐energetic materials to their molecular structure with the accuracy comparable to experimental precision.  相似文献   

14.
In object programming languages, the Visitor design pattern allows separation of algorithms and data structures. When applying this pattern to tree‐like structures, programmers are always confronted with the difficulty of making their code evolve. One reason is that the code implementing the algorithm is interwound with the code implementing the traversal inside the visitor. When implementing algorithms such as data analyses or transformations, encoding the traversal directly into the algorithm turns out to be cumbersome as this type of algorithm only focuses on a small part of the data‐structure model (e.g., program optimization). Unfortunately, typed programming languages like Java do not offer simple solutions for expressing generic traversals. Rewrite‐based languages like ELAN or Stratego have introduced the notion of strategies to express both generic traversal and rule application control in a declarative way. Starting from this approach, our goal was to make the notion of strategic programming available in a widely used language such as Java and thus to offer generic traversals in typed Java structures. In this paper, we present the strategy language SL that provides programming support for strategies in Java. Copyright © 2012 John Wiley & Sons, Ltd.  相似文献   

15.
基于基因表达式编程挖掘中医方证关系   总被引:6,自引:0,他引:6  
为解决中医方-证关系的函数挖掘的特殊困难,提出了基于基因表达式编程的新方法。针对中医学方证数据的特点提出结构简单、高效,占用空间少的主次分离指针编码。提出基于罚函数的单方适应度值计算和基于相似度的中医学症状组平均相似度函数,实现了基于基因表达式的方证关系函数发现算法MRAGEP,获得了一个方证函数,不但有很好的精度, 而且符合中医主次证原理,可解释性好。实验证明了算法的正确性和有效性,正确率达到了62.5%。  相似文献   

16.
In C++, multi‐dimensional arrays are often used but the language provides limited native support for them. The language, in its Standard Library, supplies sophisticated interfaces for manipulating sequential data, but relies on its bare‐bones C heritage for arrays. The MultiArray library, a part of the Boost library collection, enhances a C++ programmer's tool set with versatile multi‐dimensional array abstractions. It includes a general array class template and native array adaptors that support idiomatic array operations and interoperate with C++ Standard Library containers and algorithms. The arrays share a common interface, expressed as a generic programming concept, in terms of which generic array algorithms can be implemented. We present the library design, introduce a generic interface for array programming, demonstrate how the arrays integrate with the C++ Standard Library, and discuss the essential aspects of their implementation. Copyright © 2004 John Wiley & Sons, Ltd.  相似文献   

17.
对新兴的基因表达式编程算法在国内外的理论研究现状进行了系统的研究,剖析了GEP的基本原理和特点,并对国内外关于GEP理论和算法的研究现状进行系统的讨论,最后根据笔者的见解探讨了未来研究的重点方向。  相似文献   

18.
多表达式程序设计(MEP)是应用十分广泛的自动程序设计方法。从MEP的染色体表示规则及种群演化方式来看,每个染色体中的任何基因都有可能多次被当前或其它后续种群中的其他基因引用,从而造成重复计算,耗费大量时空资源。由此提出并实现了一种新型评估方法,该新型评估方法在不改变传统MEP的染色体表示规则和种群演化方式的情况下,能够准确有效地识别演化过程中所有被重复引用的基因,从而避免了大量重复计算,显著提高了演化效率。  相似文献   

19.
This paper presents an original approach to designing social media that support informal learning in the digital workplace. It adapts design‐based research to take into account the embeddedness of interactions within digitally mediated work‐based contexts. The approach is demonstrated through the design, implementation, and evaluation of software tools supporting a particular type of informal learning called knowledge maturing. The paper: introduces and presents the rationale for, and concept of, knowledge maturing; presents a new design methodology for developing social media that support informal learning and knowledge maturing; focuses on one prototype, for ‘people tagging for organisational development’, that was produced by the methodology (and concisely describes two others); presents the formative evaluation of the highlighted prototype; and finally, discusses the implications and insights arising from this work.  相似文献   

20.
The standardized sizes used in the garment industry do not cover the range of individual differences in body shape for most people, leading to ill-fitting clothes, high return rates and overproduction. Recent research efforts in both industry and academia, therefore, focus on virtual try-on and on-demand fabrication of individually fitting garments. We propose an interactive design tool for creating custom-fit garments based on 3D body scans of the intended wearer. Our method explicitly incorporates transitions between various body poses to ensure a better fit and freedom of movement. The core of our method focuses on tools to create a 3D garment shape directly on an avatar without an underlying sewing pattern, and on the adjustment of that garment's rest shape while interpolating and moving through the different input poses. We alternate between cloth simulation and rest shape adjustment based on stretch to achieve the final shape of the garment. At any step in the real-time process, we allow for interactive changes to the garment. Once the garment shape is finalized for production, established techniques can be used to parameterize it into a 2D sewing pattern or transform it into a knitting pattern.  相似文献   

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

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