forum.alglib.nethttp://forum.alglib.net/ SKS solverhttp://forum.alglib.net/viewtopic.php?f=2&t=4531 Page 1 of 1

 Author: gabbia [ Mon Mar 20, 2023 9:55 am ] Post subject: SKS solver Dear all,I am trying to understand how it works the SKS format. Since I am obtaining incorrect results, I tried first to create a normal NxN sparse matrix, and then convert it to sks format. However, I am still getting incongruous results. Here is the piece of code (C#) that I am using for testing:alglib.sparsematrix ss = new alglib.sparsematrix();int nndof = 3;alglib.sparsecreate(nndof, nndof,out ss);alglib.sparseset(ss, 0, 0, 1.0);alglib.sparseset(ss, 1, 1, 20.0);alglib.sparseset(ss, 2, 2, 10.0);alglib.sparseset(ss, 1, 2, -10.0);alglib.sparseset(ss, 2, 1, -10.0);alglib.sparsesolverreport report2 = new alglib.sparsesolverreport();double[] force2 = new double[nndof];force2[2] = -10.0;double[] disp2 = new double[nndof];alglib.sparsesolve(ss, force2, out disp2, out report2);double[] disp3 = new double[nndof];alglib.sparseconverttosks(ss);alglib.sparsespdcholeskysolve(ss, true, force2, out disp3, out report2);Results:Disp2 = [0, -1, -2] (Correct)Disp3 = [0, -0.05, -0.1] (Incorrect)Can you please help me to understand what I am doing wrong? Many thanks.Best regards,Gabbia

 Author: Sergey.Bochkanov [ Wed Mar 29, 2023 5:06 pm ] Post subject: Re: SKS solver Hi!The reason is that spdcholeskysolve() family of functions expects its data to be not the matrix itself, but its Cholesky decomposition. That's why it gives wrong result - you passed original matrix which is used as if it was a Cholesky factor.You should use:* sparsespdsolvesks to solve SPD system in SKS format, usually low profile* sparsespdsolve to solve general SPD system* sparsesolve to solve general nonsymmetric system

 Author: gabbia [ Mon Apr 03, 2023 4:08 pm ] Post subject: Re: SKS solver Many thanks!

 Page 1 of 1 All times are UTC Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/