Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: matrix.unitmatrix - Function Up: mathematics - Module Previous: gaussian2d - Function


matrix - Tool



Package utility
Module mathematics


Postscript file available

A collection of matrix/vector routines

include "matrix.g"

Constructors
Functions
angle Find the angle between two vectors
cosangle Find the cosine of the angle between two vectors
crossproduct vector cross-product
diagonalmatrix make an n x n diagonal matrix
directproduct Direct Matrix Product
dotproduct vector dot-product
help print a summary of matrix functions
invert Invert a matrix
mean the mean of the elements
mult matrix multiplication
norm the `norm' of a vector or matrix
print print a matrix/vector
rms the root mean square (rms) of the elements
rotate rotate a 2D (plain) vector
rotationmatrix make a 2 x 2 rotation matrix
symbolic Make a symbolic matrix/vector
test a test of most matrix functions
transpose Transpose a matrix
unitmatrix make an n x n unit matrix



Description

The functions in this tool have not been tested as rigorously as other parts of AIPS++. This tool can be considered ``alpha'' code.

matrix is a collection of common matrix and vector operations in Glish. It includes the Direct Matrix Product (used in the AIPS++ Measurement Equation), and a simple matrix inversion which also works with rectangular matrices. The latter should in time be replaced by a C++ executable (DO), which should then implement a choice of more sophisticated techniques than Gauss-Jordan inversion. All operations also work with complex numbers.

NB: Glish itself provides a number of element-by-element vector and array operations like addition etc. These have not been duplicated here.



Example
The functions are encapsulated in a separate tool, and take matrices and vectors as arguments:
- include "matrix.g"
- mx.help();
Now, let us do a matrix multiplication:
- m1 := array([1:6],2,3);
- print m1;
- m2 := array([1:12],3,4);
- print m2;
- m3 := mx.mult(m1,m2);
- print m3;




next up previous contents index
Next: matrix.unitmatrix - Function Up: mathematics - Module Previous: gaussian2d - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15