Copyright | (C) 2012-2015 Edward Kmett |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | Safe |

Language | Haskell98 |

Simple matrix operation for low-dimensional primitives.

# Documentation

class Functor m => Trace m where #

Nothing

trace :: Num a => m (m a) -> a #

Compute the trace of a matrix

`>>>`

a + d`trace (V2 (V2 a b) (V2 c d))`

trace :: (Foldable m, Num a) => m (m a) -> a #

Compute the trace of a matrix

`>>>`

a + d`trace (V2 (V2 a b) (V2 c d))`

Compute the diagonal of a matrix

`>>>`

V2 a d`diagonal (V2 (V2 a b) (V2 c d))`

diagonal :: Monad m => m (m a) -> m a #

Compute the diagonal of a matrix

`>>>`

V2 a d`diagonal (V2 (V2 a b) (V2 c d))`

## Instances

Trace Complex # | |

Trace IntMap # | |

Trace V1 # | |

Trace V2 # | |

Trace V3 # | |

Trace V4 # | |

Trace V0 # | |

Trace Quaternion # | |

Defined in Linear.Trace trace :: Num a => Quaternion (Quaternion a) -> a # diagonal :: Quaternion (Quaternion a) -> Quaternion a # | |

Trace Plucker # | |

Ord k => Trace (Map k) # | |

(Eq k, Hashable k) => Trace (HashMap k) # | |

Dim n => Trace (V n) # | |

(Trace f, Trace g) => Trace (Product f g) # | |

(Distributive g, Trace g, Trace f) => Trace (Compose g f) # | |