Numeric routines

### Numeric routines

The first routine allows to add a vector:
• SYNOPSIS: INT add_apply_vector(OP a,b)
• DESCRIPTION: a,b should be two VECTORobjects, and the routine computes b = b+a, where the addition of the two vectors is componentwise. This also works, if the VECTORobjects have different length. a,b must be different objects.
• RETURN: OK, or ERROR if some error occured.
• BUG: there is no check on types, because this is a special routine, normally you should use add_apply instead.
The next routine allows to add two vectors:
• SYNOPSIS: INT add_vector(OP a,b,c)
• DESCRIPTION: a,b should be VECTORobjects, c should be an empty object. The routine computes c = a+b. The addition is componentwise, and it also works if the vectors have different length. a,b,c must all be different
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use add instead.
You can also form the negative of a vector:
• SYNOPSIS: INT addinvers_apply_vector(OP a)
• DESCRIPTION: a should be a VECTORobject. The routine computes a = -a. This is also meant componentwise.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use addinvers_apply instead.
You can compute the negative of a VECTORobject:
• SYNOPSIS: INT addinvers_vector(OP a,b)
• DESCRIPTION: a should be a VECTORobject. b should be an empty object. The routine computes b = -a. This is meant componentwise.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use addinvers instead.
The addition of a to each component of a vector:
• SYNOPSIS: INT addtoallvectorelements(OP a,b,c)
• DESCRIPTION: b should be a vector, the routine adds a to all the elements of b, the result will become c.
• RETURN: OK or ERROR.
• BUG: it only works for different a,b,c
The multiplication of each entry by a:
• NAME: mult_scalar_vector
• SYNOPSIS: INT mult_scalar_vector(OP a,b,c)
• DESCRIPTION: b should be a VECTORobject, c should be an empty object. The routine multiplies each element of b by a, and the result is c.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use mult instead.
A slightly different componentwise multiplication:
• NAME: mult_apply_vector_vector
• SYNOPSIS: INT mult_apply_vector_vector(OP a,b)
• DESCRIPTION: a,b should be VECTORobjects, The routine multiplies componentwise, and the result is b. The vectors must be of the same length.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use mult_apply instead.
Multiplication by a matrix:
• NAME: mult_vector_matrix
• SYNOPSIS: INT mult_vector_matrix(OP a,b,c)
• DESCRIPTION: a should be a VECTORobject, b should be a MATRIX object, c should be an empty object. The routine multiplies according to the rules for the multiplication of matrices, and the result becomes a VECTORobject. The length of the VECTORobject a must be equal to the height of the MATRIX object b.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use mult instead.
Multiplication by a vector:
• NAME: mult_vector_vector
• SYNOPSIS: INT mult_vector_vector(OP a,b,c)
• DESCRIPTION: a,b should be VECTORobjects, c should be an empty object. The routine multiplies componentwise, and the result is c. The vectors must be of the same length.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use mult instead.
The evaluation of the standard scalar product:
• NAME: scalarproduct_vector
• SYNOPSIS: INT scalarproduct_vector(OP a,b,c)
• DESCRIPTION: a,b should be VECTORobjects, c should be the empty object. a and b must have the same length. c becomes the euclidian scalarproduct of a and b.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use scalarproduct instead.
The sum of all the entries:
• NAME: sum_vector
• SYNOPSIS: INT sum_vector(OP a,b)
• DESCRIPTION: a should be a VECTORobject, b should be the empty object. b becomes the sum over the vector a.
• RETURN: OK, or ERROR
• BUG: there is no check on types, because this is a special routine, normally you should use sum instead.

harald.fripertinger@kfunigraz.ac.at,
last changed: November 19, 2001

 Numeric routines