com.asher_stern.crf.utilities.VectorUtilities Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of CRF Show documentation
Show all versions of CRF Show documentation
Implementation of linear-chain Conditional Random Fields (CRF) in pure Java
package com.asher_stern.crf.utilities;
/**
* A collection of linear algebra functions over vectors.
*
* @author Asher Stern
* Date: Nov 7, 2014
*
*/
public class VectorUtilities
{
/**
* Returns the inner product of the two given vectors.
* @param rowVector
* @param columnVector
* @return
*/
public static double product(double[] rowVector, double[] columnVector)
{
if (rowVector.length!=columnVector.length) throw new CrfException("Cannot multiply vector of different sizes.");
double ret = 0.0;
for (int i=0;i