Linear Algebra - How do I put the following matrix into a tridiagonal one using partial pivoting and row operations

How do I put the following matrix into a tridiagonal one using partial pivoting and row operations

0 1 3
-1 2 8
2 -1 5

First I swapped rows 1 and 3 to get the largest absolute pivot/diagonal entry

2 -1 5
-1 2 8
0 1 3

Then I took R2 <-- 2R2 + R1

2 -1 5
0 3 21
0 1 3

I'm unsure how to get that 21 in the bottom position in the last column as it will effect the diagonal entry in column 2. Unless I am doing this wrong, any help is appreciated.

πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Nov 05 2021
🚨︎ report
Eigenvalues of matrix composed of blocks of tridiagonal Toeplitz matrices

I am hoping someone can help me begin to address my deficiencies in understanding this problem. On Math Stack Exchange, the OP is asking how to find eigenvalues and eigenvectors of block Toeplitz matrices. I have a similar problem I wish to solve, but I would like to understand their work first, so my question is this:

How did the OP go from, T, a 2N-by-2N matrix, represented as the sum of tensor products (the Pauli matrix step) to T as the sum of (2-by-2) matrices after plugging in the eigenvalues of each (N-by-N) sub-block of T?

I understand that the eigenvalues of the tridiagonal Toeplitz matrices fill each of the elements of the 2-by-2 representation of T, and also that the eigenvectors of tridiagonal N-by-N Toeplitz matrices (e.g., A, B, etc) are all the same, and thus simultaneously diagonalize all blocks of T(2N-by-2N).

Thanks for the help!

πŸ‘︎ 19
πŸ’¬︎
πŸ‘€︎ u/the-alchemist11
πŸ“…︎ Apr 08 2021
🚨︎ report
Optimizing Solver for Almost Tridiagonal Matrix

I have a working subroutine for solving a tridiagonal matrix with periodic boundary conditions (this is the problem formulation). I have modified this subroutine in order to preserve the matrix. Here is what I have,

subroutine triper_vec(dl, dm, du, b, x, n)
    integer, intent(in) :: n
    double precision, intent(in) :: dl(:)   ! lower-diagonal
    double precision, intent(in) :: dm(:)   ! main-diagonal
    double precision, intent(in) :: du(:)   ! upper-diagonal
    double precision, intent(in) :: b(:)    ! b vector
    double precision, intent(inout) :: x(:) ! output

    double precision, dimension(n) :: w     ! work array
    double precision, dimension(n) :: maind ! used to preserve matrix
    integer :: i, ii
    double precision :: fac

    w(1) = -dl(1)
    maind(1) = dm(1)
    x(1) = b(1)
    do i = 2, n - 1, 1
        ii = i - 1
        fac = dl(i) / maind(ii)
        maind(i) = dm(i) - (fac * du(ii))
        x(i) = b(i) - (fac * x(ii))
        w(i) = -fac * w(ii)
    end do
    x(n) = b(n)
    maind(n) = dm(n)

    ii = n - 1
    x(ii) = x(ii) / maind(ii)
    w(ii) = (w(ii) - du(ii)) / maind(ii)

    do i = n - 2, 1, -1
        ii = i + 1
        x(i) = (x(i) - du(i) * x(ii)) / maind(i)
        w(i) = (w(i) - du(i) * w(ii)) / maind(i)
    end do

    i = n
    ii = n - 1
    fac = maind(i) + (du(i) * w(1)) + (dl(i) * w(ii))
    x(i) = (x(i) - ((du(i) * x(1)) + (dl(i) * x(ii)))) / fac

    fac = x(n)
    do i = 1, n - 1, 1
        x(i) = x(i) + (w(i) * fac)
    end do

end subroutine triper_vec

Are there any glaring issues that could lead to performance increases? Or is there anything I can do to allow the compiler to produce a more optimized result? I am compiling with

gfortran -march=native -O3 triper.f90
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/vlovero
πŸ“…︎ Jan 26 2021
🚨︎ report
Tridiagonal Systems help please

Our code is given down below. We have been struggling wrapping our heads around how to write this matlab code. We cannot get the correct values and have tried multiple ways to find the correct values for u. Any help would be greatly appreciated :)

clear;

A = [3 5 0 0

1 4 6 0

0 5 7 3

0 0 3 8];

k = [13 27 43 41];

a = [];

