#include <stdio.h>
#include "alpha.h"

int main()
{
    AlphaMatrix A, L, L1, U;
    int m, n, r;
    arena_info *arena = a_arena_make ();

    scanf ("%d%d", &m, &n);
    A = a_make_matrix (arena, m, n);
    L = a_make_matrix (arena, m, n);
    L1 = a_make_matrix (arena, m, n);
    U = a_make_matrix (arena, n, n);

    a_read_matrix (stdin, A);
    a_copy_mx(L,A);
    a_lower_echelon (arena, L, U, &r);


    /*
     * test is the answer is right: A*U must be == L1
     */
    a_matmult (arena,A, U, L1);
    
    /* see coments in a-io.h */
    a_fprintf (stdout, "r == %d\nA == %M\nL == %M\nL1 == %M\nU == %M\n",
	       r, A, L, L1, U);
    
    /*
      a_dump_matrix (stdout, A);
      a_dump_matrix (stdout, L);
      a_dump_matrix (stdout, L1);
      a_dump_matrix (stdout, U);
      */
    a_arena_free (arena);
    
    return 0;
}


