For details read Perl NOC. After June 25

Steffen Müller >
Math-Orthonormalize-1.00 >
Math::Orthonormalize

Module Version: 1.00
Math::Orthonormalize - Gram-Schmidt Orthonormalization of vectors

use Math::Orthonormalize qw(:all); my @base_of_r_2 = ( [2, 1], [1, 3] ); my $vector = [1, 2, 3]; my @orthonormalized = orthonormalize(@base_of_r_2); my @orthogonalized = orthogonalize(@base_of_r_2); my $normalized = normalize($vector); my $scaled = scale(2, $vector); my $scalar = scalar_product($vector1, $vector2);

Math::Orthonormalize offers subroutines to compute normalized or non-normalized orthogonal bases of Euclidean vector spaces. That means: Given a vector base of R^n, it computes a new base of R^n whose individual vectors are all orthogonal. If those new base vectors all have a length of 1, the base is orthonormalized.

The module uses the Gram-Schmidt Algorithm.

No subroutines are exported by default, but the standart Exporter semantics are in place, including the ':all' tag that imports all of the exportable subroutines which are listed below.

Takes any number (>1) of vectors (array refs of vector components) as argument which form a base (that is, they are linearly independent) and returns an orthogonalized and normalized base of the same vector space (that is, n new array references).

Takes any number (>1) of vectors (array refs of vector components) as argument which form a base (that is, they are linearly independent) and returns an orthogonalized base of the same vector space (that is, n new array references).

Normalizes a vector. That is, it changes the vector length to 1 without changing the vector's direction.

Takes an array reference with the vector components as argument and returns a new array reference containing the normalized vector components.

Takes a scalar and a vector (array reference of vector components) as arguments. Multiplies every component of the vector by the specified scalar and returns a new array reference containing the scaled vector components.

Computes the scalar product of two vectors. Expects two array references with vector components (same number of components) as argument and returns their scalar product.

Steffen Mueller, orthonormalize-module at steffen-mueller dot net

(German) Merziger, Wirth: "Repetitorium der Höheren Mathematik" (Binomi, 1999)

You may find the current versions of this module at http://steffen-mueller.net/ or on CPAN.

Copyright (C) 2004-2005 by Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: