/*
  linear_algebra.h                  
  header file for CMSC443 project 1, Spring 2000
  Josh Arenberg 
  Created March 3, 2000         
  Last modified March 29, 2000     

linear_algebra is a rewrite of an older project that
implements some basic linear algebra functions 
in a chosen mod system.  The user can read in a matrix, 
matrices, or a linear system and specify a modulus.  As 
such, the user can also specify matrix multiplication, a 
solution of a linear system, or calculation of the inverse 
(if it exists) of a given matrix with respect to any mod system.
If the matrix is singular a message is given.

This program improves on error-handling, is slightly more modular,
and adds some much-needed documentation.  Also, the user now has the option
of writing results out to a file if desired.
*/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

#ifndef MAXCHARS
#define MAXCHARS 30        /*  maximum filename size for outputs */
#endif


/* Menu() provides a basic menu of linear algebra operations */
void Menu (void);

/* function MatrixOp gets size of nxn matrices, the desired mod system, and builds
   the arrays */
void MatrixOp(int s);

/* function Modulo converts resultant values of matrix algebra to a particular modulus */
int* Modulo(int m[],int r);

/* function Mem allocates contiguous memory for 2-D arrays to store matrices */
int** Mem(int n);

/* function Multiply multiplies two matrices and returns the resultant vector */
int** Multiply(int **a,int **b,int r,int n);

/* function Invert finds a matrix's inverse or reports singularity */
int** Invert(int **a,int m[],int r,int n);

/* function Solve solves the linear system Ax = b for the vector x by solving
   the equivalent x = A~1b  (inverse of A x b) */
int** Solve(int **a,int **b,int m[],int r,int n);

/* function Results handles printing of vectors solutions and resultant matrices */
int Results(int n, int **c,int sol_type);


