We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [matrix]

In mathematics, a matrix (plural matrices) is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. The individual items in a matrix are called its elements or entries.

Filter by
Sorted by
Tagged with
2
votes
1answer
1k views

Project Euler #82 - path sum: three ways

Project Euler problem 82 asks: Here's my solution: ...
3
votes
1answer
8k views

Clockwise and counterclockwise spiral matrix traversal

An interviewer asked me to write clean Java code for clockwise and counterclockwise spiral matrix traversal. e.g. {{1,2,3}, {7,8,9}} becomes ...
2
votes
1answer
608 views

Matrix of checkboxes - only 1 allowed in a row

Task Create a matrix of checkboxes. The user must be able to select only 1 checkbox in a row or unselect all of them. Solution ...
0
votes
1answer
558 views

Computing tangent space basis vectors for an arbitrary mesh

This is more like a share and a request than a question. I converted Eric Lengyel's code, which calculates tangents of a mesh for the purpose of texturing and normal mapping, to support SIMD. For this ...
3
votes
1answer
443 views

Simplifying loop for Incidence Matrix

I had to work in the Transport Problem and we're asked to try to make the fastest code for big matrices, so we're advised to try to avoid loops. And the only one I've got and I cannot imagine how to ...
2
votes
1answer
153 views

Given set of cubes can we get a given word?

Given some cubes, can cubes be arranged such that an input word can be formed from the top view of the cubes? For example: assume an imaginary cube with only 3 surfaces where ...
1
vote
4answers
213 views

How can I make this code more readable and efficient?

How can I rewrite this code to make it more readable and, if possible, more efficient? The conditions are entirely necessary in this problem, but how could I rewrite those ...
3
votes
3answers
6k views

Neighbors of a matrix element

I would like a code review to make this code better, clear, and concise. The problem it's solving is as follows: Given a matrix, print the circumference of each of the items. For example: ...
2
votes
1answer
163 views

Optimizing this matrix shifter

I need to optimize this piece of code I made because this will run in real-time mode. It's a matrix shifter that pulls downward and will neglect any transparent element. Code: ...