Record Class MeasurementMatrix
- Record Components:
phi- The underlying sensing matrix Φ (m × n).wavelet- Optional wavelet sparsifying basis. May be null.
- All Implemented Interfaces:
Serializable
In compressed sensing the measurement process is modeled as
y = Φ Ψ s, where:
Φis them × nsensing matrix (e.g. random Gaussian or Bernoulli projections),Ψis then × nsparsifying basis (e.g. a wavelet transform), andsis the sparse coefficient vector in the basis domain.
Recovery algorithms (BasisPursuit, OMP, CoSaMP)
operate on the compound measurement matrix A = Φ Ψ or,
when no sparsifying basis is needed, directly on Φ.
For large n the wavelet sparsifying basis is applied
implicitly as a matrix–vector operator (forward / inverse DWT)
rather than explicitly forming the full n × n matrix, which makes
the approach memory-efficient.
Supported sensing matrix types
gaussian(int, int)– i.i.d. Gaussian entries scaled by1/√m; satisfies the RIP with high probability form = O(k log(n/k)).bernoulli(int, int)– i.i.d. ±1/√m Bernoulli entries; also satisfies the RIP with the same sample complexity.partial(int[], int)– a random row-sub-sampling of then × nidentity matrix (partial identity / random sampling).
Sparsifying bases
When the signal is sparse in a wavelet domain, pass a Wavelet
instance to withWavelet(Wavelet). The returned matrix operator
composes Φ with the DWT implicitly, so y = Φ DWT(x) for
a signal x of length n (a power of 2).
References
- E. J. Candès and M. B. Wakin, "An introduction to compressive sampling", IEEE Signal Process. Mag., 25(2):21–30, 2008.
- R. Baraniuk, "Compressive sensing", IEEE Signal Process. Mag., 24(4):118–121, 2007.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a measurement matrix without a sparsifying basis.MeasurementMatrix(DenseMatrix phi, Wavelet wavelet) Creates an instance of aMeasurementMatrixrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]backProject(double[] y) Computes the adjoint operationv = Φ^T y(back-projection).double[]backProjectSparse(double[] y) Computes the adjoint in the sparse (wavelet) domain:v = Ψ^T Φ^T y = DWT(Φ^T y).static MeasurementMatrixbernoulli(int m, int n) Creates a random Bernoulli sensing matrix with entriesΦ_{ij} ∈ {+1/√m, −1/√m}with equal probability.final booleanIndicates whether some other object is "equal to" this one.static MeasurementMatrixgaussian(int m, int n) Creates a random Gaussian sensing matrix with entriesΦ_{ij} ~ N(0, 1/m).final inthashCode()Returns a hash code value for this object.double[]measure(double[] x) Computes measurementsy = Φ x(no wavelet basis).double[]measureSparse(double[] s) Computes measurementsy = Φ Ψ swhereΨis the inverse-DWT operator (synthesis).intncol()Returns the signal dimension (columns of Φ).intnrow()Returns the number of measurements (rows of Φ).static MeasurementMatrixpartial(int[] rows, int n) Creates a partial identity (random row-sub-sampling) sensing matrix.static MeasurementMatrixpartial(int m, int n) Creates a random partial identity sensing matrix by selectingmrows uniformly at random without replacement.phi()Returns the underlying sensing matrix Φ.toMatrix()Returns an implicitMatrixthat represents the compound operatorA = Φ Ψ(orA = Φwhen no wavelet is set).final StringtoString()Returns a string representation of this record class.wavelet()Returns the wavelet sparsifying basis, ornullif not set.withWavelet(Wavelet wavelet) Returns a newMeasurementMatrixthat combines this sensing matrix with the given wavelet sparsifying basis.
-
Constructor Details
-
MeasurementMatrix
Constructs a measurement matrix without a sparsifying basis.- Parameters:
phi- the sensing matrix Φ.
-
MeasurementMatrix
Creates an instance of aMeasurementMatrixrecord class.
-
-
Method Details
-
nrow
public int nrow()Returns the number of measurements (rows of Φ).- Returns:
m.
-
ncol
public int ncol()Returns the signal dimension (columns of Φ).- Returns:
n.
-
phi
-
wavelet
Returns the wavelet sparsifying basis, ornullif not set.- Returns:
- the wavelet.
-
measure
public double[] measure(double[] x) Computes measurementsy = Φ x(no wavelet basis).- Parameters:
x- the signal vector of lengthn.- Returns:
- the measurement vector of length
m.
-
measureSparse
public double[] measureSparse(double[] s) Computes measurementsy = Φ Ψ swhereΨis the inverse-DWT operator (synthesis).When no wavelet is configured this method is equivalent to
measure(double[]).- Parameters:
s- the sparse coefficient vector in the wavelet domain (lengthn, power of 2).- Returns:
- the measurement vector of length
m.
-
backProject
public double[] backProject(double[] y) Computes the adjoint operationv = Φ^T y(back-projection).- Parameters:
y- the measurement vector of lengthm.- Returns:
- the signal-domain vector of length
n.
-
backProjectSparse
public double[] backProjectSparse(double[] y) Computes the adjoint in the sparse (wavelet) domain:v = Ψ^T Φ^T y = DWT(Φ^T y).- Parameters:
y- the measurement vector of lengthm.- Returns:
- the sparse-domain vector of length
n.
-
toMatrix
Returns an implicitMatrixthat represents the compound operatorA = Φ Ψ(orA = Φwhen no wavelet is set). The matrix ism × nand supports bothmvandtv(adjoint) matrix–vector products without explicitly forming the full matrix.Pass the returned matrix directly to
BasisPursuit.fit(Matrix, double[]),OMP.fit(Matrix, double[], int), orCoSaMP.fit(Matrix, double[], int).- Returns:
- the implicit compound measurement matrix.
-
gaussian
Creates a random Gaussian sensing matrix with entriesΦ_{ij} ~ N(0, 1/m).Gaussian matrices satisfy the restricted isometry property (RIP) of order
kwith high probability whenm ≥ C k log(n/k), for a universal constantC.- Parameters:
m- the number of measurements (rows).n- the signal dimension (columns).- Returns:
- the sensing matrix.
-
bernoulli
Creates a random Bernoulli sensing matrix with entriesΦ_{ij} ∈ {+1/√m, −1/√m}with equal probability.- Parameters:
m- the number of measurements (rows).n- the signal dimension (columns).- Returns:
- the sensing matrix.
-
partial
Creates a partial identity (random row-sub-sampling) sensing matrix.The sensing matrix is a sub-matrix of the
n × nidentity formed by randomly selectingmrows without replacement. Equivalently,(Φ x)_i = x_{rows[i]}.- Parameters:
rows- the row (sample) indices to retain; must be in[0, n).n- the signal dimension.- Returns:
- the sensing matrix.
-
partial
Creates a random partial identity sensing matrix by selectingmrows uniformly at random without replacement.- Parameters:
m- the number of measurements.n- the signal dimension.- Returns:
- the sensing matrix.
-
withWavelet
Returns a newMeasurementMatrixthat combines this sensing matrix with the given wavelet sparsifying basis.- Parameters:
wavelet- the wavelet defining the sparsifying transform Ψ.- Returns:
- the compound measurement matrix.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-