meplib / cCode / matrices / mpz / mpz-test-matrix.c @ master
Historique | Voir | Annoter | Télécharger (910 octet)
| 1 |
/* test-matrix.c */
|
|---|---|
| 2 |
|
| 3 |
/**
|
| 4 |
* Test program for matrix utilities
|
| 5 |
*
|
| 6 |
* Author:
|
| 7 |
*/
|
| 8 |
|
| 9 |
/* includes of system headers */
|
| 10 |
#include <stdio.h> |
| 11 |
#include <gmp.h> /* For mpz-matrix */ |
| 12 |
|
| 13 |
/* includes of project headers */
|
| 14 |
|
| 15 |
/* includes of local headers */
|
| 16 |
#include "mpz-matrix.h" |
| 17 |
|
| 18 |
/* Types and constant definitions */
|
| 19 |
|
| 20 |
/* Global variables */
|
| 21 |
|
| 22 |
/* Functions */
|
| 23 |
|
| 24 |
int main(int argc, char ** argv) |
| 25 |
{
|
| 26 |
mpz_matrix* mat; |
| 27 |
mpz_t a_mpz_int; |
| 28 |
mat = mpz_matrix_alloc(10,10); |
| 29 |
if (mat == NULL) return(1); |
| 30 |
mpz_init_set_si(a_mpz_int, 5);
|
| 31 |
mpz_matrix_set_at(mat, 5, 5, a_mpz_int); |
| 32 |
mpz_clear(a_mpz_int); |
| 33 |
mpz_init(a_mpz_int); |
| 34 |
mpz_set(a_mpz_int, *mpz_matrix_get_at(mat, 5, 5)); |
| 35 |
mpz_out_str(stdout, 10, a_mpz_int);
|
| 36 |
printf("\n");
|
| 37 |
mpz_matrix_print(stdout, 10, mat);
|
| 38 |
mpz_matrix_free(mat); |
| 39 |
return(0); |
| 40 |
} |