
/*****************************************************************************\

MODULE: mat_zz_p

SUMMARY:

Defines the class matrix(zz_p).

\*****************************************************************************/


#include "matrix.h"
#include "vec_vec_zz_p.h"

matrix_decl(zz_p)

void add(matrix(zz_p)& X, const matrix(zz_p)& A, const matrix(zz_p)& B); 
// X = A + B

void sub(matrix(zz_p)& X, const matrix(zz_p)& A, const matrix(zz_p)& B); 
// X = A - B

void mul(matrix(zz_p)& X, const matrix(zz_p)& A, const matrix(zz_p)& B); 
// X = A * B

void mul(vector(zz_p)& x, const matrix(zz_p)& A, const vector(zz_p)& b); 
// x = A * b

void mul(vector(zz_p)& x, const vector(zz_p)& a, const matrix(zz_p)& B); 
// x = a * B

void mul(matrix(zz_p)& X, const matrix(zz_p)& A, zz_p b);
// X = A * b


void determinant(zz_p& d, const matrix(zz_p)& A);
// d = determinant(A)

void transpose(matrix(zz_p)& X, const matrix(zz_p)& A);
// X = transpose of A

void solve(zz_p& d, vector(zz_p)& X,
           const matrix(zz_p)& A, const vector(zz_p)& b);
// A is an n x n matrix, b is a length n vector.
// Computes d = determinant(A).
// If d != 0, solves x*A = b.

void inv(zz_p& d, matrix(zz_p)& X, const matrix(zz_p)& A);
// A is an n x n matrix.
// Computes d = determinant(A).
// If d != 0, computes X = A^{-1}.


void ident(matrix(zz_p)& X, long n);
// X = n x n identity matrix

long IsIdent(const matrix(zz_p)& A, long n);
// test if A is the n x n identity matrix

void diag(matrix(zz_p)& X, long n, zz_p d);
// X = n x n diagonal matrix with d on diagonal

long IsDiag(const matrix(zz_p)& A, long n, zz_p d);
// test if X is an  n x n diagonal matrix with d on diagonal



long gauss(matrix(zz_p)& M);
long gauss(matrix(zz_p)& M, long w);
// Performs unitary row operations so as to bring
// M into row echelon form.
// If the optional argument w is supplied,
// stops when first w columns are in echelon form.
// The return value is the rank (or the rank of
// the first w columns).

void image(matrix(zz_p)& X, const matrix(zz_p)& A);
// The rows of X are computed as basis of A's row space.
// X is is row echelon form

void kernel(matrix(zz_p)& X, const matrix(zz_p)& A);
// Computes a basis for the kernel of the map
// x -> x*A. where x is a row vector.


