In this article we demonstrate how we pushed xtensor one step further, implementing a dynamic expression system on top of it.

xtensor is a comprehensive C++framework for multi-dimensional array processing, including an extensible expression system, lazy evaluation, broadcasting, and many other features.

It exposes an API similar to that of NumPy covering a growing portion of the functionalities and more, and has acquired significant adoption over the past few years.

Although it allows to write C++ code that looks like NumPy, a major difference is that xtensor is statically typed, meaning the type of the array data is specified at…


Introduction

En France, à partir du 11 mai 2020, le déconfinement sera accompagné de tests massifs des personnes présentant des symptômes du COVID 19. Or, les résultats de ces tests, ainsi que leur efficacité à divers stades de l’épidémie, sont des sujets souvent méconnus ou mal interprétés, par manque d’explication accessible à tous.

Ces tests, considérés comme prématurés en début de pandémie, sont désormais présentés comme une arme efficace pour lutter contre le virus. Cette affirmation peut paraître surprenante, notamment du fait que certains pays ont choisi de tester leur population très tôt. …


It is a great pleasure to announce that the Xeus project has been incorporated as a Jupyter subproject. Xeus will now be subject to the Jupyter governance and code of conduct.

For reference, the Jupyter Enhancement Proposal (JEP) for the Xeus incorporation is available here.

What is Xeus?

The Xeus project is a C++ implementation of the Jupyter kernel protocol. Xeus is not a kernel, but a library meant to facilitate the authoring of kernels.
Several Jupyter kernels have been created with Xeus:

  • xeus-cling, a kernel for the C++ programming language, based on the Cling C++ interpreter. …


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. In this post, we focus on iterators.

In the previous article, we implemented the broadcasting rules so that we can compute the shape of arbitrary complex trees that involve arrays with different but compatible shapes. This is the first step when assigning an expression to an array. The second step is to perform the actual computation and to assign the result. A naive approach would be to generate nested loops that make…


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. This post contains the exhaustive list of the articles of the series.

Part I: A first prototype

  1. N-Dimensional Containers
  2. Access Operators
  3. Constructors
  4. Value Semantics
  5. Expression Templates
  6. Operator Overloading
  7. Broadcasting
  8. Iterators


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. In this post, we focus on broadcasting.

In the previous article, we implemented operator and mathematical function overloads so that we can build arbitrary complex expression trees and access their elements. Before we can assign an expression tree to a xarray object, we need to compute its shape. This is not trivial when the tree is made of expression with different shapes. …


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. In this post, we focus on operator overloading.

In the previous article, we introduced expression templates and developed the skeleton of the xfunction class, meant to represent a node of the abstract syntax tree of a tensor expression. We left aside how the xfunction is passed the types of the operands as well as the way xfunction objects are instantiated. …


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. In this post, we focus on expression templates.

In the previous articles, we started to implement an N-D container, xarray, which has value semantics and provides all the methods required to access its data. The next step is to give it computation capabilities so that it becomes a modelization of a mathematical tensor rather than a simple container.

Traditional operator overloading

The traditional way to give basic computation capabitilities to a class is to overload…


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. In this post, we focus on the value semantics of N-D containers.

In the previous articles, we started to implement an N-D container. We covered the methods related to shape, dimension and layout, we went through the details of the access operator, and eventually, we added convenient constructors. Now is the time to focus on assignment operators and value semantics.

Value Semantics vs Entity Semantics

Value Semantics means you focus more on the values stored in the…


xtensor is a comprehensive framework for N-D arrays processing, including an extensible expression system, lazy evaluation, and many other features that cannot be covered in a single article. In this post, we focus on the contructors of N-D containers.

In the previous article, we detailed the implementation of a generic access operator for our N-D container. Two more things to implement before the xarray class can be used in practice are constructors and assignment operators. In this article, we detail the implementation of the constructors. The next article will focus on assignment operators and value semantics.

Constructors

The goal of a…

Johan Mabille

Scientific computing software engineer at QuantStack, C++ teacher, template metamage

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store