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

547 questions
Filter by
Sorted by
Tagged with
1answer
1k views

### Capture the notion of invertible functions

I find sometimes it is useful to capture the notion of invertible functions. The idea is that if two functions f :: a -> b and ...
2answers
3k views

### A grid and a menu walked into a program

A program that creates a grid 10x10 and assigns a random number in each tile. It then asks you if you want to: create a new grid view the current one count how many of each number there are in the ...
1answer
8k views

### SIMD matrix multiplication

I recently started toying with SIMD and came up with the following code for matrix multiplication. First I attempted to implement it using SIMD the same way I did in SISD, just using SIMD for things ...
6answers
5k views

### 2048 merge function

From: Principles of Computing Part 1 Course on Coursera I got -2 pts on my OWLTEST which uses Pylint for style guide. The error states: Too many branches (17/12) function "merge", line 7 ...
2answers
1k views

### The grid looked at the menu and said “Something with class, please”

This is a follow up on my previous question: A grid and a menu walked into a program I integrated classes into the mix. The program now asks how big you want the grid to be. ...
4answers
1k views

### Enter the Matrix

I've semi-often been frustrated at the lack of a proper Matrix data structure in VBA. A multi-dimensional array is obviously the right way to handle it, but there is so much missing... for example, ...
1answer
577 views

### Remapping and interpolating 255x1024 array

I have a function that accepts a $255\times1024$ array and remaps it to another array in order to account for some hardware related distortion (lines that should be straight are curved by the lens). ...
7answers
2k views

### Code to multiply matrices together

I've got a short algorithm used in my code to multiply two matrices and put them into a destination Matrix. I decided to use the temporary array t_elements, which ...
2answers
6k views

### Finding a zero crossing in a matrix

I am trying create an algorithm for finding the zero crossing (check that the signs of all the entries around the entry of interest are not the same) in a two dimensional matrix, as part of ...
3answers
1k views

### A library to do maths with matrices written from scratch

Background Some time ago I've encountered some very good articles about neural networks that represented an ANN as a set of matrices, so everything was done using matrix operations. These articles ...
2answers
7k views

### Count the one islands in the matrix

What is an island? A group of connected 1s forms an island. For example, the below matrix contains 5 islands: ...
5answers
9k views

### Set matrix zeros

I solved this problem in about 11 minutes (with all 50+ test cases passed). I think most of you already know me by now, and I truly appreciate your advice, but please be brutal and judge me as if I ...
5answers
4k views

### Enter my Matrix

Here is my next Java assignment: create a Matrix class that can add and multiply two matrices together. I was given some code as a skeleton and then fleshed it out ...
1answer
1k views

2answers
3k views

### Symmetric Square

I was given an assignment to ensure that a list was symmetric. I built it in a way that worked and it passed the tests. But I wanted to see if it could've been written more efficiently and still ...
1answer
2k views

### Efficient extraction of patch features over an image

Input: data - a matrix of size n*m*3*3 (complex values) indices - a list of coordinates (x,y), where x < n and y < m fp - a feature parameter which is a tuple of ((fp11, fp12), (fp21, fp22)), ...
3answers
511 views

### Transpose function [closed]

I wanted to write a transpose function for N*N mat without it getting literals or #define values and I want it to compile with ...
2answers
2k views

### Read matrix from file, the C++11/14 way

I am trying to get acquainted with C++11/14, so please tell me if the code below could be written in a more "modern" way. Or, of course, if it could be improved in any way. The function ...
2answers
593 views

### Short square matrix class in C++ using an array

I'm a novice at C++ in comparison with other languages, so as an exercise I wrote a square Matrix class that doesn't use STL. ...
2answers
14k views

### Basic Matrix Class in C++

I've made a simple Matrix class to learn C++. It doesn't use Templates so it only works with int. I made it this way to really understand how to work with objects ...
2answers
2k views

### Converting Data in Rows and Columns to Rows in VBA for Excel

I have a working VBA script for Excel that converts a matrix of data with multiple records in per row to multiple rows with one record per row. A StackOverflow user told me that the code could use ...
1answer
372 views

### Parsing equations from stdin

The program should read equations from stdin, parse them and generate a matrix of the coefficient which represents the system. Example: ...
1answer
274 views

### Computing a Discrete Cosine Transform matrix

I'm learning Haskell and I needed to work with discrete cosine transform matrices, so I made a program that generates text (usable in WolframAlpha) containing the generated matrix. The elements of ...
1answer
95 views

### Returning multiplied matrix array

Is there a more clever way of writing this piece of code? It does work but I thought there might be a better way of returning a matrix from multiplying the parameter by itself. ...
1answer
474 views

### Ring datatype in Python

I wanted to write something that would be useful for the indices of a grid where if one walked off the edge of the grid they would re enter on the opposite side. This could in theory help with ...
3answers
10k views

### JavaScript solution for diagonal difference

hackerrank.com - diagonal difference: Problem Statement You are given a square matrix of size N×N. Calculate the absolute difference of the sums across the two main diagonals. Input ...
4answers
2k views

### Matrix struct with random values allocation and deallocation

I've written this code in 2013 or 2014, I think. I've rediscovered it today in one of my folders, made some changes and now I'm left (and my 2013/2014 me as well) wondering how good it looks for other ...