Skip to main content

Questions tagged [matrix]

This tag is for challenges involving matrices. A matrix, also known as a 2D array, is a list of numbers arranged in a rectangle with rows and columns.

11 votes
15 answers
2k views

Is this a Hadamard matrix?

Hadamard matrices is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In other words, it means that each pair of rows has matching entries in exactly half of ...
Fmbalbuena's user avatar
  • 4,167
11 votes
5 answers
1k views

9-16-25 2D Matrix

Given three grids and the sum of rows and columns of each grid, your task is: Grid \$3×3\$: Fill the grid from \$1\$ to \$9\$, ensure no repeats within the grid. Grid \$4×4\$: Fill the grid from \$1\...
user avatar
12 votes
6 answers
1k views

Contract a tensor

Introduction Tensor contraction is an operation that can be performed on a tensor. It is a generalization of the idea of the trace of a matrix. For example, if we have a rank-2 tensor (a matrix) and ...
Tbw's user avatar
  • 2,093
4 votes
1 answer
607 views

Which line is best?

Consider an \$n \times n\$ grid of integers. The task is to draw a straight line across the grid so that the part that includes the top left corner sums to the largest number possible. Here is a ...
Simd's user avatar
  • 3,114
9 votes
5 answers
924 views

Compute the logarithm of a matrix

There have already been challenges about computing the exponential of a matrix , as well as computing the natural logarithm of a number. This challenge is about finding the (natural) logarithm of ...
bsoelch's user avatar
  • 6,035
17 votes
22 answers
2k views

Compute this fractal matrix

The unique-disjointness matrix ( UDISJ(n) ) is a matrix on all pairs of subsets of {1...,n} with entries $$ U_{(A,B)}=\begin{cases} 0, ~ if ~ |A\cap B|=1\\ 1, ~ ...
bsoelch's user avatar
  • 6,035