QMath.h

Classes

Global Functions -- Mathematical operations for the Quantum class. (full description)

Mathematical operations for the Quantum class. (source)

Interface

Quantum<Qtype> operator+(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator+(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> operator-(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator-(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> operator*(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator*(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> operator/(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator/(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> pow(const Quantum<Qtype> &left, Int p)
Quantum<Qtype> root(const Quantum<Qtype> &left, Int p)
Quantum<Qtype> sqrt(const Quantum<Qtype> &left)
Quantum<Qtype> abs(const Quantum<Qtype> &left)
Quantum<Qtype> ceil(const Quantum<Qtype> &left)
Quantum<Qtype> floor(const Quantum<Qtype> &left)
Quantum<Qtype> sin(const Quantum<Qtype> &left)
Quantum<Qtype> cos(const Quantum<Qtype> &left)
Quantum<Qtype> tan(const Quantum<Qtype> &left)
Quantum<Qtype> asin(const Quantum<Qtype> &left)
Quantum<Qtype> acos(const Quantum<Qtype> &left)
Quantum<Qtype> atan(const Quantum<Qtype> &left)
Quantum<Qtype> atan2(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Quantum<Qtype> atan2(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> atan2(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> log(const Quantum<Qtype> &left)
Quantum<Qtype> log10(const Quantum<Qtype> &left)
Quantum<Qtype> exp(const Quantum<Qtype> &left)
Int ceil(const Int &val)
Int floor(const Int &val)
Float real(const Float &val)
Double real(const Double&val)
Array<Complex> operator *(const Array<Complex> &in, Double f)
Array<Complex> operator /(const Array<Complex> &in, Double f)
Array<DComplex> operator *(const Array<DComplex> &in, Double f)
Array<DComplex> operator /(const Array<DComplex> &in, Double f)
Array<Float> operator *(const Array<Float> &in, Double f)
Array<Float> operator /(const Array<Float> &in, Double f)
Array<Int> operator *(const Array<Int> &in, Double f)
Array<Int> operator /(const Array<Int> &in, Double f)

Description

Review Status

Programs:
Tests:

Prerequisite

Etymology

QMath derived from Quantum Mathematical functions

Synopsis

Quantities are values with a unit. Their basic specification can be one of two forms:
    Quantity( Double value, String unit);	// or: Unit unit
    Quantum<Type> ( Type value, String unit)	// or: Unit unit
    

A unit is a string of known unit fields separated by 'space' or '.' (to indicate multiply) or '/' (to indicate divide). See the Unit class for details. Example: km/s/(Mpc.s)2 is identical to km.s-1.Mpc-2.s-2

This file defines the mathematical operations that can be done on Quantum<T>.

They can be subdivided into various groupings:

The operations/functions defined are:
Warning Some operators are implemented as member functions, and can be found in the Quantum class.

Motivation

To separate the mathematical operations from Quantum.

To Do

Member Description

Quantum<Qtype> operator+(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator+(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> operator-(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator-(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> operator*(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator*(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> operator/(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> operator/(const Qtype &left, const Quantum<Qtype> &other)

See Quantum class

Arithmetic operators: return Quantum

Thrown Exceptions

Quantum<Qtype> pow(const Quantum<Qtype> &left, Int p)
Quantum<Qtype> root(const Quantum<Qtype> &left, Int p)
Quantum<Qtype> sqrt(const Quantum<Qtype> &left)
Quantum<Qtype> abs(const Quantum<Qtype> &left)
Quantum<Qtype> ceil(const Quantum<Qtype> &left)
Quantum<Qtype> floor(const Quantum<Qtype> &left)

Some useful arithmetic (linear) functions

Quantum<Qtype> sin(const Quantum<Qtype> &left)
Quantum<Qtype> cos(const Quantum<Qtype> &left)
Quantum<Qtype> tan(const Quantum<Qtype> &left)
Quantum<Qtype> asin(const Quantum<Qtype> &left)
Quantum<Qtype> acos(const Quantum<Qtype> &left)
Quantum<Qtype> atan(const Quantum<Qtype> &left)
Quantum<Qtype> atan2(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Quantum<Qtype> atan2(const Quantum<Qtype> &left, const Qtype &other)
Quantum<Qtype> atan2(const Qtype &left, const Quantum<Qtype> &other)
Quantum<Qtype> log(const Quantum<Qtype> &left)
Quantum<Qtype> log10(const Quantum<Qtype> &left)
Quantum<Qtype> exp(const Quantum<Qtype> &left)

Trigonometric and exponential functions For direct functions input should be in angles, output will be empty units. For inverse functions input should be empty, output in radians

Thrown Exceptions

Int ceil(const Int &val)
Int floor(const Int &val)
Float real(const Float &val)
Double real(const Double&val)
Array<Complex> operator *(const Array<Complex> &in, Double f)
Array<Complex> operator /(const Array<Complex> &in, Double f)
Array<DComplex> operator *(const Array<DComplex> &in, Double f)
Array<DComplex> operator /(const Array<DComplex> &in, Double f)
Array<Float> operator *(const Array<Float> &in, Double f)
Array<Float> operator /(const Array<Float> &in, Double f)
Array<Int> operator *(const Array<Int> &in, Double f)
Array<Int> operator /(const Array<Int> &in, Double f)

Functions to implement integer ceil/floor and others