b = [];

c = [];

n = length(A);

m = n-1;

for i = 1:n

f = A(i,i);

a(i) = f;

end

for i = 1:m

p = 1 + i;

s = A(i,p);

b(i) = s;

end

for i = 1:m

p = 1 + i;

s = A(p,i);

c(i) = s;

end

for i = 1:m

f = c(i)./a(i);

R = c(i) - f*a(i);

c(i) = 0;

a(i+1) = R;

end

u = [];

%u is supposed to equal [1 2 3 4]

https://preview.redd.it/genwag3ckgq61.png?width=621&format=png&auto=webp&s=759de8e747b8fec9c0183a2ce647849e35917dff

https://preview.redd.it/kqel5i3ckgq61.png?width=590&format=png&auto=webp&s=8bc9630ec4133650059996aea2de469bb5a5fe13

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/flynnboy02
πŸ“…︎ Apr 01 2021
🚨︎ report
GLTR : What to do when the solution of the tridiagonal subproblem isn't available due to numerical errors ?

I'm using the generalized Lanczos trust-region method (GLTR) to solve a trust region subproblem. Each tridigonal subproblems are solved via the MorΓ©-Sorensen method.
Sometimes at a given iteration, the method fails at finding a sufficiently accurate solution to the tridiagonal subproblem.
What is the standard course of action in this case ?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/hoffnoob1
πŸ“…︎ Mar 05 2021
🚨︎ report
Is there a similar law to the Semicircle law but for real tridiagonal matrices instead of real symmetric matrices?

Semicircle law is that given a real symmetric matrix of dimension N, as N increases, the distribution of eigenvalues tends towards a semicircle distribution. It's like the Cemtral limit theorem in a way. Was wondering if there is a similar rule for tridiagonal matrices.

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/Kusokuso69
πŸ“…︎ Oct 23 2020
🚨︎ report
Tridiagonal preconditioner for conjugated gradient

I am trying to use this preconditioner (made by simply taking the 3 diagonals of my matrix) to fasten the convergence of the conjugated gradient, but it keeps bahving way worse than without any, so I'm wondering if it is known that it behaves nicely in very few cases or it normally behaves good and I probably did some mistakes writing my code (though I checked more times than my sanity can handle). Thanks in advance!

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/Rienchet
πŸ“…︎ Nov 07 2020
🚨︎ report
[Thesis] University of Washington - "Towards the solution of the eigenproblem: Nonsymmetric tridiagonal matrices"
  • Citation:

Author: Jason Slemons

Year: 2008

Title: Towards the solution of the eigenproblem: Nonsymmetric tridiagonal matrices

Institution: University of Washington

Can anyone with access help download this?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/CyLith
πŸ“…︎ Dec 08 2017
🚨︎ report
[Linear Algebra] - Showing that the eigenvalues of a tridiagonal matrix are all strictly positive

Hello,

I am having trouble showing that the eigenvalues of a tridiagonal matrix are all strictly positive. The tridiagonal matrix has 2's along the main diagonal and -1's directly above and below the main diagonal, and every other entry is 0. Help is appreciated!

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Sky_Lyte_Shaymin
πŸ“…︎ Apr 01 2017
🚨︎ report
Does 2018b automatically invert tridiagonal matrices with Thomas algorithm?

Ive written a code for a 2D heat conduction which solves multiple tridiagonal systems.

Does matlab 2018b automatically invert these matrices with the efficient Thomas algorithm? I think I read somewhere that it does but I can't find it anymore.

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/EHRoelfzema
πŸ“…︎ Sep 13 2019
🚨︎ report
Standard tridiagonal matrix Eigenvalue decomposition algorithm?

Hi I am trying to generate an arbitrary Gauss quadrature rule by using the Golub-Welsh algorithm (here). I need to code this on C++ for my personal project. This algorithm involves the eigenvalue decomposition of a matrix in which the only non-zero elements are the subdiagonal and superdiagonal. To illustrate in Matlab code: n = 16; beta = .5./sqrt(1-(2*(1:n-1)).-2); T = diag(beta,1) + diag(beta,-1); [V,D] = eig(T); I want to implement the eigenvalue decomposition in code and not use Matlab routines for this since I want to parallelize it. What is the best way to do eigenvalue decomposition for this type of matrix? Is bisection method acceptable for my use case? How about divide and conquer or QR method or Lanczos? I expect the n to be upto 512.

