Tannic
A C++ Tensor Library
Loading...
Searching...
No Matches
shape.hpp File Reference

Defines the tannic::Shape class for representing tensor dimensions.
More...

#include <type_traits>
#include <array>
#include <cstdint>
#include <cassert>
#include <initializer_list>
#include <ostream>
#include "concepts.hpp"
#include "indexing.hpp"
#include "exceptions.hpp"
Include dependency graph for shape.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tannic::Shape
 Represents the shape (dimensions) of an tensor-like expression. More...
 

Namespaces

namespace  tannic
 

Functions

constexpr bool tannic::operator== (Shape const &first, Shape const &second)
 Equality comparison operator for shapes.
 
std::ostream & tannic::operator<< (std::ostream &os, Shape const &shape)
 

Detailed Description

Defines the tannic::Shape class for representing tensor dimensions.

Author
Eric Hermosis
Date
2025

This file is part of the Tannic Tensor Library and defines the Shape class, a compact, constexpr-friendly abstraction for representing the shape (i.e., dimensions) of tensors and expression-like objects. Shapes are integral to indexing, broadcasting, and tensor manipulation throughout the library.

The shape supports:

  • Compile-time construction (constexpr)
  • Convenient initialization from iterators, lists, or variadic arguments
  • Safe indexing, including Python-style negative indexing

All expression-like objects in the library expose a Shape as part of their interface, making this file central to the Tannic design.