MeatAxe: Other Kernel Functions

MeatAxe 2.4

- Main Page
- Related Pages
- Modules
- Data Structures

Functions
Other Kernel Functions

## Functions
int | SysReadLong32 (FILE *f, long *buf, int n)
| Read long integers.
int | SysWriteLong32 (FILE *f, const long *buf, int n)
| Write long integers.
int | FfSumAndIntersection (PTR wrk1, int *nor1, int *nor2, PTR wrk2, int *piv)
| Sum and Intersection of Two Vector Spaces.
int | FfCmpRows (PTR p1, PTR p2)
| Compare two Rows.
void | FfPermRow (PTR row, const long *perm, PTR result)
| Multiply a Vector by a Permutation.

## Function Documentation

int FfCmpRows | ( | PTR | p1,
|  | PTR | p2
| ) |  |

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.

Parameters:

  p1 | Pointer to the first matrix.
  p2 | Pointer to the second matrix.

Returns:
  The function returns 0 if the two rows are identical. Otherwise the return value is different from 0.

void FfPermRow | ( | PTR | row,
|  | const long * | perm,
|  | PTR | result
| ) |  |

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.

int FfSumAndIntersection | ( | PTR | wrk1,
|  | int * | nor1,
|  | int * | nor2,
|  | PTR | wrk2,
|  | int * | piv
| ) |  |

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:

- Both workspaces must have n₁+n₂ rows, where n₁ and n₂ are the number of generating vectos for the two subspaces.
- Workspace 1 must contain the concatenation of the generating sets for the two subspaces. Work space 2 need not be initialized.
- The pivot table, must be large enough for at least n₁+n₂ entries. It need not be initialized.

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.

Parameters:

  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.

Returns:
  0 on success, -1 on error.

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:

- The conversion to and from machine-independent format involves several arithmetic operations for each number read/written.
- The highest number which can be read/written is 232-1.
  Parameters:

    f | File to read from.
    buf | Pointer to buffer.
    n | Number of integers to read.

  Returns:
    Number of integers that were actually read, or $/1$ on error.

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().

Parameters:

  f | File to write to.
  buf | Pointer to buffer.
  n | Number of integers to write.

Returns:
  Number of integers that were written, or $-1$ on error.