EDIT: the MRRR technique was pointed to me in another forum. It is a relatively new technique developed by Dhillon and Parlett. Apparently it has extremely good time complexity and has a guaranteed accuracy.

πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/nicholasferber
πŸ“…︎ Apr 04 2014
🚨︎ report
Optimizing QR decomposition of tridiagonal matrices in Julia ericmart.in/blog/optimizi…
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/lightcatcher
πŸ“…︎ Jan 27 2014
🚨︎ report
LAPACK Subroutine for finding the eigenvalues and vectors for a non symmetric tridiagonal matrix.

I can only seem to find subroutines for general or symmetric tridiagonal matrices. Is it just me? Any answers are appreciated.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Qqslag
πŸ“…︎ Mar 07 2015
🚨︎ report
Help: Tridiagonal LU decomposition WITH pivoting

Hello, I kinda need help figuring out a void method that can perform LU decomposition with pivoting to an nxn tridiagonal matrix. The matrix is stored on 3 1-dimentional arrays OR an nxn matrix (not sure which is easiest for pivoting, it was easier to do it for no pivot). Anyone know any good resources or some good pseudocode that they can direct me to. Thanks

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Dogz1
πŸ“…︎ Mar 12 2012
🚨︎ report
Faster LU decomposition algorithm for tridiagonal, symmetric, Toeplitz matrices?

I am trying to improve on the Thomas algorithm in my computational physics course. The Thomas algorithm is a fast way of solving for x in Ax=b, where A is tridiagonal. But the matrices I am working with are tridiagonal, symmetric, and Toeplitz (every value on the same diagonal is the same).

http://www.cfm.brown.edu/people/gk/chap6/node13.html

At the moment I am using the discrete second derivative matrix with Dirichlet bundary conditions. This has 2 on the main diagonal and -1 on the off diagonals, so it is also positive semidefinite, but I would like the algorithm to not rely on that property if I can help it.

The first step, the one I am trying to optimize, is to LU factor the matrix, which I can currently achieve in 1N fused-multiply-add operations, 1N multiplication, and 1N division. Using the conventions in the link above I have:

d(0) = 1.0f / b; // This is the INVERSE of d(0). We store the reciprocals.
l(0) = 0; // actually, it is just undefined!
for (int i=1; i&lt;n; i++) {
    l(i) = negative_a * d(i-1); // This stores the NEGATIVE of 'l'.
    d(i) = 1.0f / fma(a, l(i), b); // This stores the INVERSE of 'd'.
}

Yet, we see that for the specific matrix mentioned above, the elements of l and d are simply given by (i+1)/i and its negative reciprocal. I can absorb the negative into a constant in future calculations. This seems to mean that I could decompose the matrix in 2N division and 1N addition, where the divisions can be parallelized and the addition can be easily pipelined.

Looking at the symbol factorization of tridiagonal, symmetric, Toeplitz matrices in Maxima I see that the main diagonal of the U matrix, and the lower diagonal of the L matrix share a recurrence relation. I do not know how to, but would like to know how to solve this recurrence relation:

d(1) = b;

l(k) = a / d(k-1);

d(k) = b - a*l(k);

I also happened to learn that all tridiagonal, symmetric, Toeplitz matrices have the same eigenvectors. I am not sure if that could help me in any way.

This is not a part of homework, I am just doing it for fun.

Code listed below for completeness. Again, variable naming conventions follow that of the link listed above.

