MeatAxe  2.4
Programs for working with modular representations
Finite Fields

Detailed Description

The finite field part of the kernel provides finite field arithmetic and basic operations with vectors and matrices over finite fields.

The kernel cannot operate simultaneously with different finite fields, because there is a global row size and a global field order which must be maintained by the higher layers.

There are two finite field modules available: one for small fields (up to 256) and one for larger fields (up to 216). The finite field module is selected at compile time.

'Small' Kernel (q≤256)
In the "small" kernel, field elements of GF(q) are represented by the numbers 0,1,...,q-1. The field is defined by its Conway polynomial p(x)∈ℤₚ[x], where q=pⁿ (see [HEBA05]). Thus, we have a one-to-one correspondence of field elements a∈GF(q) and polynomials fₐ(x)∈ℤₚ[x] of degree less than n. By treating ℤₚ as a subset of ℤ — actually, on the computer, elements of ℤₚ are represented by integers — this is also a polynomial over *ℤ. Now, calculate f_a(p) giving the number of the field element a. It follows that the elements of the prime field are represented by 0,1,...p-1. The number 0 represents the zero element, and 1 represents the unit element.
Packed rows....
'Big' Kernel (q≤65536)
The big version stores field elements in 16-bit integers, i.e., each field element occupies two bytes. Non-zero elements are stored as their logarithms with respect to a fixed generator. In particular, the unit element is represented by the integer 0. The zero element is represented by the special value 0xFFFF.

As a consequence of the different representations of field elements in the small and big version, there are some rules which should be respected by all programs:

