dsmc-0.1.0.1: DSMC library for rarefied gas dynamics

DSMC.Util.Vector

Description

Simple 3-vectors and matrices built atop tuples.

Synopsis

# Documentation

type Vec3 = (Double, Double, Double)Source

Vector in `R^3`.

type Matrix = (Vec3, Vec3, Vec3)Source

Matrix given by its rows.

type Point = Vec3Source

Point in `R^3`.

Origin point `(0, 0, 0)`.

# Vector operations

(<+>) :: Vec3 -> Vec3 -> Vec3Source

(<->) :: Vec3 -> Vec3 -> Vec3Source

Subtract two vectors.

(><) :: Vec3 -> Vec3 -> Vec3Source

Vec3 cross product.

(.^) :: Vec3 -> Double -> Vec3Source

Scale vector.

(.*) :: Vec3 -> Vec3 -> DoubleSource

Vec3 dot product.

Euclidean norm of vector.

Produce unit vector with same direction as the original one.

Scale vector by -1.

Euclidean distance between two points.

Arguments

 :: Point Current position. -> Vec3 Velocity. -> Double Time step. -> Point

Move point by velocity vector for given time and return new position.

# Matrix operations

mxv :: Matrix -> Vec3 -> Vec3Source

Multiply matrix (given by row vectors) and vector

vxv :: Vec3 -> Vec3 -> MatrixSource

Transpose vector and multiply it by another vector, producing a matrix.

dotM :: Vec3 -> Vec3 -> Matrix -> DoubleSource

Generic vector dot product.

Multiply transpose of first vector by given matrix, then multiply the result by second vector.

Produce matrix with diagonal elements equal to given value.

We could add Applicative instance for Matrix and lift (+) to it.

# Cartesian system

buildCartesian :: Double -> Double -> (Vec3, Vec3, Vec3)Source

Build cartesian axes from yaw and pitch with 0 roll. Angles are in radians.