
bool p_psImagePrint (int fd, psImage *a, char *name)
{
    char line[1024];

    sprintf (line, "matrix: %s\n", name);
    write (fd, line, strlen(line));

    for (int j = 0; j < a[0].numRows; j++) {
	for (int i = 0; i < a[0].numCols; i++) {
	    sprintf (line, "%f  ", p_psImageGetElementF64(a, i, j));
	    write (fd, line, strlen(line));
	}
	sprintf (line, "\n");
	write (fd, line, strlen(line));
    }
    sprintf (line, "\n");
    write (fd, line, strlen(line));

    return (true);
}

bool p_psVectorPrint (int fd,
		      psVector *a,
		      char *name)
{
    char line[1024];

    sprintf (line, "vector: %s\n", name);
    write (fd, line, strlen(line));

    for (int i = 0; i < a[0].n; i++) {
	sprintf (line, "%f\n", p_psVectorGetElementF64(a, i));
	write (fd, line, strlen(line));
    }
    sprintf (line, "\n");
    write (fd, line, strlen(line));
    return (true);
}
