GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Physics::Unit::Implementation(3) User Contributed Perl Documentation Physics::Unit::Implementation(3)

Physics::Unit::Implementation - This page discusses implementation issues of the Physics/Unit.pm module.

Each unit is defined by a conversion factor and a dimensionality vector.

The conversion factor is a floating point number that specifies how this Unit relates to a reference Unit of the same dimensionality.

The dimensionality vector holds a list of integers - each of which records the power of a base Unit that appears in this Unit.

For example, consider the unit of speed, "miles per hour". This has a dimensionality of (Distance / Time), or of (Distance ^ 1 * Time ^ -1). So this unit's dimensionality vector has a 1 in the place corresponding to Distance, and a -1 in the place corresponding to Time.

The reference unit for speed is "meters per second" (since meter is the base unit corresponding to Distance, and second is the base unit corresponding to Time). Therefore, the conversion factor for the unit "miles per hour" is 0.44704, since 1 mph equals 0.44704 meters / sec.

$debug
Turning this on enables copious debugging information.
$number_re
A (correct) regular expression for a floating point number, optionally in exponent form.

%reserved_word
A list of reserved words used in unit expressions. For example, "per", "square", "cubic".
%unit_by_name
The keys of this hash are the known unit names. The values are references to the named unit objects.
%prefix
Keys are the valid prefixes. Values are references to the Unit objects. Note that the names here are also in %unit_by_name.
%prototype
Keys are the names of the types. The values of this hash are references to Unit objects that exemplify these types.
$NumBases
The number of base units.
@BaseName
The name of each of the base units. These names also appear in %unit_by_name.

NewOne()
Creates a new dimensionless unit.
$u->AddNames()
This is called during the object's construction to add a list of names to the 'names' array, and to set the reference in the %unit_by_names cross-reference hash.
$u->NewType($typeName)
This is called when we are adding a new type to the system. This happens both in "InitBaseUnits()" and in "InitTypes()".
CreateUnit($unitDev)
This is used by several of the interface utility functions to create a new unit object from a unit definition (either a simple name, a unit expression, or a unit object).

It differs from "GetUnit()" in that it always creates a new, anonymous unit, whereas "GetUnit()", if given a simple name, returns a reference to a named Unit.

CompareDim($a1, $a2)
Compare the dimension arrays. Return 0 if they are the same.
LookName($name)
Look up the name. Returns:

  0 not defined
  1 reserved word
  2 unit name
  3 type name
    
$u->DebugString()
Convert the unit to a factor - dimension vector format string, e.g. the unit '3 meters' would be converted to something like

  3 [1, 0, 0]
    
$u->CheckChange()
Complain if this unit has a name. This is used by all the methods that modify the value of the unit.
2022-04-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.