There is a generic output operator for all kinds of matrices, but it deliberately does not apply to standard streams by default. You must add a small decoration:
Code: Select all
wrap(outputFile) << "SparseMatrix: "<< someSparseMatrix;
BTW, cout that you see everywhere in polymake is not std::cout but an output channel redirected to perl STDOUT, so that the entire output appears in proper order regardless of being produced in a C++ function or by a perl print statement.
If you are going to read the data later in other functions within polymake realm, I'd recommend to use save_data() instead of plain text printing. In complex cases like matrices with polynomial coefficients the latter may produce an output which can't be parsed later, while the XML files are guaranteed to be understood without any information lost even after several version upgrades. But if it's just about producing a logfile or an input to another software system, then it's surely fine to use plain text.