# 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.

297 questions
Filter by
Sorted by
Tagged with
1k views

• 9,776
1 vote
112 views

### Bunny Shakespeare poetry [closed]

Suppose you have a grid of cells that is 6 wide and arbitrarily tall. In each cell is a word. Let the bottom row, which is row #1, be the last 6 words of sample.txt in order. Let the second to last ...
• 121
1 vote
112 views

### Print all semimagic squares [closed]

I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition: An $n\times n$ consists of numbers $1,2,\cdots, n^2$. All numbers must be ...
• 111
2k views

### Borders of a Rectangular Matrix

Although it's done a few times as sub-challenge of a larger challenge, and we also have a challenge to remove the borders of a square matrix, I couldn't find a challenge to output the borders of a ...
• 128k
693 views

### Calculate the Smith normal form of an integer matrix

Given an $m \times n$ matrix of integers A, there exist a $m \times m$ matrix P, an $m \times n$ matrix D, and an $n \times n$ matrix Q such that: $A = P D Q$. P and Q are unimodular ...
• 1,391
2k views

### Make a Custom Bayer Matrix

A Bayer matrix is a threshold map used for ordered dithering that gives the illusion of having more shades of color than actually present by using a crosshatch-like pattern. Bayer matrices are square ...
• 4,040
198 views

### 4D rotation matrix to quaternions

It is well-known that a 3D rotation can always be represented by a quaternion. It is less well-known that a 4D rotation can always be represented by two quaternions, sending a point $p=(a,b,c,d)^T$ ...
• 3,807
470 views

• 24.5k
2k views

### Bandwidth of a matrix

A band matrix is a matrix whose non-zero entries fall within a diagonal band, consisting of the main diagonal and zero or more diagonals on either side of it. (The main diagonal of a matrix consists ...
• 39.7k
230 views

### Count the ways to transform (2)

Your input is a matrix (2d array) of positive integers. For example: \begin{matrix} 1 & 1 & 4 & 7\\ 1 & 3 & 5 & 6\\ 2 & 1 & 4 & 5 \\ \end{matrix} A semi-continuous ...
• 7,898
745 views

### Knights Jam | Chess

The knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they ...
• 5,079
919 views

### Simulating Bombs

More advanced version of this The aim of this puzzle is to simulate the impact of the shock wave of bombs on a square grid. The grid initially contains cells labelled ...
• 5,079
804 views

### Check if a matrix is Zarankiewicz-maximal

My final-year project at the National University of Singapore is on Zarankiewicz's problem: What is the maximum number of 1s in an $m×n$ binary matrix ($m$ rows and $n$ columns) with no $a×b$ ...
• 3,807
2k views

### Output the 12 Bar Blues

Note to those without experience in music: Through making an attempt to solve this problem, you may find that music and computer programming are similar in the ways that they implement rules and ...
• 757
804 views

### SuperSquares NxN

Given an integer N from 1-9, you must print an NxN grid of NxN boxes that print alternating 1s and Ns, with each box having an alternating starting integer. Examples ...
• 757
807 views

### Ragged Matrix Indexing

A ragged matrix, is a matrix that has a different number of elements in each row. Your challenge is to write a program in any favorable language to find the indices of all occurrences of target in the ...
• 5,079
2k views

### Print a NxN integer involute

Given an integer $N$, you must print a $N\times N$ integer involute with the numbers increasing in a clockwise rotation. You can start with either 0 or 1 at the top left, increasing as you move ...
• 431
456 views

### Count the ways to transform

A rigid transformation of a square array is a mapping from square arrays of a certain size to square arrays of the same size, which rearranges the elements of the array such that the distance to each ...
• 98.8k
317 views

### Cell Evolution Matrix

Your lab needed to simulate how a particular cell evolves over time in a 2D grid space. A sample 2D grid space below shows a single cell at the centre of the grid. ...
• 5,079