Next: Vector operations
Up: Matrices and vectors
Previous: Matrices and vectors
  Contents
Basic operations on elementary data structures
Working with large data structure like vectors or matrices, Polylib
deals with symbolic variables value that will
change their form at compilation time depending on options choosen
by the user.
In addition, there are some operations that will work
only on fixed types. Exemples are given by MSB, TOP and
NEXT functions defined over the integer
type but not on the value
type:
- MSB: put a one in the most significant bit of an int.
- TOP: largest representable positive number.
- NEXT(j,b): right shift the one bit in
b and increments j if the last bit in b is one.
Polylib contains a large amount of relational, algebraical or
structural operations whith one, two or more operands.
The implementation of these operations
is in general C functions, but some of them
are implemented as C definitions
like the one described earlier for some bit level
manipulation.
Here are some examples of the operations implemented
in Polylib:
- Comparing two values.
intcompare(const void*a, const void*b)
- Finding the list of the divisors of a given integer.
allfactors(int num)
- Search for
the greatest integer value with the power two less then a given integer.
int sqrt(int i)
- Least Common Multiple of two values.
value* Lcm(value i, value j)
- Greatest Common Divisor of two values.
value* Gcd(value i, value j)
- Factorial for a integer value.
value* Factorial(int n)
- Number of ways to choose 'b' items from 'a' items.
value* CNP(int a, int b)
Next: Vector operations
Up: Matrices and vectors
Previous: Matrices and vectors
  Contents
Sorin Olaru
2002-04-24