paratec::vector - three-vectors for use with paratec
Implements three vectors
Creates a three vector object, which is actually an array of numbers. Vector is intended to make threevec obsolete, as I prefer this name, and the paratec:: avoids any name collisions with other vector types.
use paratec::vector;
Makes the methods and overloaded operators of this module available to your program.
$vector = new paratec::vector;
Create a new vector.
$vector = new paratec::vector(1,2,3);
Create a vector with value (1,2,3).
All the ordinary arithmetic operators work as you would expect of vectors. A couple of trickier things are possible, which I will mention here.
$scalar = $vector1 * $vector2
The dot product of two vectors.
$scalar = $vector1 x $vector2
The cross product of two vectors (be careful of precedence).
$vector1 = $tensor * $vector2
A tensor can be multiplied by a vector.
$vector1 = $vector2 / $tensor
A vector may be divided by a tensor. This computes the inverse of the tensor and then operates it on the vector. This can be handy for going between coordinate relative to the lattice vectors and cartesian coordinates.
abs($vector)
Returns the magnitude the vector.
paratec::tensor.
This man page documents paratec::vector version 0.1.
David Roundy <droundy@physics.berkeley.edu>.
Thanks to Gilles Santi, for giving me the idea of writing this.
Copyright (c) 2000, David Roundy. All rights reserved.
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.