In [1]:
from __future__ import division
import numpy as np

from locore import AnalysisSparse

In [2]:
n = 10
q = 7
D = np.eye(n)
Phi = np.random.randn(q,n)
sp = AnalysisSparse(D, Phi)

In [3]:
x = zeros((n,1))
x[1] = 1
x[5] = 1

In [4]:
sp.tangent_model(x)


Out[4]:
array([[ 0.,  0.],
       [ 1.,  0.],
       [ 0.,  0.],
       [ 0.,  0.],
       [ 0.,  0.],
       [ 0.,  1.],
       [ 0.,  0.],
       [ 0.,  0.],
       [ 0.,  0.],
       [ 0.,  0.]])

In [5]:
sp.ic(x)


Out[5]:
0.68789524547998249

In [6]:
plt.plot(sp.linearized_precertificate(x))


Out[6]:
[<matplotlib.lines.Line2D at 0x1060211d0>]

In [7]:
sigma = 0.05
y = np.dot(Phi, x) + sigma * np.random.randn(q,1)
plot(y)


Out[7]:
[<matplotlib.lines.Line2D at 0x10605bfd0>]

In [8]:
sp.solve_l2(1.5 * sigma, y)


Out[8]:
array([[  9.66506240e-06],
       [  9.34616618e-01],
       [  3.35928176e-05],
       [ -4.15832767e-06],
       [ -2.48913627e-02],
       [  1.00168652e+00],
       [  1.19330713e-02],
       [  7.53967906e-06],
       [  2.93738652e-02],
       [ -4.16347897e-05]])

In [9]:
sp.solve_noiseless(y)


Out[9]:
array([[-0.02278621],
       [ 0.91967071],
       [ 0.0033481 ],
       [-0.01199135],
       [-0.12184262],
       [ 1.05374356],
       [-0.00319468],
       [ 0.00898815],
       [ 0.04030116],
       [ 0.01082875]])