21 research outputs found

    Matrices as arrows! A biproduct approach to typed linear algebra

    Get PDF
    Motivated by the need to formalize generation of fast running code for linear algebra applications, we show how an index-free, calculational approach to matrix algebra can be developed by regarding matrices as morphisms of a category with biproducts. This shifts the traditional view of matrices as indexed structures to a type-level perspective analogous to that of the pointfree algebra of programming. The derivation of fusion, cancellation and abide laws from the biproduct equations makes it easy to calculate algorithms implementing matrix multiplication, the kernel operation of matrix algebra, ranging from its divide-and-conquer version to the conventional, iterative one. From errant attempts to learn how particular products and coproducts emerge from biproducts, we not only rediscovered block-wise matrix com- binators but also found a way of addressing other operations calculation- ally such as e.g. Gaussian elimination. A strategy for addressing vector- ization along the same lines is also given.FCT, Mondrian Project funded by contract PTDC/EIA-CCO/108302/2008

    Towards a linear algebra of programming

    Get PDF
    The Algebra of Programming (AoP) is a discipline for programming from specifications using relation algebra. Specification vagueness and nondeterminism are captured by relations. (Final) implemen- tations are functions. Probabilistic functions are half way between relations and functions: they express the propensity, or like- lihood of ambiguous, multiple outputs. This paper puts forward a basis for a Linear Algebra of Programming (LAoP) extending standard AoP towards probabilistic functions. Because of the quantitative essence of these functions, the allegory of binary relations which supports the AoP has to be extended. We show that, if one restricts to discrete probability spaces, categories of matrices provide adequate support for the extension, while preserving the pointfree reasoning style typical of the AoP.Fundação para a Ciência e a Tecnologia (FCT

    Calculating fault propagation in functional programs

    Get PDF
    Techn. Report TR-HASLab:01:2013The production of safety critical software is bound to a number of safety and certification standards in which estimating the risk of failure plays a central role. Yet risk estimation seems to live outside most programmers’ core practice, involving simulation techniques and worst case analysis performed a posteriori. In this paper we propose that risk be constructively handled in functional programming by writing programs which choose between expected and faulty be- haviour and by reasoning about them in a linear algebra extension to the standard algebra of programming. In particular, the paper calculates propagation of faults across standard program transformation techniques known as tupling and fusion, enabling the fault of the whole to be expressed in terms of the faults of its parts.Fundação para a Ciência e a Tecnologia (FCT

    Typing linear algebra : a biproduct-oriented approach

    Get PDF
    Interested in formalizing the generation of fast running code for linear algebra applications, the authors show how an index-free, calculational approach to matrix algebra can be developed by regarding matrices as morphisms of a category with biproducts. This shifts the traditional view of matrices as indexed structures to a type-level perspective analogous to that of the pointfree algebra of programming. The derivation of fusion, cancellation and abide laws from the biproduct equations makes it easy to calculate algorithms implementing matrix multiplication, the central operation of matrix algebra, ranging from its divide-and-conquer version to its vectorization implementation. From errant attempts to learn how particular products and coproducts emerge from biproducts, not only blocked matrix algebra is rediscovered but also a way of extending other operations (e.g. Gaussian elimination) blockwise, in a calculational style, is found. The prospect of building biproduct-based type checkers for computer algebra systems such as MatlabTM is also considered.Fundação para a Ciência e a Tecnologia (FCT

    Typed linear algebra for weighted (probabilistic) automata

    Get PDF
    There is a need for a language able to reconcile the recent upsurge of interest in quantitative methods in the software sciences with logic and set theory that have been used for so many years in capturing the qualitative aspects of the same body of knowledge. Such a lingua franca should be typed, polymorphic, diagrammatic, calculational and easy to blend with traditional notation. This paper puts forward typed linear algebra (LA) as a candidate notation for such a role. Typed LA emerges from regarding matrices as morphisms of suitable categories whereby traditional linear algebra is equipped with a type system. In this paper we show typed LA at work in describing weighted (prob- abilistic) automata. Some attention is paid to the interface between the index-free language of matrix combinators and the corresponding index- wise notation, so as to blend with traditional set theoretic notation.Fundação para a Ciência e a Tecnologia (FCT

    Analytical querying with typed linear algebra: integration with MonetDB

    Get PDF
    Dissertação de mestrado integrado em Informatics EngineeringCurrent digital transformations in society heavily rely on safe, easy-to-use, high-performance data storage and analysis for smart decision taking. This triggered the need for efficient analytical querying solutions and the columnar database model is increasingly regarded as the most efficient model for data organization in large data banks. MonetDB is a pioneer in the column-wise database model and is currently at the forefront of high performance DBMS engine. A Linear Algebra Querying (LAQ) engine, using a columnar database paradigm and strongly inspired on Typed Linear Algebra (TLA), was developed in a former MSc. dissertation, with a prototype Web interface. Performance benchmarking of this engine showed it outperformed conventional referenced DBMS but it failed to beat MonetDB’s performance. This dissertation aims to improve the performance of the LAQ engine by following a different path: instead of a standalone engine, the new approach implements the engine on top of MonetDB extended with RMA (Relational Matrix Algebra) and inspired by the TLA approach. This enables the use of LAQ scripting to replace the main stream relational algebra query language approach given by SQL. Matrix operations commonly used in LAQ/TLA, such as matrix-matrix multiplication, Khatri-Rao product or Hadamard-Schur product, had to be implemented in RMA to shift from the relational algebra paradigm to TLA. A thorough analysis of the MonetDB/RMA showed the need to implement key TLA operators that are not available at the frontend. Such operators were implemented and successfully tested and validated, paving the way to future benchmarking its performance with TPC-H/OLAP queries and consequent fine tuning of the engine.Atualmente, as transformações digitais na sociedade confiam fortemente no armazenamento e na análise de dados seguros, fáceis de usar e de alto desempenho para tomadas de decisão inteligentes. Este facto desencadeou a necessidade de soluções de consultas analíticas eficientes, em que o modelo de bases de dados colunar é cada vez mais considerado o modelo mais eficiente para organização de dados em grandes bancos de dados. MonetDB é um sistema pioneiro no modelo de bases de dados colunar e atualmente está na vanguarda de DBMS’s de alto desempenho. Um motor Linear Algebra Querying (LAQ), que usa o paradigma de bases de dados colunar e fortemente inspirado em Álgebra Linear Tipada (TLA), foi desenvolvido numa antiga dissertação de mestrado em Engenharia Informática. O benchmarking do desempenho deste motor mostrou que supera DBMS tradicionais, mas não conseguiu superar o desempenho do MonetDB. Esta dissertação visa melhorar o desempenho do motor LAQ seguindo um caminho diferente: em vez de um motor autónomo, a nova abordagem implementa o motor sobre o motor do MonetDB estendido com RMA (Álgebra Relacional Matricial) e inspirado na abordagem de TLA. Isto permite o uso de scripts LAQ para substituir a abordagem da linguagem de consulta de álgebra relacional fornecida pelo SQL. Operações de matrizes comumente usadas em LAQ / TLA, como multiplicação de matrizes, produto Khatri-Rao ou produto Hadamard-Schur, tiveram de ser implementadas em RMA para mudar do paradigma da álgebra relacional para TLA. Uma análise completa do MonetDB / RMA mostrou a necessidade de implementar os principais operadores de TLA que não estão disponíveis no front-end. Esses operadores foram implementados, testados e validados com sucesso, abrindo caminho para um futuro benchmarking do seu desempenho com queries TPC-H / OLAP e consequente, ajuste do motor

    Weighted automata as coalgebras in categories of matrices

    Get PDF
    The evolution from non-deterministic to weighted automata represents a shift from qual- itative to quantitative methods in computer science. The trend calls for a language able to reconcile quantitative reasoning with formal logic and set theory, which have for so many years supported qualitative reasoning. Such a lingua franca should be typed, poly- morphic, diagrammatic, calculational and easy to blend with conventional notation. This paper puts forward typed linear algebra as a candidate notation for such a unifying role. This notation, which emerges from regarding matrices as morphisms of suitable categories, is put at work in describing weighted automata as coalgebras in such categories. Some attention is paid to the interface between the index-free (categorial) language of matrix algebra and the corresponding index-wise, set-theoretic notation.Fundação para a Ciência e a Tecnologia (FCT
    corecore