product-mix-auction-0.1.0.0: A single-round sealed-bid auction for multiple goods

Safe HaskellNone
LanguageHaskell2010

ProductMixAuction.LinearAlgebra

Contents

Synopsis

Types

class ComponentWise f where Source #

Minimal complete definition

componentWise

Methods

componentWise :: (a -> b -> c) -> f a -> f b -> f c Source #

Instances

ComponentWise [] Source # 

Methods

componentWise :: (a -> b -> c) -> [a] -> [b] -> [c] Source #

ComponentWise Vector Source # 

Methods

componentWise :: (a -> b -> c) -> Vector a -> Vector b -> Vector c Source #

Linear algebra

isZero :: (Foldable f, Eq a, Num a) => f a -> Bool Source #

Check whether a vector is a zero vector (all components are exactly 0)

zero :: (Num (Item (f a)), IsList (f a)) => Dimension -> f a Source #

The zero vector

ones :: (Num (Item (f a)), IsList (f a)) => Dimension -> f a Source #

A vector where all elements are 1

vplus :: (Num a, ComponentWise f) => f a -> f a -> f a Source #

Addition of vectors, pointwise.

(<+>) :: (Num a, ComponentWise f) => f a -> f a -> f a Source #

Addition of vectors, pointwise (operator alias for vplus)

vminus :: (Num a, ComponentWise f) => f a -> f a -> f a Source #

Subtraction of vectors, pointwise.

(<->) :: (Num a, ComponentWise f) => f a -> f a -> f a Source #

Subtraction of vectors, pointwise (operator alias for vminus)

(<.>) :: (Num a, ComponentWise f) => f a -> f a -> f a Source #

Multiplication of vectors, pointwise.

vmax :: (Ord a, ComponentWise f) => f a -> f a -> f a Source #

Component-wise max

vmin :: (Ord a, ComponentWise f) => f a -> f a -> f a Source #

Component-wise min

vscale :: (Functor f, Num a) => a -> f a -> f a Source #

Scale a vector (scalar multiplication)

vlte :: (Ord a, Functor f, ComponentWise f, Foldable f) => f a -> f a -> Bool Source #

Vector-less-than-or-equal: <= operator for vectors under Euclidean order as described in the paper "Valid Combinations of Bids" (Baldwin, Goldberg & Klemperer, validBids.pdf), section 1.1

Note that this is a partial ordering, so a vlte b does not imply not (a vlte b), nor does a vlte b && b vlte a imply a == b.

dot :: (Num a, Functor f, ComponentWise f, Foldable f) => f a -> f a -> a Source #

Dot product.

dotBy :: (Num c, Functor f, ComponentWise f, Foldable f) => (a -> b -> c) -> f a -> f b -> c Source #

Dot product with a custom multiplication operator. This is required so that we can form the dot product of vectors from two different unit spaces (e.g. price · quantity).

dot1 :: Num a => Vector a -> a Source #

Alias for csum: dot product with the unit vector, which amounts to adding the components.