FEL and PTR
The kernel defines two basic data types: FEL represents a single field element, and PTR is a pointer to a row vector. PTR may be defined as *FEL, but this is not mandatory.
The kernel also defines two constants: FF_ZERO is the zero element of the current field, and FF_ONE is unit element of the current field. Depending on which kernel you are using, FF_ZERO and FF_ONE may be constants, or they may be defined as variables or function calls.
Embedding of subfields
In the MeatAxe there is a `standard' generator for each finite field. The generator for the field currently in use is available in the FfGen variable. Thus, if a and a' are the MeatAxe generators of GF(q) and GF(q'), respectively, and q'=qⁿ, there is a standard embedding of GF(q) into GF(q') defined by $a↪a'ⁿ. However, field elements which are identified under this embedding are usually not represented by the same number. For this reason there are two functions, FfEmbed() and FfRestrict(), which provide the embedding of subfields into the current field. Note that the MeatAxe is not well suited for calculations involving different fields at the same time because the arithmetic uses lookup tables which are specific to each field
Here is a short example. The following code converts a vector over GF(3) to GF(27). The MeatAxe cannot handle two fields at the same time, so it is necessary to unpack the row over GF(3), change to GF(27) and pack the embedded elements into a new row.
PTR row1, row2;
FEL buf[10];
...
FfSetField(10);
for (i = 0; i < 10; ++i) buf[i] = FfExtract(row1,i);
for (i = 0; i < 10; ++i) FfInsert(row2,i,FfEmbed(buf[i],3));
Row vectors and row operations
A (row) vector is stored in memory as an array of bytes. The actual size of a row depends on the number of marks in the row and on the field order, because several field elements may be packed into one byte. However, the size is always a multiple of sizeof(long). Unused bytes at the end of a row (and even the unused bits in partially used bytes) must always be filled with zeroes. Otherwise, some functions as FfCmpRows() may produce wrong results.
Packing of field elements is used for field orders less than 17. Let q be the field order and m the largest natural number with qm≤256. Then, m elements k0,...kn-1 are packed into one byte as k0+k1q+k2q2+... Packing of field elements is used exclusively for rows (vectors), not for polynomials or other data types.
Because of packing you cannot access the marks of a row with the usual bracket notation. Instead, the MeatAxe library provides functions which store and extract marks.
Packed rows must be initialized before they are used. FfInsert() (and many other row operations) will produce strange results if used with uninitialized rows. Memory is initialized automatically in the following cases: allocation with FfAlloc(), copying a row with FfCopyRow(), reading a row from a file. A row can be initialized manually by multiplication with zero: FfMulRow(ptr,FF_ZERO). The latter works even if no field has been selected.
All row operations at kernel level use a global row size which can be set with FfSetNoc(). The current row size is available in the global variable FfNoc.
Matrices
A matrix is stored as a sequence of rows with no extra space between them. The rows and columns of a matrix are numbered 0,1,2,...n-1. Column vectors may be stored as matrices with one column but because of the padding each mark of the vector will occupy a long int.

Macros

#define FF_ZERO   ((FEL)0)
 The zero field element.
 
#define FF_ONE   ((FEL)1)
 The unit element.
 

Typedefs

typedef unsigned char FEL
 A finite field element.
 
typedef FELPTR
 A pointer to a row vector.
 

Functions

int FfReadRows (FILE *f, PTR buf, int n)
 Read Rows This function reads 1 or more rows from a file. More...
 
int FfWriteRows (FILE *f, PTR buf, int n)
 Write rows This function writes 1 or more rows to a file. More...
 
int FfSeekRow (FILE *f, int pos)
 Move to a Row. More...
 
FILE * FfReadHeader (const char *name, int *field, int *nor, int *noc)
 Open File and Read Header. More...
 
FILE * FfWriteHeader (const char *name, int field, int nor, int noc)
 Open file and write header. More...
 
FEL FfAdd (FEL a, FEL b)
 Finite field addition. More...
 
FEL FfSub (FEL a, FEL b)
 Finite field subtraction. More...
 
FEL FfMul (FEL a, FEL b)
 Finite field multiplication. More...
 
FEL FfDiv (FEL a, FEL b)
 Finite field division. More...
 
FEL FfNeg (FEL a)
 Finite field negative. More...
 
FEL FfInv (FEL a)
 Finite field inversion. More...
 
int FfSetField (int field)
 Sets the field order. More...
 
int FfSetNoc (int noc)
 Set the row length. More...
 
void FfAddMulRow (PTR dest, PTR src, FEL f)
 Add a multiple of a row. More...
 
PTR FfAddRow (PTR dest, PTR src)
 Add two rows. More...
 
PTR FfAddRowPartial (PTR dest, PTR src, int first, int len)
 Add a part two rows. More...
 
PTR FfAlloc (int nor)
 Allocate memory and initialize This function allocates a block of memory for a vector (if nrows is 1) or a matrix. More...
 
int FfCmpRows (PTR p1, PTR p2)
 Compare two rows. More...
 
void FfCleanRow (PTR row, PTR matrix, int nor, const int *piv)
 Clean Row. More...
 
void FfCleanRow2 (PTR row, PTR mat, int nor, const int *piv, PTR row2)
 Clean Row and Record Operations. More...
 
void FfCleanRowAndRepeat (PTR row, PTR mat, int nor, const int *piv, PTR row2, PTR mat2)
 Clean Row and Repeat Operations. More...
 
void FfCopyRow (PTR dest, PTR src)
 Copy a row. More...
 
FEL FfEmbed (FEL a, int subfield)
 Embed a subfield. More...
 
FEL FfExtract (PTR row, int col)
 Extract a mark from a row This function returns the entry at position col of row. More...
 
void FfExtractColumn (PTR mat, int nor, int col, PTR result)
 Extract one column of a matrix. More...
 
int FfFindPivot (PTR row, FEL *mark)
 Find pivot column. More...
 
void FfFree (PTR x)
 Free memory. More...
 
FEL FfFromInt (int l)
 Convert integer to field element. More...
 
PTR FfGetPtr (PTR base, int row)
 Get row pointer. More...
 
void FfInsert (PTR row, int col, FEL mark)
 Insert a mark into a row This function inserts the field element mark at position col into row. More...
 
void FfMulRow (PTR row, FEL mark)
 Multiply a row by a coefficient. More...
 
FEL FfRestrict (FEL a, int subfield)
 Restrict to a subfield. More...
 
size_t FfRowSize (int noc)
 Calculate row size. More...
 
FEL FfScalarProduct (PTR a, PTR b)
 Scalar Product of Two Vectors. More...
 
int FfStepPtr (PTR *x)
 Advance to next row. More...
 
void FfSwapRows (PTR dest, PTR src)
 Exchange two rows This function exchanges the contents of two rows. More...
 
const char * FfToGap (FEL f)
 Convert to GAP format. More...
 
int FfToInt (FEL f)
 Convert field element to integer. More...
 
size_t FfTrueRowSize (int noc)
 Number of used bytes in a row. More...
 
int FfSumAndIntersection (PTR wrk1, int *nor1, int *nor2, PTR wrk2, int *piv)
 Sum and Intersection of Two Vector Spaces. More...
 
void FfPermRow (PTR row, const long *perm, PTR result)
 Multiply a Vector by a Permutation. More...
 

Variables

int FfOrder
 The current field order. More...
 
int FfChar
 Characteristic of the current field. More...
 
FEL FfGen
 Field generator. More...
 
int FfNoc
 Current row size. More...
 
size_t FfCurrentRowSize
 The number of bytes occupied by a single row in memory. More...
 

Function Documentation

FfAdd ( FEL  a,
FEL  b 
)

Finite field addition.

This function returns the sum of two field elements. Before calling FfAdd(), the field must have been selected with FfSetField(). The arguments are not checked. If either argument is not in the allowed range the result is undefined and the program may crash. FfAdd() may be implemented as a macro. In this case, it is guaranteed that both arguments are evaluated exactly once.

void FfAddMulRow ( PTR  dest,
PTR  src,
FEL  f 
)

Add a multiple of a row.

This function adds a multiple of src to dest.

PTR FfAddRow ( PTR  dest,
PTR  src 
)

Add two rows.

This function adds src to dest. Field order and row size must have been set before.

Parameters
destThe row to add to.
srcThe row to add.
Returns
Always returns dest.
PTR FfAddRowPartial ( PTR  dest,
PTR  src,
int  first,
int  len 
)

Add a part two rows.

This works like FfAddRow(), but the operation is performed only on a given range of columns. Note that the working range is not specified as column indexes but in units of long integers!

Parameters
destThe row to add to.
srcThe row to add.
firstNumber of long integers to skip.
lenNumber of long integers to add.
Returns
Always returns dest.
PTR FfAlloc ( int  nrows)

Allocate memory and initialize This function allocates a block of memory for a vector (if nrows is 1) or a matrix.

Memory is initialized to zero. Field order and row size must have been set with FfSetField() and FfSetNoc(), respectively. nrows may be zero zero, i which case the functin returns a memory block of size zero which must be freed using FfFree().

Parameters
nrowsNumber of rows.
Returns
Pointer to the memory block or NULL on error.
void FfCleanRow ( PTR  row,
PTR  matrix,
int  nor,
const int *  piv 
)

Clean Row.

This function performs a Gaussian elimination, i.e., it adds suitable multiples of the rows of matrix to row such that all pivot positions are zero. piv is the pivot table for matrix. As usual, all indexes are 0-based, i.e., piv[0] is the pivot column of the first row, and for a unit matrix we have piv[0]==0. The field and row size must have been set before calling this function.

Parameters
rowThe row to be cleaned.
matrixPointer to the matrix.
norNumber of rows of the matrix.
pivThe pivot table.
void FfCleanRow2 ( PTR  row,
PTR  mat,
int  nor,
const int *  piv,
PTR  row2 
)

Clean Row and Record Operations.

This function works like FfCleanRow(), but it stores a record of the operations performed in row2. row2 must be a row of at least nor entries. On return, row2 contains the coefficients by which the rows of mat were multiplied and then subtracted from row. Before calling FfCleanRow2(), the caller must initialize row2 to zero. Otherwise the results are undefined.

Parameters
rowPointer to row to be cleaned.
matMatrix to clean with.
norNumber of rows.
pivPivot table for matrix.
row2Pointer to row where the operations are recorded.
Returns
Always 0.
void FfCleanRowAndRepeat ( PTR  row,
PTR  mat,
int  nor,
const int *  piv,
PTR  row2,
PTR  mat2 
)

Clean Row and Repeat Operations.

This function works like FfCleanRow(), but repeats all operations on a second row/matrix.

Parameters
rowPointer to row to be cleaned.
matMatrix to clean with.
norNumber of rows.
pivPivot table for mat.
row2Pointer to the second row to be cleaned.
mat2Matrix to the second matrix.
Returns
Always 0.
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
p1Pointer to the first matrix.
p2Pointer to the second matrix.
Returns
The function returns 0 if the two rows are identical. Otherwise the return value is different from 0.
void FfCopyRow ( PTR  dest,
PTR  src 
)

Copy a row.

This function copies the contents of one row to another row. As with all row operations, the row length must have been set before with |FfSetNoc()|.

Parameters
destPointer to the destination.
srcPointer to the source.
FfDiv ( FEL  a,
FEL  b 
)

Finite field division.

This function returns the quotient of two field elements. Before calling FfDiv(), the field must have been selected with FfSetField(). The arguments are not checked. If either argument is not in the allowed range or if the denominator is zero, the result is undefined and the program may crash. FfDiv() may be implemented as a macro. In this case, it is guaranteed that both arguments are evaluated exactly once.

FEL FfEmbed ( FEL  a,
int  subfield 
)

Embed a subfield.

Parameters
aElement of the subfield field.
subfieldSubfield order. Must be a divisor of the current field order.
Returns
a, embedded into the current field.
FEL FfExtract ( PTR  row,
int  col 
)

Extract a mark from a row This function returns the entry at position col of row.

Note that column indexes start with 0, i.e., FfExtract(row,0) returns the first entry. Like FfInsert(), this function does not depend on the current row size. The index, col, is not checked. Reading at negative positions or beyond the end of the row results in undefined behaviour.

Parameters
rowPointer to the row.
colIndex of mark to extract (0 based).
Returns
The specified mark
See also
FfInsert
void FfExtractColumn ( PTR  mat,
int  nor,
int  col,
PTR  result 
)

Extract one column of a matrix.

This function extracts one column out of a matrix and converts it into a row vector. The number of columns of the matrix must have been set with FfSetNoc(), and the number of rows must be passed in the call. The result is a row with nor entries, and the output buffer, result, must be large enough to store a vector of this size. mat and result must not overlap. If they do, the result is undefined.

Parameters
matPointer to the matrix.
norNumber of rows in matrix.
colColumn to extract (starting with 0).
resultPointer to buffer for the extracted column.
int FfFindPivot ( PTR  row,
FEL mark 
)

Find pivot column.

This function finds the first non-zero mark in a row vector. The mark is stored into *mark and its position (counting from 0) is returned. If the whole vector is zero, FfFindPivot() returns -1 and leaves *mark unchanged.

Parameters
rowPointer to the row.
markBuffer for pivot element.
Returns
Index of the first non-zero entry in row or -1 if all entries are zero.
void FfFree ( PTR  x)

Free memory.

This function frees a block of memory that has been allocated with FfAlloc() before. If the argument is 0, FfFree() does nothing.

Parameters
xPointer to memory.
FEL FfFromInt ( int  l)

Convert integer to field element.

This function converts an integer to a field element using the same mapping as explained under FfToInt(). Both functions are inverse in the sense that the expression f == FfFromInt(FfToInt(f)) is always true for valid field elements. FfFromInt() should be used whenever field elements are to be read with scanf().

PTR FfGetPtr ( PTR  base,
int  row 
)

Get row pointer.

This function returns a pointer to the |nor|-th row of a matrix, assuming the current row size. |base| must be a pointer to the beginning of a row, but this need not be the first row of the matrix. For example, the following code steps through the odd rows of a matrix:

1 PTR r = matrix;
2 int i;
3 for (i = 1; i < nrows; i += 2)
4 {
5  r = FfGetPtr(r,2);
6  ...
7 }

Note: The function does not check if the resulting pointer is still inside the matrix.

See also
FfStepPtr()
Parameters
basePointer to the first row of the matrix.
rowRow index.
void FfInsert ( PTR  row,
int  col,
FEL  mark 
)

Insert a mark into a row This function inserts the field element mark at position col into row.

Column indexes start with 0. Before this function can be used, the field must be selected with FfSetField(). FfInsert() does not need the row size beeing set correctly. For example, if you are working with rows of different size, you do not have to call FfSetNoc() prior to each FfInsert(). On the other hand, there is no protection against writing beyond the end of a row.

If the MeatAxe is compiled with the DEBUG option FfInsert() checks that mark is a valid field element and col is not negative. If also the PARANOID option was in effect during compilation, FfInsert() also checks if col is less than or equal to the current row size.

Parameters
rowPointer to the row.
colInsert position (0-based).
markValue to insert.
FfInv ( FEL  a)

Finite field inversion.

This function returns the multiplicative inverse a field element. Before calling FfInv(), the field must have been selected with FfSetField(). The argument is not checked. If you pass an invalid value or zero, the result is undefined and the program may crash. FfInv() may be implemented as a macro. In this case, it is guaranteed that the argument is evaluated exactly once.

FfMul ( FEL  a,
FEL  b 
)

Finite field multiplication.

This function returns the product of two field elements. Before calling FfMul(), the field must have been selected with FfSetField(). The arguments are not checked. If either argument is not in the allowed range the result is undefined and the program may crash. FfMul() may be implemented as a macro. In this case, it is guaranteed that both arguments are evaluated exactly once.

void FfMulRow ( PTR  row,
FEL  mark 
)

Multiply a row by a coefficient.

This function multiplies each element of row by mark. The row size and field order must have been set before. Multiplying a row with zero (FF_ZERO) initializes all elements to zero and is permitted even if row points into uninitialized memory.

FfNeg ( FEL  a)

Finite field negative.

This function returns the additive inverse a field element. Before calling FfInv(), the field must have been selected with FfSetField(). The argument is not checked. If you pass an invalid value, the result is undefined and the program may crash. FfNeg() may be implemented as a macro. In this case, it is guaranteed that the argument is evaluated exactly once.

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.

FILE * FfReadHeader ( const char *  name,
int *  field,
int *  nor,
int *  noc 
)

Open File and Read Header.

This function opens a data file for input and reads the file header (3 integers). The exact meaning of the header values depends on the file type. For a matrix they are field order, number of rows and number of columns. See File Formats for details.

Parameters
nameFile name.
fieldPointer to buffer for first header entry (usually the field order).
norPointer to buffer for second header entry (usually the number of rows).
nocPointer to buffer for third header entry (usually the number of columns).
Returns
Pointer to open file, or 0 on error.
int FfReadRows ( FILE *  f,
PTR  buf,
int  n 
)

Read Rows This function reads 1 or more rows from a file.

The row size must have been set before.

Parameters
fPointer to File.
bufPointer to data buffer.
nNumber of rows to read.
Returns
Number of rows that were actually read, or -1 on error.
FEL FfRestrict ( FEL  a,
int  subfield 
)

Restrict to a subfield.

This function restricts a field element from the current field to a subfield. The return value represents the same element as a but with respect to the subfield. In general, the element has a different integer representation in the subfield. Consequently, you cannot use the return value for field arithmetic until you change to the subfield with Of course, the argument must be an element of the subfield. Otherwise the result is undefined. FfSetField(subfield).

Parameters
aElement of the current field.
subfieldSubfield order. Must be a divisor of the current field order.
size_t FfRowSize ( int  noc)

Calculate row size.

Returns the number of bytes occupied in memory by a row of noc Elements. The row size is always a multiple of sizeof(long). Depending on the number of columns there may be unused padding bytes at the end of the row.

FEL FfScalarProduct ( PTR  a,
PTR  b 
)

Scalar Product of Two Vectors.

Given two vectors \(a=(a_i)\) and \(b=(b_i)\), this function calculates the scalar product \(p=\sum_ia_ib_i\).

Parameters
aThe first vector.
bThe second vector.
Returns
Scalar product of the two vectors.
int FfSeekRow ( FILE *  f,
int  pos 
)

Move to a Row.

This function sets the read/write pointer of file f to position pos. I.e., the next FfReadRows() or FfWriteRows() will start at the specified row. Note that row numbers start with 0. If pos is different from 0, the row size must have been set before with FfSetNoc().

You should always use FfSeekRow() rather than fseek() because FfSeekRow() knows about MeatAxe file headers and adjusts the file pointer appropriately.

Parameters
fPointer to File.
posRow number (0-based).
Returns
0 on success, -1 on error.
int FfSetField ( int  field)

Sets the field order.

This function sets the current field to GF(field) and initializes the field arithmetic. Most kernel functions require that a field has been selected before they are used.

Parameters
fieldField order.
Returns
0 on success, -1 otherwise.
int FfSetNoc ( int  noc)

Set the row length.

This function sets the current row size, which is used for low-level row operations such as FfAddRow().

Parameters
nocNumber of columns.
Returns
0 on success, -1 otherwise.
int FfStepPtr ( PTR x)

Advance to next row.

This function increments a pointer by 1 row. The row size must have been set before with FfSetNoc(). FfStepPtr(&x) is equivalent to x = FfGetPtr(x,1). It is typically used to step through the rows of a matrix. Here is an example with a 100 by 40 matrix:

1 PTR r, mat;
2 int i;
3 FfSetNoc(40);
4 mat = FfAlloc(100);
5 for (i = 1, r = mat; i < 100; ++i, FfStepPtr(&r))
6  ...
See also
FfGetPtr()
Parameters
xPointer to the row pointer.
Returns
Always 0.
FfSub ( FEL  a,
FEL  b 
)

Finite field subtraction.

This function returns the difference of two field elements. Before calling FfSub(), the field must have been selected with FfSetField(). The arguments are not checked. If either argument is not in the allowed range the result is undefined and the program may crash. FfSub() may be implemented as a macro. In this case, it is guaranteed that both arguments are evaluated exactly once.

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
wrk1Workspace 1.
nor1Input: number of generators for V, output: dim(V+W).
nor2Input: number of generators for W, output: dim(V∩W).
wrk2Workspace 2.
pivPivot table.
Returns
0 on success, -1 on error.
void FfSwapRows ( PTR  dest,
PTR  src 
)

Exchange two rows This function exchanges the contents of two rows.

As with all row operations, the row length must have been set before with |FfSetNoc()|.

Parameters
destPointer to the first row
srcPointer to the second row
const char* FfToGap ( FEL  f)

Convert to GAP format.

This function takes a field element and returns the GAP representation of this element. The return value is a pointer to a static buffer which is overwritten on each call.

Parameters
fField element.
Returns
Pointer to the GAP representtion of f.
int FfToInt ( FEL  f)

Convert field element to integer.

This function converts a field element to an integer, using a "canonical" representation of field elements as integers which may be different from the internal representation. In particular, the prime field is mapped on {0,...p-1} with 0 representing the zero element and 1 the unit element. FfToInt() should be used whenever field elements are to be written with printf().

size_t FfTrueRowSize ( int  noc)

Number of used bytes in a row.

This function returns the number of bytes that are actually used by a row of noc Elements, i.e., without counting the padding bytes. This number is less than or equal to FfRowSize(noc).

FILE * FfWriteHeader ( const char *  name,
int  field,
int  nor,
int  noc 
)

Open file and write header.

This function opens a data file for input and writes the the file header. If the file does not exist, a new file is created. If the file exists it is overwritten.

Parameters
nameFile name.
fieldFirst header entry (usually the field order).
norSecond header entry (usually the number of rows).
nocThird header entry (usually the number of columns).
Returns
Pointer to open file, or |NULL| on error.
int FfWriteRows ( FILE *  f,
PTR  buf,
int  n 
)

Write rows This function writes 1 or more rows to a file.

The row size must have been set before.

Parameters
fPointer to File.
bufPointer to data buffer.
nNumber of rows to write.
Returns
The number of rows that were successully written. A return value different from |n| indicates an error.

Variable Documentation

int FfChar

Characteristic of the current field.

Like FfOrder, this variable may be used anywhere, but it must not be modified directly.

size_t FfCurrentRowSize

The number of bytes occupied by a single row in memory.

Equal to FfRowSize(FfNoc) and always a multiple of sizeof(long).

FEL FfGen

Field generator.

This variable contains a generator for the multiplicative group of the current field.

int FfNoc

Current row size.

Used by all low-level row operations. FfNoc is updated automatically when the row size is changed with FfSetNoc().

int FfOrder

The current field order.

May be used in expressions but must never modified directly. To change the field, use FfSetField().


MeatAxe 2.4 documentation, generated on Wed Jan 7 2015 08:38:36