Multi-dimensional arrays with broadcasting and lazy computing.

# Introduction

xtensor is a C++ library meant for numerical analysis with multi-dimensional array expressions.

xtensor provides

- an extensible expression system enabling lazy broadcasting.
- an API following the idioms of the C++ standard library.
- tools to manipulate array expressions and build upon xtensor.

Containers of xtensor are inspired by NumPy, the Python array programming library. Adaptors for existing data structures to be plugged into our expression system can easily be written. In fact, xtensor can be used to process numpy data structures inplace using Python’s buffer protocol. For more details on the numpy bindings, check out the xtensor-python project.

xtensor requires a modern C++ compiler supporting C++14. The following C++ compilers are supported:

- On Windows platforms, Visual C++ 2015 Update 2, or more recent
- On Unix platforms, gcc 4.9 or a recent version of Clang

# Licensing

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.

INSTALLATION

- Installation
  - Using the conda package
  - Using the Debian package
  - From source with cmake

USAGE

- Basic usage
- Expressions and lazy evaluation
  - Expressions
  - Lazy evaluation
  - Forcing evaluation
  - Broadcasting
  - Expression interface
- Arrays and tensors
  - Internal memory layout
  - Runtime vs Compile-time dimensionality
  - Performance
  - Aliasing and temporaries
- Operators and functions
  - Arithmetic operators
  - Logical operators
  - Comparison operators
  - Mathematical functions
  - Reducers
  - Universal functions and vectorization
- Views
  - Sliced views
  - Index views
  - Filter views
  - Filtration
  - Broadcasting views
  - Complex views
- Expression builders
  - Ones and zeros
  - Numerical ranges
  - Joining expressions
  - Random distributions
  - Meshes
- Missing values
  - Optional expressions
  - Operating on missing values
  - Handling expressions with missing values

API REFERENCE

- Expressions and semantic
  - xexpression
  - xsemantic_base
  - xcontainer_semantic
  - xadaptor_semantic
  - xview_semantic
  - xeval
- Containers and views
  - layout
  - xcontainer
  - xstrided_container
  - xiterable
  - xarray
  - xarray_adaptor
  - xadapt (xarray_adaptor)
  - xtensor
  - xtensor_adaptor
  - xadapt (xtensor_adaptor)
  - xview
  - xbroadcast
  - xindexview
  - xfunctorview
- Functions and generators
  - xfunction
  - xreducer
  - xgenerator
  - xbuilder
  - xrandom
- Mathematical functions
  - Operators and related functions
  - Basic functions
  - Exponential functions
  - Power functions
  - Trigonometric functions
  - Hyperbolic functions
  - Error and gamma functions
  - Nearest integer floating point operations
  - Classification functions
  - Reducing functions

DEVELOPER ZONE

- Compiler workarounds
  - Visual Studio 2015 and `std::enable_if`
  - GCC-4.9 and Clang < 3.8 and constexpr `std::min` and `std::max`
  - Clang < 3.8 matching `initializer_list` with static arrays
  - GCC < 5.1 and `std::is_trivially_default_constructible`
  - GCC-6 and the signature of `std::isnan` and `std::isinf`
- Build and configuration
  - Build
  - Configuration
- Extending xtensor
  - Adapting one-dimensional containers
  - Structures that embed shape and strides
    - Define inner types
    - Inherit
    - Define semantic
    - Implement the reshape methods
    - Implement private accessors
  - Embedding a full tensor structure
    - Define inner types
    - Inheritance
    - Define semantic
    - Implement access operators
    - Implement broadcast mechanic
    - Implement reshape overloads
    - Provide a stepper API
- Releasing xtensor
  - Releasing a new version
  - Updating the conda-forge recipe

MISCELLANEOUS

- From numpy to xtensor
  - Containers
  - Initializers
  - Broadcasting
  - Random
  - Concatenation
  - Diagonal, triangular and flip
  - Iteration
  - Logical
  - Comparisons
  - Complex numbers
  - Reducers
  - Mathematical functions
  - Linear algebra
- Notable differences with numpy
  - Zero-dimensional arrays
  - Meshgrid
  - The random module
  - Missing values
- Closure semantics
  - Basic rules for determinning closure types
  - Closure types and scalar wrappers
  - Writing functions that return expressions
    - Returning evaluated or unevaluated expressions
- Related projects
  - xtensor-python
    - Example 1: Use an algorithm of the C++ library on a numpy array inplace
    - Example 2: Create a universal function from a C++ scalar function
  - xtensor-python-cookiecutter
  - xtensor-julia
    - Example 1: Use an algorithm of the C++ library with a Julia array
    - Example 2: Create a numpy-style universal function from a C++ scalar function
  - xtensor-julia-cookiecutter
  - xtensor-r
  - xtensor-blas