Skip to main content

Questions tagged [linear-algebra]

For challenges involving linear algebra, the mathematics of vector spaces and linear mappings between them.

19 votes
7 answers
2k views

The cross product is a peculiarly 3-dimensional phenomenon. There are multiple ways of generalizing it, but each of them have trade offs. If you require that a cross product be a product of two ...
Wheat Wizard's user avatar
  • 104k
10 votes
4 answers
268 views

Given the following inequalities: $$ \begin{align} ax+by&\leq c\\ dx+ey&\leq f\\ gx+hy&\leq i\\ jx+ky&\leq l \end{align} $$ These inequalities enclose a region in the shape of a convex ...
vbxr's user avatar
  • 179
14 votes
19 answers
3k views

Output (or print) each of the 11 times, one per line, in the POSIX %I:%M:%S format, at which the hour and minute hands of a 12-hour clock are antiparallel. Here <...
Ray Toal's user avatar
  • 821
4 votes
4 answers
674 views

Consider an n by n binary matrix. If it has rank r <= n, then we want to compute the largest number bits flips necessary to reduce its rank to a specific value. All computations should be done ...
Simd's user avatar
  • 3,177
12 votes
7 answers
2k views

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
  • 3,125
1 vote
0 answers
191 views

We need to produce a block cipher round function with a 1 bit round key size and a 7 bit message size with the highest level of cryptographic security according to our measure of security. ...
Joseph Van Name's user avatar
27 votes
42 answers
2k views

Diagonalize a vector into a matrix. Input A vector, list, array, etc. of integers \$\mathbf{v}\$ of length \$n\$. Output A \$n \times n\$ matrix, 2D array, etc. \$A\$ such that for each element \$a_i \...
bigyihsuan's user avatar
  • 11.5k
1 vote
0 answers
141 views

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 ...
ananta's user avatar
  • 111
15 votes
13 answers
1k views

A Hankel matrix is a square matrix in which each ascending skew-diagonal from left to right is constant, e.g.: $$\begin{bmatrix} a & b & c & d \\ b & c & d & e \\ c & d &...
alephalpha's user avatar
10 votes
1 answer
487 views

Given a set of bit vectors \$A\$ and a binary matrix \$M\$, we can define the set \$MA = \{ Mx : x \in A \}\$, where \$ M x \$ is the result of the matrix multiplication of \$ M \$ by \$ x \$ over \$\...
Command Master's user avatar
7 votes
2 answers
531 views

Given a list of N lists, each containing M positive integers, and a separate list of M positive integers (target values), return a list of N scalars (integers with a value of 0 or more) that ...
drmosley's user avatar
  • 757
3 votes
3 answers
381 views

Your friend Jack is a picky eater. He only likes certain foods, and he only likes to eat a certain amount of them each day. Despite this, Jack has very strict calorie and macronutrient goals that he ...
drmosley's user avatar
  • 757
15 votes
7 answers
827 views

A basis of a vector space \$V\$ is a set of vectors \$B\$ such that every vector \$\vec v \in V\$ can be uniquely written as a linear combination of the vectors in \$B\$. In other words, let \$B = \{\...
caird coinheringaahing's user avatar
21 votes
11 answers
3k views

Background A Jordan matrix is a block-diagonal matrix where each block on the diagonal has the structure of $$ \begin{bmatrix} \lambda & 1 & 0 & \cdots & 0 \\ 0 &...
Bubbler's user avatar
  • 79.5k
16 votes
4 answers
881 views

Executive summary: Print NxN matrices \$A\$ and \$B\$ where \$ AB = 10A + B \$. Largest N wins! Details: Entrants in this challenge should choose an N. Submit a program that takes an input integer '...
QuadmasterXLII's user avatar

15 30 50 per page