SharedMeatAxe
1.0
|
Functions | |
int | SysReadLong32 (FILE *f, long *buf, int n) |
Read long integers. More... | |
int | SysWriteLong32 (FILE *f, const long *buf, int n) |
Write long integers. More... | |
int | FfSumAndIntersection (PTR wrk1, int *nor1, int *nor2, PTR wrk2, int *piv) |
Sum and Intersection of Two Vector Spaces. More... | |
int | FfCmpRows (PTR p1, PTR p2) |
Compare two Rows. More... | |
void | FfPermRow (PTR row, const long *perm, PTR result) |
Multiply a Vector by a Permutation. More... | |
Compare two Rows.
This function compares two row vectors. As with all row operations, the row length must have been set before with FfSetNoc(). The return value is negative if the first row is "less" than the second row, and it is positive if the first row is "greater" than the second row. However, the ordering defined by FfCmpRows() depends on the internal representation of finite field elements and can differ between dirrerent kernels or between different hardware architectures.
p1 | Pointer to the first matrix. |
p2 | Pointer to the second matrix. |
Multiply a Vector by a Permutation.
This function multiplies the vector row from the right with the permutation perm and stores the result in result. Multiplication of vectors by permutations is defined as follows: if the permutation maps i to k, then the i-ith mark of the vector is stored in the k-th position of the result.
Note: result and row must not overlap. Otherwise the result is undefined.
Sum and Intersection of Two Vector Spaces.
Given two vector spaces V,W∊Fn, this function calculates the sum and the intersection of the spaces, using the Zassenhaus algorithm. Each of the two spaces is given by a set of generating vectors, which need not be linearly independent. Before calling SumAndIntersection() the caller must allocate and initialize two workspaces and a pivot table:
The variables pointed to by nor1 and nor2 must contain the numbers n₁ and n₂, respectively. On return, *nor1 contains the dimension of V+W, and *nor2 contains the dimension of V∩W. The first dim(V+W) rows of wrk1 contain a basis of V+W, and a basis of V∩W can be found in wrk2 starting at position dim(V+W). Both bases are in echelon form, and piv contains the pivot table for the bases.
wrk1 | Workspace 1. |
nor1 | Input: number of generators for V, output: dim(V+W). |
nor2 | Input: number of generators for W, output: dim(V∩W). |
wrk2 | Workspace 2. |
piv | Pivot table. |
int SysReadLong32 | ( | FILE * | f, |
long * | buf, | ||
int | n | ||
) |
Read long integers.
This function reads @ n long integers from the file f into the array buf. buf must point to a memory area of at least n*sizeof(long) bytes and the file must be open for reading. The return value indicates how many integers have actually been read. This number may be less than n because the end of file was encountered while reading. A negative return value indicates a file i/o error.
SysReadLong32() expects that the numbers in the file are 4-byte integers in little-endian format, i.e. the least significant byte first. Using a machine-independent data format makes MeatAxe data files more portable, but there are also some disadvantages:
f | File to read from. |
buf | Pointer to buffer. |
n | Number of integers to read. |
int SysWriteLong32 | ( | FILE * | f, |
const long * | buf, | ||
int | n | ||
) |
Write long integers.
This function writes n long integers from the the array buf to the file f. buf must point to a memory area of at least n*sizeof(long) bytes and f must be open for writing. The numbers are written in a machine-independent format which can be read by SysReadLong().
f | File to write to. |
buf | Pointer to buffer. |
n | Number of integers to write. |