func TestSinv() { dims := makeDims() s, _ := matrix.FloatParseSpe(s_sinv) l, _ := matrix.FloatParseSpe(lmbda_sinv) fmt.Printf("s=\n%s\n", s.ConvertToString()) fmt.Printf("lambda=\n%s\n", l.ConvertToString()) cvx.Sinv(s, l, dims, 0) fmt.Printf("s=\n%s\n", s.ConvertToString()) }
func TestSinv2() { dims := makeDims() sS2 := "[ 4.58e+01]" + "[ 4.35e+01]" + "[ 2.83e+01]" + "[ 1.97e+01]" + "[-1.84e+01]" + "[ 2.69e+00]" + "[ 5.09e+01]" + "[ 7.07e-02]" + "[ 4.09e-01]" + "[-1.27e+00]" + "[ 1.75e+02]" + "[ 0.00e+00]" + "[ 0.00e+00]" + "[ 0.00e+00]" + "[ 1.04e+02]" + "[ 0.00e+00]" + "[ 0.00e+00]" + "[ 0.00e+00]" + "[ 3.89e+01]" lmbdaS2 := "[ 6.77e+00]" + "[ 6.59e+00]" + "[ 4.27e+00]" + "[ 2.30e+00]" + "[-2.16e+00]" + "[ 3.15e-01]" + "[ 7.14e+00]" + "[ 4.95e-03]" + "[ 2.86e-02]" + "[-8.90e-02]" + "[ 1.32e+01]" + "[ 1.02e+01]" + "[ 6.24e+00]" + "[ 1.00e+00]" sinv_res := "[-6.77e+00]" + "[-6.59e+00]" + "[-4.27e+00]" + "[-2.30e+00]" + "[ 2.16e+00]" + "[-3.15e-01]" + "[-7.14e+00]" + "[-4.95e-03]" + "[-2.86e-02]" + "[ 8.90e-02]" + "[-1.32e+01]" + "[-0.00e+00]" + "[-0.00e+00]" + "[-0.00e+00]" + "[-1.02e+01]" + "[-0.00e+00]" + "[-0.00e+00]" + "[-0.00e+00]" + "[-6.24e+00]" s, _ := matrix.FloatParsePy(sS2) lmbda, _ := matrix.FloatParsePy(lmbdaS2) cvx.Sinv(s, lmbda, dims, 0) blas.ScalFloat(s, -1.0) res_s, _ := matrix.FloatParsePy(sinv_res) fmt.Printf("res=\n%v\n", s) fmt.Printf("OK=%v\n", s.Equal(res_s)) }