# #include <sources/headers/BNAlgebra.h>template<typename Coeff> BNMor class

morphism of the Bar-Natan algebra

A morphism consists of two objects, namely domain (BNObj) and codomain (BNObj), and a list of labels (Label).

## Constructors, destructors, conversion operators

)
constructor for the zero-morphism (needed by the Eigen Template Library)
Idem front, Idem back, std::list<Label<Coeff>> labels)
standard constructor
int i)
constructor for the zero-morphism (needed by the Eigen Template Library)

## Public functions

auto check(const BNObj& obj_from, const BNObj& obj_to) const -> bool
true if the morphism is zero or goes between the two specified objects
auto get_back() const -> Idem
auto get_coeff(const bool& faceD) const -> Coeff
coefficient of morphism, assuming get_type() returned a non-zero value
auto get_first_coeff() const -> Coeff
coefficient of the first label of the morphism; results in undefined behaviour if the morphism is zero.
auto get_first_type() const -> int
type of the first label of the morphism; results in undefined behaviour if the morphism is zero.
auto get_front() const -> Idem
front objects of the morphism
auto get_labels() const -> std::list<Label<Coeff>>
all labels of the morphism
auto get_type(const bool& faceD) const -> int
type of same type as faceD and 0 if there is none.
auto is_0() const -> bool
true if the morphism is 0. We assume that the morphism is simplified.
auto is_inv() const -> bool
true if the morphism is invertible, ie an invertible multiple of the identity. We assume that the morphism is simplified.
auto operator*(const BNMor<Coeff>& mor1) const -> BNMor<Coeff>
compose two morphisms as functions: (note the order!). The function raises an exception if the morphisms are incomposable.
auto operator*(const Coeff& scalar) const -> BNMor<Coeff>
multiply a morphism by a scalar
void operator*=(const Coeff& coeff)
multiplication assignment: with a scalar
auto operator+(const BNMor<Coeff>& mor2) const -> BNMor<Coeff>
add two morphisms together; no sanity checks are performed.
void operator+=(const BNMor<Coeff>& mor2)
auto operator-() const -> BNMor<Coeff>
negative of a morphism
auto operator==(const BNMor<Coeff>& mor2) const -> bool
true if the two morphisms are equal. We assume here that both are simplified (see simplify()).
void print(const bool& is_4ended = true) const
print string representation of morphism in terminal. If the argument is false, non-negative label types ( ) are interpreted as powers of the varible and negative label types ( ) raise exceptions.
void set_coeff(const Coeff& coeff)
replace the coefficients of all labels of the morphism
auto simplify() -> BNMor
add up all coefficients with same label and eliminate labels with coefficient equal to 0; note that the list of labels might be empty after this operation.
auto split() -> std::list<BNMor<Coeff>>
split morphism into multiple morphisms with exactly one label; primarily used for morphisms of the form .
template<typename New_Coeff>
auto to_coeffs() const -> BNMor<New_Coeff>
converts a morphism over the integers to a morphism over the new ring of coefficients specified by 'New_Coeff'
auto to_coeffs() const -> BNMor<New_Coeff>
implementation of to_coeffs()
auto to_string(bool with_coeff = 1, bool is_4ended = true) const -> std::string
string representation of a morphism; coefficients are included, iff the first argument is true; if second argument is false, non-negative label types ( ) are interpreted as powers of the varible and negative label types ( ) raise exceptions.

## Function documentation

### template<typename Coeff> Idem BNMor<Coeff>::get_back() const

back objects of the morphism

### template<typename Coeff> int BNMor<Coeff>::get_type(const bool& faceD) const

type of same type as faceD and 0 if there is none.

results in undefined behaviour unless the morphism is homogeneous of non-zero quantum grading, so that there is:

• no identity component
• at most one type
• at most one type

### #include <sources/modules/BNAlgebra.cpp> template<typename Coeff> BNMor<New_Coeff> BNMor<Coeff>::to_coeffs() const

implementation of to_coeffs()