MMatrixCairn
Product

Product features · Bounded integer matrix multiplication

01

Separate zero-width shapes from missing rows while inspecting multiplication dimensions and the newly allocated result rows.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Bounded integer matrix multiplication

● ● ●MatrixCairn●
A concrete starting point · Bounded integer matrix multiplication ×
def matrix_product(left, right):
    left, right = [tuple(r) for r in left], [tuple(r) for r in right]
    widths = []
    for matrix in (left, right):
        width = len(matrix[0]) if matrix else 0
        if len(matrix) > 64 or width > 64 or any(len(r) != width for r in matrix):
            raise ValueError("matrix.shape")
        if any(type(v) is not int for r in matrix for v in r):
            raise ValueError("cell.integer")
        widths.append(width)
    if widths[0] != len(right):
        raise ValueError("matrix.incompatible")
    return [[sum(row[k] * right[k][j] for k in range(widths[0]))
             for j in range(widths[1])] for row in left]
✳Multiply rectangular integer matrices with at most 64 rows and columns each.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