1,426 research outputs found

    Automatic transformation of iterative loops into recursive methods

    Full text link
    NOTICE: this is the author’s version of a work that was accepted for publication in Information and Software Technology. Changes resulting from the publishing process, such as peer review, editing, corrections, structural formatting, and other quality control mechanisms may not be reflected in this document. Changes may have been made to this work since it was submitted for publication. A definitive version was subsequently published in Information and Software Technology, [Volume 58, February 2015, Pages 95–109] DOI 10.1016/j.infsof.2014.10.001[EN] Context In software engineering, taking a good election between recursion and iteration is essential because their efficiency and maintenance are different. In fact, developers often need to transform iteration into recursion (e.g., in debugging, to decompose the call graph into iterations); thus, it is quite surprising that there does not exist a public transformation from loops to recursion that can be used in industrial projects (i.e., it is automatic, it handles all kinds of loops, it considers exceptions, etc.). Objective This article describes an industrial algorithm implemented as a Java library able to automatically transform iterative loops into equivalent recursive methods. The transformation is described for the programming language Java, but it is general enough as to be adapted to many other languages that allow iteration and recursion. Method We describe the changes needed to transform loops of types while/do/for/foreach into recursion. We provide a transformation schema for each kind of loop. Results Our algorithm is the first public transformation that can be used in industrial projects and faces the whole Java language (i.e., it is fully automatic, it handles all kinds of loops, it considers exceptions, it treats the control statements break and continue, it handles loop labels, it is able to transform any number of nested loops, etc.). This is particularly interesting because some of these features are missing in all previous work, probably, due to the complexity that their mixture introduce in the transformation. Conclusion Developers should use a methodology when transforming code, specifically when transforming loops into recursion. This article provides guidelines and algorithms that allow them to face different problems such as exception handling. The implementation has been made publicly available as open source.This work has been partially supported by the EU (FEDER) and the Spanish Ministerio de Economia y Competitividad (Secretaria de Estado de Investigacion, Desarrollo e Innovacion) under Grant TIN2013-44742-C4-1-R and by the Generalitat Valenciana under Grant PROMETEO/2011/052. David Insa was partially supported by the Spanish Ministerio de Educacion under FPU Grant AP2010-4415.Insa Cabrera, D.; Silva, J. (2015). Automatic transformation of iterative loops into recursive methods. Information and Software Technology. 58:95-109. https://doi.org/10.1016/j.infsof.2014.10.001S951095

    Fast recursive matrix multiplication for multi-core architectures

    Get PDF
    AbstractIn this article, we present a fast algorithm for matrix multiplication optimized for recent multicore architectures. The implementation exploits different methodologies from parallel programming, like recursive decomposition, efficient low-level implementations of basic blocks, software prefetching, and task scheduling resulting in a multilevel algorithm with adaptive features. Measurements on different systems and comparisons with GotoBLAS, Intel Math Kernel Library (IMKL), and AMD Core Math Library (AMCL) show that the matrix implementation presented has a very high efficiency

    Pervasive Parallel And Distributed Computing In A Liberal Arts College Curriculum

    Get PDF
    We present a model for incorporating parallel and distributed computing (PDC) throughout an undergraduate CS curriculum. Our curriculum is designed to introduce students early to parallel and distributed computing topics and to expose students to these topics repeatedly in the context of a wide variety of CS courses. The key to our approach is the development of a required intermediate-level course that serves as a introduction to computer systems and parallel computing. It serves as a requirement for every CS major and minor and is a prerequisite to upper-level courses that expand on parallel and distributed computing topics in different contexts. With the addition of this new course, we are able to easily make room in upper-level courses to add and expand parallel and distributed computing topics. The goal of our curricular design is to ensure that every graduating CS major has exposure to parallel and distributed computing, with both a breadth and depth of coverage. Our curriculum is particularly designed for the constraints of a small liberal arts college, however, much of its ideas and its design are applicable to any undergraduate CS curriculum

    A novel paradigm for testing the initial coding of hierarchical relationships within the medial temporal lobe in a circuit specific manner

    Get PDF
    The Medial Temporal Lobe (MTL) is central to spatial navigation and to the processing of conceptual associations, functions which can be implemented via the grid cell system. Evidence exists that also hierarchical processing - an integral part of cognitive capacities such as language, motor action and sequential planning - draws on the MTL. This raises the question of whether hierarchical processing shares the same cellular substrate with spatial navigation and concept association formation. Here we present two novel tasks (hierarchy and control) specifically designed to test (using fMRI) whether grid cells also support the representation of hierarchical relations. We present the first results of their behavioral validation with respect to specificity, and show that our hierarchical task, but not the control task, correlates well with other tasks that necessitate hierarchical processing (Tower of Hanoi and a Visual Recursion Task). Furthermore, we show that some of these effects remain even when removing the shared variance that can be explained by a range of unspecific factors. This gives reason to believe that our task is a valid method for probing the relationship between grid cells and hierarchical processing
    • …
    corecore