# 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.

594 questions
Filter by
Sorted by
Tagged with
172 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: ...
587 views

### C++ Dataset class

C++ newbie trying to build a class to represent a dataset for the purposes of building predictive models of the form y ~ x0, x1,... Since this is version 1, I'm assuming some nice properties about my ...
347 views

### Blurring a given image using moving average in Python 3

I've tried solving the following HackerRank question: Write a function blur_image() that takes as a parameter an image in the form of a nested list ...
499 views

### Matrix implementation with Rank and Inverse calculation using Gaussian Elimination in Java

Disclaimer Some things that I must state: This is just for practice. I want to know the various algorithms in linear algebra in detail. I will not use this in a practical scenario. Except for ...
450 views

### C++ Template Matrix Class - WIP

I've created simple matrix class in c++ and I would like to know what you think about the code. I've left the implementation in header file for simplicity for now. The class is not finished yet, it ...
89 views

### Calculating how similar two objects are according to a database

I want to calculate how similar two objects are according to a database. However the code is very slow; it takes around 2 minutes to analyze just 3 objects. How can I speed it up? I have tried to ...
3k views

### Java method to make a string representation of a matrix

I have coded this static method for converting a double matrix into a nifty String. It considers the width of the matrix to be ...
232 views

1k views

### Computation of inter-grid distance array for 2D lattice

I have a 2D lattice with U × U number of grids. My goal is to create an array – of shape U^2 × U^2 – where each entry denotes the least-distance between each grid and any other grid. Currently, for ...
239 views

### Increase performance of a spate of 2x2 matrix multiplication

I would like to improve the performance of the piece of code below (in Fortran). It gives good results but the profiling tells me that it is where it spends most of its running time. Basically, it ...
3k views

### 4x4 Sudoku solver performance

The code is for a 4x4 Sudoku solver. It works fine when there are a small number of unfilled spaces (0's) but when I give the whole matrix input as 0's or so the solver takes a very long time. I need ...
100 views

### Performing a special multiplication on two square matrices

I have a function called mult2 that takes in two square NumPy matrices and returns a matrix that is the result of a special multiplication: ...