Dear subscribers,

a new Vector Algebra Toolbox for the MATLAB programming language is freely

available on the following web server:

http://www.mathworks.com/matlabcentral/fileexchange/

FILE EXCHANGE CATHEGORY:

- MATLAB Central > File Exchange > Mathematics > Linear Algebra

TITLE:

- Vector Algebra for Multidimensional Arrays of Vectors

----------------------------------------------------------------

VECTOR ALGEBRA TOOLBOX

Vector Algebra for Multidimensional Arrays of Vectors

By Paolo de Leva

----------------------------------------------------------------

KEYWORDS

Outer product, Cross division, Norm, Unit vector, Projection Rejection

SUMMARY

Multiple outer products, cross divisions, norms, normalizations,

projections, rejections, with no loops.

DESCRIPTION

This toolbox was written to complete the incomplete set of vectorial

operations which can be performed with MATLAB 7 on block arrays of vectors

(arrays of any size containing vectors along one of their dimensions).

MATLAB 7 includes just five functions performing vectorial algebraic

operations on N-D arrays of vectors:

SUM (generic function usable to perform vector additions)

+ (generic operator usable to perform vector additions)

- (generic operator usable to perform vector subtractions)

DOT (specific function performing dot products)

CROSS (specific function performing cross products)

Except for SUM, they all perform multiple binary operations on pairs of

vectors, contained in two arrays. SUM can be used to add together all the

vectors contained in a single array or subarray.

All of the above functions accept as input arrays of vectors. What about

outer products and cross divisions?

Outer products between two vectors (1-by-N or N-by-1) can be easily

performed in MATLAB using the operators for matrix multiplication (*) and

