python/pycubool/vector.py
def to_string(self, width=3):
        """
        Return a string representation of the vector.

        >>> vector = Vector.from_list(4, [0, 1, 3], is_sorted=True, no_duplicates=True)
        >>> print(vector)
        '
          0 |   1 |   0
          1 |   1 |   1
          2 |   . |   2
          3 |   1 |   3
        '

        :param width: Width of the field in chars where to put numbers of rows
        :return: Vector string representation
        """

        nrows = self.nrows
        nvals = self.nvals
        rows = self.to_list()

        cell_empty = "."
        cell_filled = "1"
        cell_sep = " "
        format_str = "{:>%s}" % width

        result = ""

        v = 0
        for i in range(nrows):
            line = format_str.format(i) + " |" + cell_sep
            if v < nvals and rows[v] == i:
                line += format_str.format(cell_filled) + cell_sep
                v += 1
            else:
                line += format_str.format(cell_empty) + cell_sep
            line += "| " + format_str.format(i) + "\n"
            result += line

        result += "\n"
        return result

        Return a string representation of the vector.

        >>> vector = Vector.from_list(4, [0, 1, 3], is_sorted=True, no_duplicates=True)
        >>> print(vector)
        '
          0 |   1 |   0
          1 |   1 |   1
          2 |   . |   2
          3 |   1 |   3
        '

        :param width: Width of the field in chars where to put numbers of rows
        :return: Vector string representation
        
Return a string representation of the vector.
Return a string representation of the vector .
def to_string(self, width=3):
        nrows = self.nrows
        nvals = self.nvals
        rows = self.to_list()
        cell_empty = "."
        cell_filled = "1"
        cell_sep = " "
        format_str = "{:>%s}" % width
        result = ""
        v = 0
        for i in range(nrows):
            line = format_str.format(i) + " |" + cell_sep
            if v < nvals and rows[v] == i:
                line += format_str.format(cell_filled) + cell_sep
                v += 1
            else:
                line += format_str.format(cell_empty) + cell_sep
            line += "| " + format_str.format(i) + "\n"
            result += line
        result += "\n"
        return result
def to_string ( self , width = 3 ) : nrows = self . nrows nvals = self . nvals rows = self . to_list ( ) cell_empty = "." cell_filled = "1" cell_sep = " " format_str = "{:>%s}" % width result = "" v = 0 for i in range ( nrows ) : line = format_str . format ( i ) + " |" + cell_sep if v < nvals and rows [ v ] == i : line += format_str . format ( cell_filled ) + cell_sep v += 1 else : line += format_str . format ( cell_empty ) + cell_sep line += "| " + format_str . format ( i ) + "\n" result += line result += "\n" return result
Return a string representation of the vector.
Return a string representation of the vector .
"""
        Return a string representation of the vector.

        >>> vector = Vector.from_list(4, [0, 1, 3], is_sorted=True, no_duplicates=True)
        >>> print(vector)
        '
          0 |   1 |   0
          1 |   1 |   1
          2 |   . |   2
          3 |   1 |   3
        '

        :param width: Width of the field in chars where to put numbers of rows
        :return: Vector string representation
        """
Vector string representation
Vector string representation
self
width
Width of the field in chars where to put numbers of rows
Width of the field in chars where to put numbers of rows