Questions tagged [matrices]
20 questions
23
votes
2 answers
Why does expressing calculations as matrix multiplications make them faster?
In Google's MNist tutorial using TensorFlow, a calculation is exhibited in which one step is equivalent to multiplying a matrix by a vector. Google first shows a picture in which each numeric multiplication and addition that would go into performing…

Mark Amery
- 1,241
- 13
- 27
6
votes
5 answers
Find the peak of each islands in sparse matrix
I have a sparse matrix that contains several islands of unknown size. I would like to find the highest peak of each islands. Consider this matrix as an example:
0 0 1 0 0 0 0
0 0 1 2 1 0 0
0 0 0 3 2 1 0
0 1 0 0 0 0 0
0 2 3 4 0 1 0
0 0 1 1 0 1 0
0 0…

MrTJ
- 161
- 5
5
votes
1 answer
Transpose a matrix without a buffering one
How is it possible to transpose a MxN matrix without using a "buffering" matrix?
In the latter case it's easy and quite the "classic" approach...
Given a matrix[M][N], I would like to put it into a void transpose_matrix(int matrix[][]) function…

peperunas
- 153
- 1
- 6
4
votes
3 answers
How to represent a three-dimensional (or more) data structure in a terminal?
I am working on a library that allows the creation and manipulation of Vectors (lists with a known length), Matrices (lists of lists with known dimensions), and three-, four- etc. order Tensors (lists of lists of lists... with known…

Qqwy
- 4,709
- 4
- 31
- 45
3
votes
0 answers
What's the most practically efficient way to store differences in adjacent matrix values?
I am implementing a certain algorithm that works like this:
Create a closed contour (list) of elements in a matrix, where closed means that the last element is adjacent (by row, column) to the first.
Weight (multiply) each of the elements addressed…

bright-star
- 129
- 4
3
votes
3 answers
Say we have a group of N person, and each person might want to sell or buy one of the M items, how to find a closed path among them for an exchange?
Say we have N persons and M items (when a person has a certain item, she usually only has one piece). For example,
person 1 has item A, C, D, and wants item F
person 2 has item B, C, and wants E
person 3 has item E, and wants G
...
You get the…

Jay
- 141
- 4
3
votes
1 answer
How can you write an activation function in a neural network to handle a layer architecture of arbitrary dimensions?
I am making a neural network in Clojure that can take an array of integers,and return a data structure representing the layers of a neural network: so (make-layers [1 4 5]) would evaluate to:
[[0] <-- input
[0 0 0 0] <-- hidden
[0 0 0…

kurofune
- 290
- 2
- 8
3
votes
1 answer
Why use atomic vectors or matrices in R at all?
In reading Hadley Wickham's Advanced R I learned about the difference between atomic vectors and lists; and matrices/arrays and dataframes. This is something I hadn't really appreciated before, and seems to make sense.
My question is, if lists and…

Phil
- 161
- 6
2
votes
2 answers
Formats for Storing Sparse Matrices
For storing sparse matrices I know there are multiple formats that are common, like COO, CSR, DIA, ELL, HYB, etc. (Link to some storage formats), but I haven't found that any of these stores the number of nonzeros per row.
I am considering creating…

Veridian
- 123
- 2
2
votes
4 answers
Similar multidimensional array detection
I'm looking for some sort of algorithm so I can quickly identify similar matrices, the matrices are not stored permanently so I'd need a way of mapping each matrix to an easily stored values, after which I can use the same mapping on future matrices…

rhysw
- 21
- 1
1
vote
1 answer
Question about the uses of matrices in games and 3D graphics
So I know that matrices are used extensively in the field of games and 3D graphics, for example, you need to know how to do matrix multiplication if you want to understand how scaling an object works, or you would need to know how to do matrix…

Jimmy_Rustle
- 119
- 1
1
vote
0 answers
How to loop through array bidimensional in diagonal according to a position in degrees
The title could be no self-explanatory enough but I need some conceptual help in order to implement a solution to go through an array:
I'm developing a program to calculate the "most shadepath" route between an origin and a destiny, for achieve this…

Enot
- 113
- 4
1
vote
1 answer
Matrix distribution to process grid
I need to write a program, which will perform LU-decomposition, etc. The problem is that I don't know about the preferred way to distribute the loaded matrix from the root process to other processes. I'm able to create a simple algorithm for some…

Eenoku
- 327
- 1
- 9
1
vote
1 answer
Program to find Orthogonal Matrices
I have been trying to find orthogonal matrix of order n where first row will be given as 1/√n, 1/√n, .... n times.
The second row will be a vector such that dot product of it with the row above and below will be zero and so on. Means, in a matrix of…

The Doctor
- 111
- 2
0
votes
0 answers
Organizing Complicated Matrix Traversal?
The following are some examples that you may see in an intro to programming course:
Print the elements of an nxn array...
Spiraling in from the outside
Spiraling out from the center
Zig zagging from the top left corner
Going right, then left, then…

Kyle
- 37
- 1
- 3