Gymbo

Public Member Functions | Public Attributes | List of all members
gymbo::Grad Struct Reference

Struct representing the gradient of a symbolic expression. More...

`#include <type.h>`

## Public Member Functions
| Grad (std::unordered_map< int, float > val)
| Constructor for the gradient. More...
Grad | operator+ (const Grad &other)
| Overloaded addition operator for adding two gradients. More...
Grad | operator+ (float w)
| Overloaded addition operator for adding a constant to the gradient. More...
Grad | operator- (const Grad &other)
| Overloaded subtraction operator for subtracting two gradients. More...
Grad | operator* (float w)
| Overloaded multiplication operator for multiplying the gradient by a constant. More...
Grad | abs ()
| Compute the absolute values of the gradient. More...

## Public Attributes
std::unordered_map< int, float > | val

## Detailed Description

Struct representing the gradient of a symbolic expression.

## Constructor & Destructor Documentation

## ◆ Grad()

gymbo::Grad::Grad | ( | std::unordered_map< int, float > | val | ) |
| inline

Constructor for the gradient.

Parameters

  val | Map of variable indices to gradient values.

## Member Function Documentation

## ◆ abs()

Grad gymbo::Grad::abs | ( |  | ) |
| inline

Compute the absolute values of the gradient.

Returns
  The gradient with absolute values.

## ◆ operator*()

Grad gymbo::Grad::operator* | ( | float | w | ) |
| inline

Overloaded multiplication operator for multiplying the gradient by a constant.

Parameters

  w | The constant to multiply by.

Returns
  The result of multiplying the gradient by the constant.

## ◆ operator+() [1/2]

Grad gymbo::Grad::operator+ | ( | const Grad & | other | ) |
| inline

Overloaded addition operator for adding two gradients.

Parameters

  other | The gradient to add.

Returns
  The sum of the two gradients.

## ◆ operator+() [2/2]

Grad gymbo::Grad::operator+ | ( | float | w | ) |
| inline

Overloaded addition operator for adding a constant to the gradient.

Parameters

  w | The constant to add.

Returns
  The sum of the gradient and the constant.

## ◆ operator-()

Grad gymbo::Grad::operator- | ( | const Grad & | other | ) |
| inline

Overloaded subtraction operator for subtracting two gradients.

Parameters

  other | The gradient to subtract.

Returns
  The result of subtracting the second gradient from the first.

## Member Data Documentation

## ◆ val

std::unordered_map<int, float> gymbo::Grad::val

Map of variable indices to gradient values.

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

- libgymbo/type.h