Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
321 views

Approximation of the multiplicative matrix inverse (linalg.inv ())

I am trying to compute the multiplicative inverse of a large matrix (~ >40,000x40,000). This can be done with e.g. numpy.linalg.inv or ...
Stücke's user avatar
  • 103
3 votes
1 answer
141 views

Python: Create submatrices from long/narrow table and save in HDF5

Hello dear StackExchange Community, I have written a small program which is doing the following. In short: it reads in a table in narrow format creates submatrices from it saves it in HDF5 format ...
dry-leaf's user avatar
1 vote
1 answer
3k views

Lo Shu Magic Square (Python)

I wrote a python program to find if a matrix is a magic square or not. It works, but I can't help feeling like I may have overcomplicated the solution. I have seen other implementations that were a ...
am2021's user avatar
  • 325
2 votes
0 answers
58 views

Converting list of sequences into one-hot vectors

I have an array of dim 1000 x 150 where I have 1000 strings each of length 150. And the strings only contain ATCGN (these are ...
user avatar
2 votes
3 answers
418 views

How can I optimize my Von Neumann neighborhood algorithm?

I am working on a small project that requires finding Von Neumann neighborhoods in a matrix. Basically, whenever there is a positive value in the array, I want to get the neighborhood for that value. ...
Brennan McGowan's user avatar
2 votes
1 answer
111 views

Improving performance of function to multiply vector with a matrix?

I wrote this function to multiply vector with a matrix and I was wondering if someone experienced can spot something can improved its performance. ...
Apple_Banana's user avatar
2 votes
1 answer
196 views

Procedural generation of a general matrix representing a tile map

The problem is to design an structure which generates "uniformly" the next one in an initially zero matrix. Taking an arbitrary index i in the range [0,m-...
sɪʒɪhɪŋ βɪstɦa kxɐll's user avatar
5 votes
1 answer
145 views

Naive Solver of Matrix with Periodic Boundary Conditions Feedback

I am creating an \$O(n)\$ solver for an \$Ax = b\$ system where \$A\$ has the form \$ A = \begin{pmatrix} a_1 & b_1 &&&d_{u}\\ c_1 & a_2 & b_2\\& \ddots & \ddots &...
vlovero's user avatar
  • 201
4 votes
1 answer
292 views

Generating unique 2D numpy arrays with 2 adjacent row elements swapped while using BFS in Python

So I have a 12 x 6 2D numpy array for input which consists of 7 possible board objects (characters from 'abcdefg'). From a 2D numpy array I wish to generate all the possible unique 2D arrays, in whose ...
OldGrog's user avatar
  • 41
3 votes
1 answer
2k views

Matrix Exponentiation in Python

I recently wrote a python code for matrix exponentiation. Here's the code: ...
Sriv's user avatar
  • 2,800
5 votes
2 answers
136 views

Fast execution of function which resembles matrix multiplication

I am trying to make the following function as fast as possible on large matrices. The matrices can have dimensions in the range of 10K-100K. The matrix values are always between 0 and 1. The function ...
user87687889's user avatar
5 votes
1 answer
926 views

Count number of unique adjacent cells in a matrix

I want to write an algorithm to count how many islands are in a given matrix. Consider for example: ...
Blasco's user avatar
  • 753
3 votes
0 answers
194 views

Lowest cost path through elements in a matrix

I've developed a program in Python that calculates the lowest possible costing path between two points in a matrix, including the values contained in the start and finish cells. The code is below. ...
MrJoe's user avatar
  • 2,143
6 votes
1 answer
416 views

Reading sparse matrix from binary file

I have binary files containing sparse matrices. Their format is: number of rows int length of a row int column index int value float Reading ...
Pallie's user avatar
  • 161
2 votes
1 answer
5k views

Inverse mapping with bilinear interpolation on an image

The following is my solution for an inverse mapping with bilinear interpolation on an image. The original image is img and ...
The White Wolf's user avatar

15 30 50 per page