Click here to Skip to main content
15,888,330 members
Everything / Matrix

Matrix

Matrix

Great Reads

by Arthur V. Ratz
Optimizing the performance of the large-sized matrices QR factorization and eigendecomposition, using Schwarz-Rutishauser algorithm
by Arthur V. Ratz
Compute the Levenshtein distance of literal strings effectively by using the Wagner-Fischer (two matrix rows-based) algorithm.
by Virendra Kulkarni
Steps to implement the “Fit picture to fill the shape” option in PowerPoint like applications using GDI+
by Mahsa Hassankashi
This article also has a practical example for the neural network. You read here what exactly happens in the human brain, while you review the artificial neuron network.

Latest Articles

by Arthur V. Ratz
Compute the Levenshtein distance of literal strings effectively by using the Wagner-Fischer (two matrix rows-based) algorithm.
by Arthur V. Ratz
Optimizing the performance of the large-sized matrices QR factorization and eigendecomposition, using Schwarz-Rutishauser algorithm
by Mahsa Hassankashi
This article also has a practical example for the neural network. You read here what exactly happens in the human brain, while you review the artificial neuron network.
by Peter Occil
Describes projection and view transforms commonly used in 3D graphics, such as perspective and orthographic transforms

All Articles

Sort by Score

Matrix 

