---
name: "mlpack_kernel_TriangularKernel"
section: "3"
platform: "linux"
package: "mlpack-doc"
version: "1.0.10-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_kernel_TriangularKernel"
---

# mlpack\_kernel\_TriangularKernel(3)

The trivially simple triangular kernel, defined by.

## NAME

mlpack::kernel::TriangularKernel -

The trivially simple triangular kernel, defined by.

## SYNOPSIS

### Public Member Functions

**TriangularKernel** (const double **bandwidth**=1.0)\
 *Initialize the triangular kernel with the given bandwidth (default 1.0).*  double **Bandwidth** () const \
 *Get the bandwidth of the kernel.*  double & **Bandwidth** ()\
 *Modify the bandwidth of the kernel.*  template\<typename Vec1Type , typename Vec2Type \> double **Evaluate** (const Vec1Type &a, const Vec2Type &b) const \
 *Evaluate the triangular kernel for the two given vectors.*  double **Evaluate** (const double distance) const \
 *Evaluate the triangular kernel given that the distance between the two points is known.*  std::string **ToString** () const \
 *Return a string representation of the kernel.*

### Private Attributes

double **bandwidth**\
 *The bandwidth of the kernel.*

## Detailed Description

The trivially simple triangular kernel, defined by.

where $ b $ is the bandwidth of the kernel.

Definition at line 40 of file triangular\_kernel.hpp.

## Constructor & Destructor Documentation

### mlpack::kernel::TriangularKernel::TriangularKernel (const doublebandwidth = `1.0`)` [inline]`

Initialize the triangular kernel with the given bandwidth (default 1.0).

**Parameters:**

*bandwidth* Bandwidth of the triangular kernel.

Definition at line 48 of file triangular\_kernel.hpp.

## Member Function Documentation

### double mlpack::kernel::TriangularKernel::Bandwidth () const` [inline]`

Get the bandwidth of the kernel.

Definition at line 75 of file triangular\_kernel.hpp.

References bandwidth.

### double& mlpack::kernel::TriangularKernel::Bandwidth ()` [inline]`

Modify the bandwidth of the kernel.

Definition at line 77 of file triangular\_kernel.hpp.

References bandwidth.

### template\<typename Vec1Type , typename Vec2Type \> double mlpack::kernel::TriangularKernel::Evaluate (const Vec1Type &a, const Vec2Type &b) const` [inline]`

Evaluate the triangular kernel for the two given vectors.

**Parameters:**

*a* First vector. \
 *b* Second vector.

Definition at line 57 of file triangular\_kernel.hpp.

References bandwidth, and mlpack::metric::LMetric\< Power, TakeRoot \>::Evaluate().

### double mlpack::kernel::TriangularKernel::Evaluate (const doubledistance) const` [inline]`

Evaluate the triangular kernel given that the distance between the two points is known.

**Parameters:**

*distance* The distance between the two points.

Definition at line 69 of file triangular\_kernel.hpp.

References bandwidth.

### std::string mlpack::kernel::TriangularKernel::ToString () const` [inline]`

Return a string representation of the kernel.

Definition at line 80 of file triangular\_kernel.hpp.

References bandwidth.

## Member Data Documentation

### double mlpack::kernel::TriangularKernel::bandwidth` [private]`

The bandwidth of the kernel.

Definition at line 90 of file triangular\_kernel.hpp.

Referenced by Bandwidth(), Evaluate(), and ToString().

## Author

Generated automatically by Doxygen for MLPACK from the source code.
