@@ -16,10 +16,10 @@ class GQR(QR):
1616 """
1717 General QR optimizer for sensor selection.
1818 Ranks sensors in descending order of "importance" based on
19- reconstruction performance . This is an extension that requires a more intrusive
19+ reconstruction accuracy . This is an extension that requires a more intrusive
2020 access to the QR optimizer to facilitate a more adaptive optimization. This is a generalized version of cost constraints
21- in the sense that users can allow n constrained sensors in the constrained area.
22- if n = 0 this converges to the CCQR results. If no constraints it converges to QR results.
21+ in the sense that users can allow `n_const_sensors` in the constrained area.
22+ if n = 0 this converges to the CCQR results. and if no constrained region it should converge to the results from QR optimizer .
2323
2424 See the following reference for more information
2525 Manohar, Krithika, et al.
@@ -46,8 +46,6 @@ def __init__(self):
4646 constraint_option : string,
4747 max_n_const_sensors : The number of sensors in the constrained region should be less than or equal to n_const_sensors.
4848 exact_n_const_sensors : The number of sensors in the constrained region should be exactly equal to n_const_sensors.
49- nx, ny : integer,
50- X, Y dimensions of the grid.
5149 """
5250 self .pivots_ = None
5351 self .idx_constrained = []
@@ -59,7 +57,7 @@ def __init__(self):
5957 self .ny = None
6058 self .r = 1
6159
62- def fit (self ,basis_matrix = None ,** optimizer_kws ):
60+ def fit (self ,basis_matrix ,** optimizer_kws ):
6361 """
6462 Parameters
6563 ----------
@@ -78,6 +76,13 @@ def fit(self,basis_matrix=None,**optimizer_kws):
7876 n_features , n_samples = basis_matrix .shape # We transpose basis_matrix below
7977 max_const_sensors = len (self .idx_constrained ) # Maximum number of sensors allowed in the constrained region
8078
79+ ## Assertions and checks:
80+ # if self.n_sensors > n_features - max_const_sensors + self.nConstrainedSensors:
81+ # raise IOError ("n_sensors cannot be larger than n_features - all possible locations in the constrained area + allowed constrained sensors")
82+ # if self.n_sensors > n_samples + self.nConstrainedSensors: ## Handling zero constraint?
83+ # raise IOError ("Currently n_sensors should be less than min(number of samples, number of modes) + number of constrained sensors,\
84+ # got: n_sensors = {}, n_samples + const_sensors = {} + {} = {}".format(self.n_sensors,n_samples,self.nConstrainedSensors,n_samples+self.nConstrainedSensors))
85+
8186 # Initialize helper variables
8287 R = basis_matrix .conj ().T .copy ()
8388 p = np .arange (n_features )
0 commit comments