d(0) = 1.0f / b; // This is the INVERSE of d(0)! We store the reciprocals.
l(0) = 0; // actually, it is just undefined!
for (int i=1; i&lt;n; i++) {
    l(i) = negative_a * d(i-1); // This stores the NEGATIVE of 'l'!
    d(i) = 1.0f / fma(a, l(i), b); // This stores 
... keep reading on reddit ➑

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/csp256
πŸ“…︎ Aug 29 2014
🚨︎ report
SERIOUS: This subreddit needs to understand what a "dad joke" really means.

I don't want to step on anybody's toes here, but the amount of non-dad jokes here in this subreddit really annoys me. First of all, dad jokes CAN be NSFW, it clearly says so in the sub rules. Secondly, it doesn't automatically make it a dad joke if it's from a conversation between you and your child. Most importantly, the jokes that your CHILDREN tell YOU are not dad jokes. The point of a dad joke is that it's so cheesy only a dad who's trying to be funny would make such a joke. That's it. They are stupid plays on words, lame puns and so on. There has to be a clever pun or wordplay for it to be considered a dad joke.

Again, to all the fellow dads, I apologise if I'm sounding too harsh. But I just needed to get it off my chest.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/anywhereiroa
πŸ“…︎ Jan 15 2022
🚨︎ report
Blind Girl Here. Give Me Your Best Blind Jokes!

Do your worst!

πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Leckzsluthor
πŸ“…︎ Jan 02 2022
🚨︎ report
This subreddit is 10 years old now.

I'm surprised it hasn't decade.

πŸ‘︎ 14k
πŸ’¬︎
πŸ‘€︎ u/frexyincdude
πŸ“…︎ Jan 14 2022
🚨︎ report
Dropped my best ever dad joke & no one was around to hear it

For context I'm a Refuse Driver (Garbage man) & today I was on food waste. After I'd tipped I was checking the wagon for any defects when I spotted a lone pea balanced on the lifts.

I said "hey look, an escaPEA"

No one near me but it didn't half make me laugh for a good hour or so!

Edit: I can't believe how much this has blown up. Thank you everyone I've had a blast reading through the replies πŸ˜‚

πŸ‘︎ 20k
πŸ’¬︎
πŸ‘€︎ u/Vegetable-Acadia
πŸ“…︎ Jan 11 2022
🚨︎ report
What starts with a W and ends with a T

It really does, I swear!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/PsychedeIic_Sheep
πŸ“…︎ Jan 13 2022
🚨︎ report
Why did Karen press Ctrl+Shift+Delete?

Because she wanted to see the task manager.

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Eoussama
πŸ“…︎ Jan 17 2022
🚨︎ report
So 2 trees got arrested in the town I live...

Heard they've been doing some shady business.

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/K1ll47h3K1n9
πŸ“…︎ Jan 18 2022
🚨︎ report
What is a a bisexual person doing when they’re not dating anybody?

They’re on standbi

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Toby-the-Cactus
πŸ“…︎ Jan 12 2022
🚨︎ report
What is the scariest tree?

BamBOO!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/K1ll47h3K1n9
πŸ“…︎ Jan 18 2022
🚨︎ report
Geddit? No? Only me?
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/shampy311
πŸ“…︎ Dec 28 2021
🚨︎ report
I wanna hear your best airplane puns.

Pilot on me!!

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/Paulie_Felice
πŸ“…︎ Jan 07 2022
🚨︎ report
E or ß?
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Amazekam
πŸ“…︎ Jan 03 2022
🚨︎ report
What did Spartacus say when the lion ate his wife?

Nothing, he was gladiator.

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/rj104
πŸ“…︎ Jan 15 2022
🚨︎ report
Pun intended.
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Sharmaji1301
πŸ“…︎ Jan 15 2022
🚨︎ report
No spoilers
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Onfour
πŸ“…︎ Jan 06 2022
🚨︎ report
Covid problems
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/theincrediblebou
πŸ“…︎ Jan 12 2022
🚨︎ report
These aren't dad jokes...

Dad jokes are supposed to be jokes you can tell a kid and they will understand it and find it funny.

This sub is mostly just NSFW puns now.

If it needs a NSFW tag it's not a dad joke. There should just be a NSFW puns subreddit for that.

Edit* I'm not replying any longer and turning off notifications but to all those that say "no one cares", there sure are a lot of you arguing about it. Maybe I'm wrong but you people don't need to be rude about it. If you really don't care, don't comment.

πŸ‘︎ 12k
πŸ’¬︎
πŸ‘€︎ u/Lance986
πŸ“…︎ Dec 15 2021
🚨︎ report
Spi__
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 11 2022
🚨︎ report
What did 0 say to 8 ?

What did 0 say to 8 ?

" Nice Belt "

So What did 3 say to 8 ?

" Hey, you two stop making out "

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/designjeevan
πŸ“…︎ Jan 03 2022
🚨︎ report
Is a 1x1 matrix tridiagonal?
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/DeliciousReport
πŸ“…︎ Jun 07 2019
🚨︎ report
Is there way to ascertain the rref of a tridiagonal matrix in a (N)x(N+1) matrix with only N operations?
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/ansariddle
πŸ“…︎ Nov 25 2016
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.