---
title: "Boost Math - Vector Functionals"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Boost Math - Vector Functionals}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup, include=FALSE}
library(boostmath)
```

## [Vector Functionals - Norms](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/norms.html)

```{r}
# L0 Pseudo Norm
l0_pseudo_norm(c(1, 0, 2, 0, 3))
# Hamming Distance
hamming_distance(c(1, 0, 1), c(0, 1, 1))
# L1 Norm
l1_norm(c(1, -2, 3))
# L1 Distance
l1_distance(c(1, -2, 3), c(4, -5, 6))
# L2 Norm
l2_norm(c(3, 4))
# L2 Distance
l2_distance(c(3, 4), c(0, 0))
# Supremum Norm
sup_norm(c(1, -2, 3))
# Supremum Distance
sup_distance(c(1, -2, 3), c(4, -5, 6))
# Lp Norm
lp_norm(c(1, -2, 3), 3)
# Lp Distance
lp_distance(c(1, -2, 3), c(4, -5, 6), 3)
# Total Variation
total_variation(c(1, 2, 1, 3))
```
