Questions tagged [diagonal]

Diagonal means either a diagonal matrix (usually a square matrix) in which the entries outside the main diagonal are all zero. The diagonal entries themselves may or may not be zero. Or, the values of the diagonal matrix.

Since a lot of things in programming is based on matrices doing thing horizontal or vertical is often easier then doing it diagonal. Questions dealing with these difficulties should be tagged diagonal.

Diagonal matrices occur in many areas of linear algebra. Because of the simple description of the matrix operation and eigenvalues/eigenvectors, it is always desirable to represent a given matrix or linear map by a diagonal matrix.

You probably want to add more specific tags about the technology you are using. Areas where the tag ´diagonal´ becomes relevant often drawing and animation.

584 questions
-3
votes
1 answer

Feed same input but got dfferent output in Householder reduction (tred2) for both C and Fortran program?

I translated some of C code in fortran on my research. While translating I got error in tred2 subroutine. To debug for more easier , I use input for c program while passing in tred2 routine same for fortran. Like (nb =number of band =18 A matrix…
-3
votes
1 answer

How to solve triadiagonal matrix using Numpy\Python

I'm working on a project and i want to solve a system of tridiagonal matrix with9 equations with 9 unknowns in 20 steps. How do i go about the code using numpy\python. Here is an example Tridiagonal Matrix I am solving for x11, x12, x13, x21, x22,…
-3
votes
3 answers
-3
votes
3 answers

Odd length diagonal string pattern

I have written a program to print the given string diagonally (like x) Input: PROGRAM Expected output: P M R A O R G O R R A P M My output: P M R A O R G R O A R M P My Java…
Sudarsan
  • 3
  • 3
-3
votes
3 answers

To Get Diagonals of a Matrix in Matlab?

I want to get diagonals from a matrix in Matlab. For example, given the following matrix M = [1 1 4 5 4 2 5 1 2 2 4 1 2 1 3 1 3 1 1 1 1 2 3 3 1] I want to get a list of vectors which make the…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
-3
votes
1 answer

How can I find the diagonals of all matrices in a file using NumPy?

I have a file which consists of a number of matrices separated by blank line. How can I find the all diagonals of all matrices using NumPy? The matrices are not of fixed size 1 2 3 1 1 1 2 2 2 3 4 3 2 4 2 3 2 3 4 2 2
abd
  • 73
  • 1
  • 8
-3
votes
1 answer

What code can be used to create a diagonal matrix in javascript

I have the following matrix in javascript, modelled with the library math.js: var CN = math.matrix([[8], [7],[3],[1]]) I would like to change this matrix into a diagonal…
-4
votes
2 answers

Task with matrix and diagonals in c

I have a matrix with n*n dimensions. For given integer k I have to print elements from diagonals. From picture: for k=0, it has to print a vector: 1,12,23,34. How do i do this?
-5
votes
1 answer

Split the web page diagonally

enter image description hereI'm a starter and looking for some help. I want to split the webpage diagonally. Can I do it solely with HTML and CSS? please throw me some suggestions.
Rawi Teja
  • 1
  • 2
-5
votes
1 answer

How to make a given matrix diagonally dominant in c++?

Now for the Jacobi and Gauss-Seidel methods to work the matrix needs to be diagonally dominant. Any help would be appreciated. Its different than making a matrix diagonal. //Because of the downvotes
-6
votes
1 answer

How to check if there are multiple 1s in any diagonal of matrix?

So I have task where I have to check if there are multiple 1s on any diagonal of a 8x8 matrix. For example if this is the matrix: 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0…
CoNe
  • 1
  • 1
-6
votes
1 answer

Can anyone tell me the Working of this scripts

matrix 1 2 3 4 5 6 1 8 9 awk '{for (i=1;i<=NF+1-NR;i++) printf "%s%s",$i,FS; print""}' matrix 1 2 3 4 5 7 awk '{for (i=1;i<=NF;i++) if (NR>=1 && NR==i) {for (j=1;j<=i-1;j++) printf " ";print $(i-0)}}' matrix 1 2 3 4
Rio
  • 17
  • 6
-7
votes
1 answer

Reversing Diagonal in a Matrix in Java

I´m trying to reverse a Diagonal of a matrix in java! I've done everything but nothing works. Please see the image below so you can understand the question!!!
Falco
  • 1
  • 2
1 2 3
38
39