3 Jan 2022 by Arthur V. Ratz
Optimizing the performance of the large-sized matrices QR factorization and eigendecomposition, using Schwarz-Rutishauser algorithm
16 Sep 2022 by Arthur V. Ratz
Compute the Levenshtein distance of literal strings effectively by using the Wagner-Fischer (two matrix rows-based) algorithm.
3 Oct 2014 by Andreas Gieriet
Use https://mathnetnumerics.codeplex.com/[^].CheersAndi
22 May 2019 by OriginalGriff
This is basic maths. targetRow - row is the horizontal distance from the target to the centre of your circle with radius radius, and targetColumn - col is the vertical distance. The radius by definition never shorter than the longest of the absolute values of those two, so it is always the...
20 Jun 2014 by Virendra Kulkarni
Steps to implement the “Fit picture to fill the shape” option in PowerPoint like applications using GDI+
12 Sep 2014 by Christian Amado
Hope these links helps you...Matrix Decomposition[^]C# Matrix Library[^]Matrix multiplication[^]Regards
30 May 2016 by Kenneth Haugland
I have one way of solving the inverse of a matrix, solving it column by column:High precision native Gaussian Elimination[^]I also think you would benefit from reading up on matrixes in general, not just the inverse bit. Matrices are very useful in many areas, but mastering and...
27 Oct 2021 by Richard MacCutchan
You can declare the array thus: float floatArray[100][100]; The array is indexed by expressions of the form floatArray[row][col], where row and col are integer offsets between 0 and 99. You can use srand/rand to generate random numbers.
14 Jun 2022 by CPallini
You did practically nothing. There are basically three tasks: Matrix computations, that is addition, subtraction, multiplication of two matrices. Matrix input from file and output to file. Interpret the command line and execute it. For...
15 Jun 2022 by CPallini
Try the following code n=3 adjacency_matrix =[ [2, 3, 0] , [0, 0, 1] , [1, 5, 0] ] li_r = [] li_c = [] for i in range(n): for j in range(n): if adjacency_matrix[i][j]!=0: li_r.append(i) li_c.append(j) print(li_r) print(li_c) ...
12 Sep 2014 by Sergey Alexandrovich Kryukov
Please see my comment to the question.First, matrix multiplication is quite a trivial mathematical operation. Please see, for example: http://en.wikipedia.org/wiki/Matrix_multiplication[^].To code it, just act by definition.Now, you can define appropriate operator '*' and use is...
6 Nov 2014 by Peter Leow
Try this:% create an all zeros 100x100 matrixm=100;n=100;matrix = zeros(m, n);% create a column vector of 1x100v = 1:n;v% create a 100x100 matrixfor r=1:m matrix(r, :) = v;endmatrix
31 Dec 2014 by Member 10641779
Hey, I liked your question so I thought i should work on it. Here m adding the code to change matrix as shown by you in example.Here suppose 'a' is your original matrix of size (2N x 2N) and I have take one `tmp` matrix to store value. it will also be of same sizeinitialize tmp matrix at the...
8 Mar 2015 by Sergey Alexandrovich Kryukov
FranxCDOFranx wrote:Hey Sergey, if you are referring to me yes I didn't not understand as I am a beginner in this field. I am trying to debug and find the reason for the wrong multiplication. If you want to be more specific to the problem as to how I should debug and fix the algorithm please...
8 Mar 2015 by FranxCDO
As phil.o and Sergey Alexandrovich Kryukov state above, the problem was with the representation of the numbers. The below code works.#include #include #include #include #define LOW_WORD(x) (((x) > 16) #define HIGH_WORD(x) ((x) >>...
27 Nov 2017 by Kenneth Haugland
In the header, you ask about matrix multiplication, while in the question you ask about transposing a matrix. Transposing a matrix is just to switch the rows and columns: TransposeA[i][j]=A[j][i] Matrix multiplication is a bit more cumbersome as you need to make sure that the columns in the...
26 Apr 2019 by Richard MacCutchan
You first need to split the string using the semi-colon as the separator,. That will give you a string of numbers for each row. Then split each substring using the comma as separator which will give the numbers for each column. You can then allocate the array for the matrix. You then need to...
8 Dec 2020 by Afzaal Ahmad Zeeshan
That is why normally it is recommended to not have a long chain of method calls, if any single one of them fails you get a null reference exception. I would suggest rewriting that log line as: var worker = workers.Get(i); if(worker != null) { ...
14 Jun 2022 by RickZeeland
See example here: Matrix calculator in C - Code Review Stack Exchange[^] You can not copy and paste this code, you will have to adapt it according to the instructions you got. Good luck!
28 Jun 2022 by Patrice T
First of all, you can't add 2 matrices of different size. I would try this change: #include // This make the matrices and sizes global. int p,q,x,y; int a[100][100],b[100][100],c[100][100]; void add(){ int p,q,x,y,i,j; int...
9 Apr 2014 by Paul Hildebrandt
I'm writing a program to create isometric line drawings and I need to figure out how to convert 2D circles to ellipses using a shear matrix transform. I've searched Google for a few days now but can't seem to come up with any code examples. Data I use is centrepoint and radius.Can someone...
9 Apr 2014 by lukeer
You can leave the circle (and everything else) unmodified and let the Graphics object deal with shearing via its Transform property. It's of type Matrix, which supports Shaer out of the box.
18 May 2014 by Member 4065983
Now I implemented a easy source code to find all possible paths in matrix.Then selected the unique row and column.But due to time complexity how can we can get directly unique path.this is my source code. import java.util.*; public class MyAllPath { public static ArrayList...
16 Jun 2014 by Raghubir_Sarkar
Make table like this -ID - Product - W_Price - H_Price1 - A - 100 - 502 - A - 150 - 603 - B - 135 - 544 - B - 145 - 62By this way you can save your 500 products into 1 table also you can get any value using combination of columns in your select query.
21 Jun 2014 by Sky8807
refer below links:http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm[^]andhttp://www.codeguru.com/csharp/csharp/cs_misc/designtechniques/article.php/c12527/AStar-A-Implementation-in-C-Path-Finding-PathFinder.htm[^]
12 Aug 2014 by Member 11008046
Hello everyone!I am trying to multiply arrays using MPI to speed up the process.My problem is that when i execute the program doesnt work and it freezes.Screenshot:http://s29.postimg.org/ocaxtka2f/image.png[^]Please help me.Thanks in advance.Thats my code:#include...
3 Oct 2014 by A_Shahn
HI ALL-----I have a fundamental question:What is the best way to perform Matrix-Calculation in VB.NET?!I want to know what is the fastest way to do that?!-----Let me explain it more:I want to do some processing on images,(For example: Apply a gaussian-filter on a...
9 Oct 2014 by Wael Tayara
My function returns an int array with 2 values Let's say, res[0] and res[1]When I'm calling the array in a for loop for multiple times, and when I'm storing the results in another array, in each iteration the results are over-written with the new results.If the first call returns [0,1]...
10 Oct 2014 by Wael Tayara
Well, this is giving me a real headache. I'm building a matrix determinant function to compute NxN determinant, and I'm using recursion. The logic is working right but I'm not able to get the final value computed correctly.Here is my code for Matrix Determinant: public static double...
10 Oct 2014 by Wael Tayara
This is the part where should be modified :)for (int j = 0; j
5 Nov 2014 by hor_313
HiI want to build a m*n matrix in Matlab but i don't know how? I know I can build a vector with many ways but about matrices I couldn't find any way!For example if I want to build a matrix 100*100 like this:[1 2 3 .......100 1 2 3 .......100 1 2 3 .......100 . . . 1 2 3...
17 Jan 2015 by Sergey Alexandrovich Kryukov
First, learn the theory. This is not easy. You can start here: http://en.wikipedia.org/wiki/Covariance_matrix[^].In MATLAB, this is also a big topic: http://bit.ly/1uf85hg[^].—SA
1 Mar 2015 by FranxCDO
I want to find the eigenvalues and eigenvectors of a 3x3 matrix. My numbers are stored in fixed-point format (16.16 to be exact).Note that I don't mind much about the performance, but simply implementing an algorithm that does the job.The code below, when you build it and run it (with...
11 Mar 2015 by Richard Deeming
Your homework is set to test what you have learned, not what some random people on the Internet know.If you can't do your homework yourself, then talk to your teacher.Whilst we're happy to help with specific questions about code you have written, nobody here is going to do your homework...
21 Apr 2015 by nizam qbixx
Hi..I was doing a research related to speech recognition. So far I already able to convert a sample waveform (.wav format) to a feature vector by using MFCC which generate .mfc file. I also able to read the .mfc file but I dont know how to related it to the spectogram. Actually, I'm not sure...
19 Aug 2015 by KingSora
I would like to know how to change RenderTransformOrigin of an element without changing its location? I've noticed that changing the RenderTransformOrigin will affect the element location.How can I calculate the delta X, delta Y between the element location before and after changing the...
23 Nov 2015 by Sergey Alexandrovich Kryukov
Sorry, this is not a code-finding service.—SA
21 Jan 2016 by B. Clay Shannon
When I add a Matrix to the Layout page in the BIDS designer, it creates two columns. I need more. I would expect the Matrix control to have a "ColumnCount" property, but it doesn't. My next expectation would be that the Matrix would provide a context-sensitve menu allowing me to insert...
19 Mar 2016 by KittoKy
In this code I am getting the error : CS0246 The type or namespace name 'Matrix' could not be found (are you missing a using directive or an assembly reference?)#region Generate the training data and classesMatrix trainData = new Matrix(trainSampleCount,...
19 Mar 2016 by Richard MacCutchan
This is exactly the same issue as CS0246 the type or namespace name 'emgu' could not be found (are you missing a using directive or an assembly reference? )[^], which I already told you how to fix.
11 Apr 2016 by gd charan
Here is the code for one dimentional matrix multiplication #include #include #include #define SIZE 1024#define FROM MASTER 1 #define FROM WORKER 2#define DEBUG 0 /∗ 1 = debug on, 0 = debug off ∗/MPI Status status;static double...
18 Apr 2017 by Bhola Ram Sahu
I want to do a small program that calculates eigen value and eigen vector in parallel processors using MPI. I have written a code that works correctly but its for uni processor. Please help me with some code for parallel processor. I want to compare the processing time for different number of...
10 May 2017 by Member 13191541
In R programming - How do I plot a network visualization graph given a matrix X with a 2 column coordinate system: coordinates
7 Jun 2017 by OriginalGriff
Quote: Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email contained the message you wanted to send. ...
7 Jun 2017 by Patrice T
Quote: However, when I run it in a loop, some matrices are symmetric whereas some are not. What could be the reason? Serious ? you did not even dared to give an example of the problem. The minimum is an example with calling sequence to reproduce the problem. There is a tool that allow you to...
7 Jul 2017 by CPallini
The initialization of the matrix is incorrect (not complete). Moreover your sort routine is flawed. Try #include using namespace std; int main() { int a[5][5],i,j,k,t; int * b = reinterpret_cast(a); for(i=0;i>a[i][j]; } ...
7 Jul 2017 by Patrice T
First of all, indent your code properly, it helps reading. void main() { int a[5][5],i,j,k,t; for(i=0;i>a[i][j]; } // this loop is very confusing and lake no sens to me for(k=0;k
30 Jul 2017 by Graeme_Grant
Sorry, we do not do your homework for you.
30 Jul 2017 by Ravi Bhavnani
You don't need to use a matrix. Simply use a collection of structures, each of which contains: coefficient power of x power of y and sum the coefficients of like power combinations. /ravi
26 Aug 2017 by OriginalGriff
There is no such value that you can insert as a number: that is the nature of "infinite values". Instead, I'd write something that wasn't a number at all - a character like 'i' or even '∞' if your file is Unicode and specifically check for that when I read the file back while converting the...
19 Nov 2017 by Amar Ćatović
#include int main() { printf("Enter M and N of matrix A: "); int m,n; int p,q; scanf("%i %i",&m,&n); printf("Enter matrix elements: "); int i,j,matA[101][101]; for (i=0; i
18 Nov 2017 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email contained the message you wanted to send. So now...
19 Nov 2017 by Patrice T
Quote: It rotates N x N matrix like it should, but there is problem with M x N matrix. You need to take into account that the shape of the matrix changes after transpose. There is a tool that allow you to see what your code is doing, its name is debugger. It is also a great learning tool...
27 Nov 2017 by Lilyanaa
I find what I need from Stack Overflow and now I have a question,what is the benefit of this function static void transpose_matrix() { int i, j; for(i = 0; i
30 Nov 2017 by Lilyanaa
I'm trying to create a simple Matrix Multiplication program with MPI ,the idea of this code is split the first matrix (a) by row and the second matrix(b)by column and send these rows and columns to all processors ,the program must be (first matrix split by rows * second matrix split by columns)...
30 Nov 2017 by Kenneth Haugland
This seems wrong to me: for(i = 0; i
10 Jan 2018 by Patrice T
Quote: can someone help me to finish this code to work whole in one code. Finish what? this code is barely as starting point. All you gave us a couple function names and not explanation. Your teacher is the only one that can help you with no explanation. We do not do your HomeWork. HomeWork is...
10 Jan 2018 by CPallini
Start writing the Matrice and Vector classes (at least their skeletons), then start filling properly the methods. Take advantage, if you can, of the modern features of C++, in order to simplify your task.
8 Aug 2018 by OriginalGriff
Quote: 'System.InvalidCastException' Helps a bit, but knowing which line would make our job easier... At a guess, it's this line: m[h,j] =(int)a[i]+(int)a[i+1] ; and it implies that a does not contain integers. So start by looking at what exactly Tab_Mat does return, then use the debugger to...
22 Aug 2018 by Member 13958396
This is my first time doing matlab and I've never coded before. This was a compulsory Uni paper that I have had to take. Prior to this task I've managed to complete various other tasks but this is challenging me beyond what I've learned in the last three weeks. This is what ive got down so far...
22 Aug 2018 by Patrice T
Quote: SOMEONE PLEASE HELP ME SOLVE THIS?!?!?!?! The help you want is us doing your homeWork. You show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork. HomeWork problems are simplified versions of the kind of problems you will have to solve...
22 Aug 2018 by Patrice T
So, you show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork. HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing. We do not do your HomeWork....
22 Aug 2018 by Vincent Maverick Durano
READ: Programming Problems and Finding Solutions[^] PS: Adding those exclamation marks on the subject line suggests you are late with your homework, it's rude and no one is interested in that. If you want us to help you, then start doing something by yourself. Show us what you've tried and...
14 Sep 2018 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Try it yourself, you may find it is...
15 Nov 2018 by Richard MacCutchan
matrix multiplication c - Google Search[^]
17 Nov 2018 by Optimistic76
I finally found a link i never noticed that answer to my question Eigen: Lazy Evaluation and Aliasing[^]
22 May 2019 by Member 14422952
I have the dimensions of a matrix and a given cell with radius. So let's take a look at this example: https://i.imgur.com/51hTJpv.png[Matrix] The matrix has 5 rows and 6 columns. We are given the cell (2, 3) with radius 2. It has an impact, and it destroys all of the items in a certain radius...
24 Jun 2019 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the...
24 Jun 2019 by Maciej Los
Take a look here: Dijsktra's algorithm[^]
24 Jun 2019 by Patrice T
Quote: Program to find minimum matrix Yes it is what you have to do ! In this site, we help you to fix your program, but you need to have a program, we don't do your homework for you. The requirement is typical of challenges sites, so your challenge is to solve the problem, In your case you...
25 Jun 2019 by Stefan_Lang
It's a variant of the Traveling Salesman problem[^] (you have to visit all cells of the matrix) with an unusual cost function. The cost function can only be evaluated once you have a full path. Moreover a full path needs to visit all cells. You migth want to look up implementations of the...
14 Dec 2019 by Member 14689791
Saruss' Rule can be useful for faster & memory efficient computation of Determinant. because it is non recursive. You can get application on https://github.com/apanasara/Faster_nxn_Determinant
28 Mar 2020 by R0ber1t
I'm looking for a C++ way using vector to get all the diagonals of a (square) matrix, represented as a 2d vector. matrix = [ [1,2,3,4], [5,1,2,3], [9,5,1,2]] But I have trouble coming up with a way to generate all the diagonals....
28 Mar 2020 by CPallini
A diagonal starting at (row,0) includes all items (row+k,k) where k=0,1,.., ROWS-row-1. In a similar way, a diagonal starting at (0,col) includes all items (k,col+k) where k=0, 1, .., COLS-col-1. The task is competed if you iterate on rows: row...
15 Apr 2020 by bekim peci
So basically I have to ask the user to input the text in the textBox and then , add that input into the matrix, but the code i have written doesn't give me time to get the user input What I have tried: public void FillMatrix (string...
15 Apr 2020 by RickZeeland
Here is a similar question, the trick is to use a button and add the values to the array after the button is clicked: Get input from a textbox to an array in C#[^]
27 Aug 2020 by Sandeep Mewara
I see you have posted this same query in atleast three forums. By now you know its a broad topic and since you are asking for some direction to start in comments here (and at SO), take a cue from this: combinatorics - How many ways can you tile...
27 Aug 2020 by Rick York
I would write numbers in the squares to indicate which shape it is part of with zero being empty. The first shape will be number one, the second will be two, and so on. The part I am uncertain of how do you distinguish between attempts? One...
2 Nov 2020 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
2 Nov 2020 by Patrice T
You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork. HomeWork problems are simplified versions of the kind of problems you will have to solve...
4 Nov 2020 by raddevus
[0.91, 0.81, 0.72, 0.74, 0.33, 0.85] [0.91, 0.81, 0.72, 0.74, 0.33, 0.85] [0.91, 0.81, 0.72, 0.74, 0.33, 0.85] [0.91, 0.81, 0.72, 0.74, 0.33, 0.85] [0.91, 0.81, 0.72, 0.74, 0.33, 0.85] now iterate through each row and each column for row = 0...
25 Nov 2020 by Richard MacCutchan
Sorry, this site is not here to do your homework. If you really cannot do this the you need to discuss your problem with your teacher.
8 Dec 2020 by gsile
I have been trying to link my "person" class values with "workers" class in the "Read" method. When I write Console.WriteLine(person.GetName()); it gives me all the values perfectly, but if I write Console.WriteLine(workers.Get(i).GetName());...
8 Feb 2021 by Captian Ahab
I just came over from Stack Overflow after getting question banned, so I have no idea how you guys will like me, but here goes. I have a 16x16 matrix, and I'm trying to move the columns to the right. What I have tried: Here's how I have it...
8 Feb 2021 by RickZeeland
See answer here: Python and matrix, move columns & rows - Stack Overflow[^]
20 Mar 2021 by MMS98
Hi, I have this program which prompts the user for a matrix’ dimensions then for its elements. I have done input validation correctly, but my problems is with asking to input at least the correct number of inputs needed to get the matrix for...
20 Mar 2021 by Patrice T
Quote: currently, I'm unable to get an output at all. Your code is really weird, difficult to see what you try to do. I would expect only 2 loops there: for i in range(rowsNumber): for j in range(columnsNumber): for x in...
20 Oct 2021 by Matt Weber_1
I'm developing a Connect 4 Python program. When I'm attempting to play the game and trying to "stack" the tokens, instead of doing so they just replace each other after each turn if the other/same user picks the same column. For example, this...
20 Oct 2021 by OriginalGriff
When you "drop" a token, you need to scan the column and find the first "used slot". The simplest way to do that is to expand the storage area by one in all directions (so that the board matrix for a 3 x 3 board is 5 x 5) and fill the "edges"...
27 Oct 2021 by Rick York
I use this function to generate random values : // obtain a random value scaled to be within limits template inline T GetRandomValue( T minval, T maxval ) { return ( rand() * ( maxval - minval ) / (T) RAND_MAX ) + minval; }...
15 Dec 2021 by Richard MacCutchan
hausdorff distance python - Google Search[^]
9 Mar 2022 by Arthur V. Ratz
Here's the solution: And, this is done in MatLab just like in Python and NumPy, such as: For rows: A = ones(1,4); B = zeros(1,4); C = [A B] D = [A;B] For columns: A = ones(2,3) B = zeros(2,2) C = [A B] I basically refer to Creating,...
10 Mar 2022 by Member 15561967
I have a 2D array with ones and zeros, for example: 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 I need to find if there is a group of columns (or a single column) that have a row sum equal 1. For the above array the answer is YES because: 1 + 0 = 1 0 + 1...
10 Mar 2022 by Luc Pattyn
Aha, That is a special case of a more general optimisation job I've spent many years on; I ended up with a very nice approach that is the opposite of brute force, and provides all solutions in one go. Applied on your matrix situation, I'd like...
26 Mar 2022 by Atharav Jadhav
I have tried giving input for a 2X2 matrix. 0 1 0 x x 1 y x But the output still is "Matrix not allowed" according to my code, whereas for this input it should just run well. Please let me know where I am going wrong. What I have...
14 Jun 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
14 Jun 2022 by Richard MacCutchan
See Matrices[^] for the algorithms that you need to implement.
15 Jun 2022 by merano99
Starting here with a user menu does not make much sense. On the contrary, I would leave it out first and the required functions first to read in the matrices and write the functions possible with the matrices. In order to complete the tasks,...
15 Jun 2022 by niksirat2030
Hi, I create matrix "adjacency_matrix" with following code: n = int(input()) # Initialize matrix adjacency_matrix = [] # For user input for i in range(n): a =[] for j in range(n): a.append(int(input())) adjacency_matrix.append(a) I...
28 Jun 2022 by UPPALAPATI DATTA (RA2111030010270)
#include void add(){ int p,q,x,y,i,j; int a[100][100],b[100][100],c[100][100]; for(j=0;j