# vtkDotProductSimilarity Class Reference

`#include <vtkDotProductSimilarity.h>`

## Detailed Description

compute dot-product similarity metrics.

Treats matrices as collections of vectors and computes dot-product similarity metrics between vectors.

The results are returned as an edge-table that lists the index of each vector and their computed similarity. The output edge-table is typically used with vtkTableToGraph to create a similarity graph.

This filter can be used with one or two input matrices. If you provide a single matrix as input, every vector in the matrix is compared with every other vector. If you provide two matrices, every vector in the first matrix is compared with every vector in the second matrix.

Note that this filter *only* computes the dot-product between each pair of vectors; if you want to compute the cosine of the angles between vectors, you will need to normalize the inputs yourself.

Inputs: Input port 0: (required) A vtkDenseArray<double> with two dimensions (a matrix). Input port 1: (optional) A vtkDenseArray<double> with two dimensions (a matrix).

Outputs: Output port 0: A vtkTable containing "source", "target", and "similarity" columns.

**Warning:**- Note that the complexity of this filter is quadratic! It also requires dense arrays as input, in the future it should be generalized to accept sparse arrays.

**Thanks:**- Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National Laboratories.

**Events:**- vtkCommand::ProgressEvent

**Tests:**- vtkDotProductSimilarity (Tests)

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