Tannic
A C++ Tensor Library
Loading...
Searching...
No Matches
tannic::transformation::Outer Struct Reference

Represents the outer product operation between two vectors. More...

#include <transformations.hpp>

Public Member Functions

void forward (Tensor const &first, Tensor const &second, Tensor &result) const
 

Static Public Member Functions

static constexpr type promote (type first, type second)
 Type promotion for the outer product operation.
 
static constexpr Shape transform (Shape const &first, Shape const &second)
 Computes output shape for the outer product of two vectors.
 

Detailed Description

Represents the outer product operation between two vectors.

The outer product of two vectors with shapes (n) and (m) results in a matrix of shape (n, m). Currently, only vectors are supported — tensors with rank greater than 1 are not supported, but this may be extended in the future.

Member Function Documentation

◆ forward()

void tannic::transformation::Outer::forward ( Tensor const &  first,
Tensor const &  second,
Tensor result 
) const

◆ promote()

static constexpr type tannic::transformation::Outer::promote ( type  first,
type  second 
)
inlinestaticconstexpr

Type promotion for the outer product operation.

Promotes two operand types to the higher precision type.

Parameters
firstType of the first operand (left)
secondType of the second operand (right)
Returns
Promoted type for outer product computation

◆ transform()

static constexpr Shape tannic::transformation::Outer::transform ( Shape const &  first,
Shape const &  second 
)
inlinestaticconstexpr

Computes output shape for the outer product of two vectors.

Parameters
firstShape of the first tensor
secondShape of the second tensor
Returns
Shape of the resulting outer product tensor
Exceptions
assertionerror if either input tensor is not rank 1 for now outer product only support vectors and not general tensors but this may change in the future.

The outer product of two vectors with shapes (n) and (m) produces a matrix of shape (n, m). Outer product is not defined here for tensors with rank > 1.


The documentation for this struct was generated from the following file: