INNER CODE UNIT · Python

from_columns

webartifex/intro-to-python · 11_classes/sample_package/matrix.py:58

    def from_columns(cls, data):
        """Create a new matrix.

        This is an alternative constructor for data provided in column-major order.

        Args:
            data (sequence of sequences): the matrix's entries;
                viewed as a sequence of the matrix's columns (i.e., column-major order);
                use the normal constructor method if the data come as a sequence
                of the matrix's rows (i.e., row-major order)

        Raises:
            ValueError:
                - if no entries are provided
                - if the number of rows is inconsistent across the columns

        Example Usage:
            >>> Matrix.from_columns([(1, 2), (3, 4)])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…