transposition ('). See the MATLAB Help page titled "Vector Products and

Transpose".

Outer products between two arrays of vectors become extremely easy if you

use my function MULTIPROD (published separately, see below). They can be

performed with a single call to MULTIPROD. However, a function called OUTER

is included here, selecting for you the appropriate MULTIPROD syntax.

As for cross division, it was not invented until now (see

http://mathworld.wolfram.com/VectorDivision.html), but it was useful to me,

so I invented it. It was not indispensable, but it markedly simplified my

equations and my code, and those who appreciate short symbolic equations are

likely to love it. Without it, in some cases you are forced to write scalar

equations, containing negative terms and operations involving various

combinations of scalar components. I am not saying those scalar equations

are complex, but they are certainly less simple than a vectorial equation,

and a typo is more likely to occur when you write scalar equations than when

you write vectorial equations. See CROSSDIV help for more detailed

explanations.

A list of simple vectorial operations is given below. Only the first five

can be performed with functions integrated in MATLAB 7. The others are

implemented in this toolbox. All of them can be performed on N-D arrays of

vectors.

Operation: MATLAB implementation

----------------------------------------

Repeated addition: SUM

Binary addition: +

Subtraction: -

Dot product: DOT

Cross product: CROSS

Outer product: OUTER

Cross division: CROSSDIV

Euclidean norm: MAGN

Normalization: UNIT

Projection: PROJECTION

Rejection: REJECTION

See the respective help texts for further details.

Some of the functions included in this toolbox call MULTIPROD. This function

is a powerful generalization for N-D arrays of the MATLAB function MTIMES

and the matrix multiplication operator (*).

Obviously, MULTIPROD has a broad field of potential applications. For

instance, it can use large arrays of 3-by-3 or 4-by-4 transformation

matrices to perform, in a single step and with no loops, multiple

geometrical transformations (rotations, roto-translations) on arrays of

vectors. Thus, I believe it deserves a separate introduction and I published

it in a separate package: "Matlab Central > File Exchange > Multiplying two

N-D arrays of matrices, vectors or scalars".

The functions testUNIT and testXDIV, included in this toolbox, contain the

code I used to test the output of functions UNIT and CROSSDIV.

OTHER REQUIREMENTS

Some functions included in this toolbox call MULTIPROD. Since this is a

versatile function with a broad field of applications, I published it

separately: "Matlab Central > File Exchange > Multiplying two N-D arrays of

matrices, vectors or scalars".

---------------------------------------------------------------------------

With my kindest regards,

Paolo de Leva

Department of Human Movement and Sport Sciences

University Institute of Movement Science

Rome, ITALY

a new Vector Algebra Toolbox for the MATLAB programming language is freely

available on the following web server:

http://www.mathworks.com/matlabcentral/fileexchange/

FILE EXCHANGE CATHEGORY:

- MATLAB Central > File Exchange > Mathematics > Linear Algebra

TITLE:

- Vector Algebra for Multidimensional Arrays of Vectors

----------------------------------------------------------------

VECTOR ALGEBRA TOOLBOX

Vector Algebra for Multidimensional Arrays of Vectors

By Paolo de Leva

----------------------------------------------------------------

KEYWORDS

Outer product, Cross division, Norm, Unit vector, Projection Rejection

SUMMARY

Multiple outer products, cross divisions, norms, normalizations,

projections, rejections, with no loops.

DESCRIPTION

This toolbox was written to complete the incomplete set of vectorial

operations which can be performed with MATLAB 7 on block arrays of vectors

(arrays of any size containing vectors along one of their dimensions).

MATLAB 7 includes just five functions performing vectorial algebraic

operations on N-D arrays of vectors:

SUM (generic function usable to perform vector additions)

+ (generic operator usable to perform vector additions)

- (generic operator usable to perform vector subtractions)

DOT (specific function performing dot products)

CROSS (specific function performing cross products)

Except for SUM, they all perform multiple binary operations on pairs of

vectors, contained in two arrays. SUM can be used to add together all the

vectors contained in a single array or subarray.

All of the above functions accept as input arrays of vectors. What about

outer products and cross divisions?

Outer products between two vectors (1-by-N or N-by-1) can be easily

performed in MATLAB using the operators for matrix multiplication (*) and

transposition ('). See the MATLAB Help page titled "Vector Products and

Transpose".

Outer products between two arrays of vectors become extremely easy if you

use my function MULTIPROD (published separately, see below). They can be

performed with a single call to MULTIPROD. However, a function called OUTER

is included here, selecting for you the appropriate MULTIPROD syntax.

As for cross division, it was not invented until now (see

http://mathworld.wolfram.com/VectorDivision.html), but it was useful to me,

so I invented it. It was not indispensable, but it markedly simplified my

equations and my code, and those who appreciate short symbolic equations are

likely to love it. Without it, in some cases you are forced to write scalar

equations, containing negative terms and operations involving various

combinations of scalar components. I am not saying those scalar equations

are complex, but they are certainly less simple than a vectorial equation,

and a typo is more likely to occur when you write scalar equations than when

you write vectorial equations. See CROSSDIV help for more detailed

explanations.

A list of simple vectorial operations is given below. Only the first five

can be performed with functions integrated in MATLAB 7. The others are

implemented in this toolbox. All of them can be performed on N-D arrays of

vectors.

Operation: MATLAB implementation

----------------------------------------

Repeated addition: SUM

Binary addition: +

Subtraction: -

Dot product: DOT

Cross product: CROSS

Outer product: OUTER

Cross division: CROSSDIV

Euclidean norm: MAGN

Normalization: UNIT

Projection: PROJECTION

Rejection: REJECTION

See the respective help texts for further details.

Some of the functions included in this toolbox call MULTIPROD. This function

is a powerful generalization for N-D arrays of the MATLAB function MTIMES

and the matrix multiplication operator (*).

Obviously, MULTIPROD has a broad field of potential applications. For

instance, it can use large arrays of 3-by-3 or 4-by-4 transformation

matrices to perform, in a single step and with no loops, multiple

geometrical transformations (rotations, roto-translations) on arrays of

vectors. Thus, I believe it deserves a separate introduction and I published

it in a separate package: "Matlab Central > File Exchange > Multiplying two

N-D arrays of matrices, vectors or scalars".

The functions testUNIT and testXDIV, included in this toolbox, contain the

code I used to test the output of functions UNIT and CROSSDIV.

OTHER REQUIREMENTS

Some functions included in this toolbox call MULTIPROD. Since this is a

versatile function with a broad field of applications, I published it

separately: "Matlab Central > File Exchange > Multiplying two N-D arrays of

matrices, vectors or scalars".

---------------------------------------------------------------------------

With my kindest regards,

Paolo de Leva

Department of Human Movement and Sport Sciences

University Institute of Movement Science

Rome, ITALY