QLogical.h

Classes

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

Logical operations for the Quantum class. (source)

Interface

Bool operator==(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator==(const Quantum<Qtype> &left, const Qtype &other)
Bool operator==(const Qtype &left, const Quantum<Qtype> &other)
Bool operator!=(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator!=(const Quantum<Qtype> &left, const Qtype &other)
Bool operator!=(const Qtype &left, const Quantum<Qtype> &other)
Bool near(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool near(const Quantum<Qtype> &left, const Quantum<Qtype> &other, Double tol)
Bool near(const Quantum<Qtype> &left, const Qtype &other)
Bool near(const Quantum<Qtype> &left, const Qtype &other, Double tol)
Bool near(const Qtype &left, const Quantum<Qtype> &other)
Bool near(const Qtype &left, const Quantum<Qtype> &other, Double tol)
Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other, Double tol)
Bool nearAbs(const Quantum<Qtype> &left, const Qtype &other)
Bool nearAbs(const Quantum<Qtype> &left, const Qtype &other, Double tol)
Bool nearAbs(const Qtype &left, const Quantum<Qtype> &other)
Bool nearAbs(const Qtype &left, const Quantum<Qtype> &other, Double tol)
Bool operator<(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator<(const Quantum<Qtype> &left, const Qtype &other)
Bool operator<(const Qtype &left, const Quantum<Qtype> &other)
Bool operator>(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator>(const Quantum<Qtype> &left, const Qtype &other)
Bool operator>(const Qtype &left, const Quantum<Qtype> &other)
Bool operator<=(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator<=(const Quantum<Qtype> &left, const Qtype &other)
Bool operator<=(const Qtype &left, const Quantum<Qtype> &other)
Bool operator>=(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator>=(const Quantum<Qtype> &left, const Qtype &other)
Bool operator>=(const Qtype &left, const Quantum<Qtype> &other)
Bool QMakeBool(Int val)
Bool QMakeBool(const LogicalArray &val)

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Tests:

Prerequisite

Etymology

QLogical derived from Quantum logical 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 logical operations that can be done on Quantum<T>.

They can be subdivided into various groupings:

The operations defined are:

Motivation

To separate the logical operations from Quantum

To Do

Member Description

Bool operator==(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator==(const Quantum<Qtype> &left, const Qtype &other)
Bool operator==(const Qtype &left, const Quantum<Qtype> &other)
Bool operator!=(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator!=(const Quantum<Qtype> &left, const Qtype &other)
Bool operator!=(const Qtype &left, const Quantum<Qtype> &other)

Straight comparisons: unequal if non-conforming units or different values if units made equal. I.e. 1in != 1m , 1in != 1s , 36in == 1yd ./

Bool near(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool near(const Quantum<Qtype> &left, const Quantum<Qtype> &other, Double tol)
Bool near(const Quantum<Qtype> &left, const Qtype &other)
Bool near(const Quantum<Qtype> &left, const Qtype &other, Double tol)
Bool near(const Qtype &left, const Quantum<Qtype> &other)
Bool near(const Qtype &left, const Quantum<Qtype> &other, Double tol)
Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other, Double tol)
Bool nearAbs(const Quantum<Qtype> &left, const Qtype &other)
Bool nearAbs(const Quantum<Qtype> &left, const Qtype &other, Double tol)
Bool nearAbs(const Qtype &left, const Quantum<Qtype> &other)
Bool nearAbs(const Qtype &left, const Quantum<Qtype> &other, Double tol)

Near-ness tests: unequal if non-conforming units. In other cases the tolerance is in the units of the first argument, with the second argument converted, if necessary, to the same units as the first. Note (SUN?) compiler does not accept default arguments in template functions

Bool operator<(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator<(const Quantum<Qtype> &left, const Qtype &other)
Bool operator<(const Qtype &left, const Quantum<Qtype> &other)
Bool operator>(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator>(const Quantum<Qtype> &left, const Qtype &other)
Bool operator>(const Qtype &left, const Quantum<Qtype> &other)
Bool operator<=(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator<=(const Quantum<Qtype> &left, const Qtype &other)
Bool operator<=(const Qtype &left, const Quantum<Qtype> &other)
Bool operator>=(const Quantum<Qtype> &left, const Quantum<Qtype> &other)
Bool operator>=(const Quantum<Qtype> &left, const Qtype &other)
Bool operator>=(const Qtype &left, const Quantum<Qtype> &other)

Comparisons. The comparisons are done on values at equal units with transparent conversion if necessary.

Thrown Exceptions

Bool QMakeBool(Int val)
Bool QMakeBool(const LogicalArray &val)

Special make Bool routines to cater for array comparisons