HasGP-0.1: A Haskell library for inference using Gaussian processes

HasGP.Support.Linear

Description

HasGP Gaussian Process Library. This module contains assorted functions that support GP calculations and are specifically related to linear algebra.

Copyright (C) 2011 Sean Holden. sbh11@cl.cam.ac.uk.

Synopsis

Documentation

sumVector :: DVector -> Double

Sum the elements in a vector.

sumVectorDiv :: Int -> DVector -> Double

Sum of elements in a vector, divided by an Int.

lengthV :: Normed a b => a b -> RealOf b

Length of a vector.

toVector :: Matrix Double -> Vector Double

Generate a vector equal to the first column of a matrix.

replaceInVector :: DVector -> Int -> Double -> DVector

Replace the element at a specified position in a vector. NOTE: hmatrix numbers from 0, which is odd. This numbers from 1. The result is returned by overwriting v. This is implemented via runSTVector because the increase in efficiency is HUGE.

preMultiply :: DVector -> DMatrix -> DMatrix

Efficiently pre multiply by a diagonal matrix (passed as a vector)

postMultiply :: DMatrix -> DVector -> DMatrix

Efficiently post multiply by a diagonal matrix (passed as a vector)

xAxDiag :: DVector -> DVector -> Double

Compute x^T A x when A is diagonal. The second argument is the diagonal of A.

abDiagOnly :: DMatrix -> DMatrix -> DVector

Compute the diagonal only of the product of two square matrices

abaDiagDiag :: DVector -> DMatrix -> DMatrix

Compute ABA where A is diagonal. The first argument is the diagonal of A.

abaVV :: DVector -> DMatrix -> Double

Compute aBa where a is a vector and B is a matrix