| 1 |
|
|---|
| 2 | bool p_psImagePrint (int fd, psImage *a, char *name)
|
|---|
| 3 | {
|
|---|
| 4 | char line[1024];
|
|---|
| 5 |
|
|---|
| 6 | sprintf (line, "matrix: %s\n", name);
|
|---|
| 7 | write (fd, line, strlen(line));
|
|---|
| 8 |
|
|---|
| 9 | for (int j = 0; j < a[0].numRows; j++) {
|
|---|
| 10 | for (int i = 0; i < a[0].numCols; i++) {
|
|---|
| 11 | sprintf (line, "%f ", p_psImageGetElementF64(a, i, j));
|
|---|
| 12 | write (fd, line, strlen(line));
|
|---|
| 13 | }
|
|---|
| 14 | sprintf (line, "\n");
|
|---|
| 15 | write (fd, line, strlen(line));
|
|---|
| 16 | }
|
|---|
| 17 | sprintf (line, "\n");
|
|---|
| 18 | write (fd, line, strlen(line));
|
|---|
| 19 |
|
|---|
| 20 | return (true);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | bool p_psVectorPrint (int fd,
|
|---|
| 24 | psVector *a,
|
|---|
| 25 | char *name)
|
|---|
| 26 | {
|
|---|
| 27 | char line[1024];
|
|---|
| 28 |
|
|---|
| 29 | sprintf (line, "vector: %s\n", name);
|
|---|
| 30 | write (fd, line, strlen(line));
|
|---|
| 31 |
|
|---|
| 32 | for (int i = 0; i < a[0].n; i++) {
|
|---|
| 33 | sprintf (line, "%f\n", p_psVectorGetElementF64(a, i));
|
|---|
| 34 | write (fd, line, strlen(line));
|
|---|
| 35 | }
|
|---|
| 36 | sprintf (line, "\n");
|
|---|
| 37 | write (fd, line, strlen(line));
|
|---|
| 38 | return (true);
|
|---|
| 39 | }
|
|---|