1
2 """
3 The :mod:`parsimony.algorithms.deflation` module contains deflation procedures.
4 functions.
5
6 Created on Fri Mar 21 15:18:56 2014
7
8 Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.
9
10 @author: Tommy Löfstedt
11 @email: lofstedt.tommy@gmail.com
12 @license: BSD 3-clause.
13 """
14 import abc
15
16 import numpy as np
17
18 __all__ = ["ProjectionDeflation",
19 "RowProjectionDeflation", "ColumnProjectionDeflation",
20 "RankOneDeflation"]
24 __metaclass__ = abc.ABCMeta
25
26 @abc.abstractmethod
28 raise NotImplementedError('Abstract method "deflate" must be ' \
29 'specialised!')
30
33
35 return X - np.dot(np.dot(X, w), w.T) / np.dot(w.T, w)
36
37
38 ProjectionDeflation = RowProjectionDeflation
42
44 return X - np.dot(t / np.dot(t.T, t), np.dot(t.T, X))
45
48
50 return X - np.dot(t, p.T)
51