tensor_methods

Tensor Methods for DS and SC
git clone git://popovic.xyz/tensor_methods.git
Log | Files | Refs

err_lucross.jl (531B)


      1 #/usr/bin/julia
      2 
      3 using LinearAlgebra
      4 using Plots
      5 using Maxvol
      6 using TSVD
      7 using LaTeXStrings
      8 
      9 function M_cross_lu_err(M, r, pivot=Val(true))
     10     M_mk = copy(M[:, 1:r]);
     11     C = copy(M_mk);
     12     piv, ntimes = maxvol!(C);
     13     F = lu(M_mk[piv, :], pivot, check=false)
     14     M_mk[piv, :] =  F.P * F.L * F.U ;
     15     return M - C*M[piv, :], piv
     16 end
     17 
     18 function cross_lu_error(M, x, pivot)
     19     y_frb = [norm(M_cross_lu_err(M, i,pivot)[1]) for i in x]
     20     y_max = [norm(M_cross_lu_err(M, i,pivot)[1], Inf) for i in x]
     21     return y_frb, y_max
     22 end;