Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 755

For questions about construction and modification of matrices, objects represented by 2-dimensional arrays that are used to define linear operators within linear algebra.

0 votes
Accepted

Matrix rank only adding single row

I will assume the original matrix has $n-1$ rows, $n$ columns, and the rows are linearly independent (this is easy to check; and if it is not the case, then the problem is trivial). Adding a new row $ …
D.W.'s user avatar
  • 166k
1 vote

Simple Representation of Matrices with the Given Equivalence Relationship

When you are dealing with binary matrices, this is the problem of graph canonization. … When you have non-binary matrices, you can think of this as a graph with labels on the edges. …
D.W.'s user avatar
  • 166k
1 vote

Minimize Manhattan distance travel algorithm

You could always try the A* algorithm. It might not be optimal but it is something you could try, and depending on how big the matrix is it might be good enough. You'll need to design an appropriate …
D.W.'s user avatar
  • 166k
4 votes
Accepted

Find the maximizing row-column matches in a matrix

The problem can be solved with dynamic programming in $O(RC)$ time. I'll start by showing how to solve it in $O(RC^2)$ time. Let $M[\cdot,\cdot]$ denote the input matrix. Let $A[i,j]$ denote the to …
D.W.'s user avatar
  • 166k
1 vote
Accepted

Finding a map between two matrices that minimises distance differences of neighbors

I expect that solving the problem exactly might be NP-hard. However, here is an approach that I expect will probably be good enough for practical purposes. It uses a subroutine to solve the following …
D.W.'s user avatar
  • 166k
2 votes

How to find rows of matrix that are zero everywhere except for 1 entry?

There is no algorithm with worst-case running time better than $O(n^2)$. There is a simple adversary argument to prove this. Consider any algorithm that is purported to be correct, and that always i …
D.W.'s user avatar
  • 166k
1 vote

Number of submatrices with a particular sum

It is easy to achieve $O(n^3 \lg n)$ running time by accumulating partial sums, if all entries of $A$ are positive. Define the $n\times n$ matrix $B$ so that $$B[i,j] = \sum_{r=0}^i \sum_{s=0}^j A[r …
D.W.'s user avatar
  • 166k
1 vote

Updating maximum sum subrectangle in a sparse matrix when one element is changed

Yes, absolutely. There is a straightforward way to do what you want, if you work through the details of the algorithm given at the link in your question. The trick is to use persistent data structur …
D.W.'s user avatar
  • 166k
3 votes

Arden's rule expressed as matrix algebra

For instance, matrices form a star semiring. …
D.W.'s user avatar
  • 166k
1 vote

Complexity of matrix inverse via Gaussian elimination

No, it's not true. You can use Gaussian elimination to invert a matrix in $O(n^3)$ time, but there are other algorithms that are even faster. The complexity of a problem is the running time of the f …
D.W.'s user avatar
  • 166k
1 vote
Accepted

Given a binary matrix, how to find the starting coordinates of a sub matrix?

Here is one approach. It won't survive JPEG compression, though, so probably you can do better. Let $m$ be an integer large enough that $2^m$ is significantly larger than both the width and height o …
D.W.'s user avatar
  • 166k
1 vote
Accepted

Deciding whether there exists a permutation of the entries of an $n \times n$ matrix that is...

One approach is to use integer linear programming, and hope that an ILP solver will be able to find a solution. This will probably still be exponential in $n$ in the worst case, but it might be faste …
D.W.'s user avatar
  • 166k
1 vote

Algorithm for finding a matrix which satisfies certain constraints

This gives you a sequence of candidate matrices, one per step. Choose the best one, i.e., the one where the sum of desired elements is the largest. …
D.W.'s user avatar
  • 166k
1 vote

Finding maximum rectangular frame in array of zeros and ones

Yes, it is solvable in $O(\max(m,n)^3)$ time. In fact, it should be solvable in $O(\min(m,n)^2 \max(m,n))$ time -- e.g., if $m<n$, it should be solvable in $O(m^2 n)$ time. Let $N_\text{down}(i,j)$ …
D.W.'s user avatar
  • 166k
1 vote

Sort binary matrix by swapping columns to make subrectangle of ones with maximum size

Yes, you can solve it faster than trying all possible permutations. The biggest such rectangle must span consecutive rows. So, for all $i,j$ with $i \le j$, check what is the biggest rectangle you c …
D.W.'s user avatar
  • 166k

15 30 50 per page