@Override public double[][] unmix(double[][] spectra) { final double[][] abundances = super.unmix(spectra); return LinearAlgebra.subtract(abundances, a, LinearAlgebra.multiplyAndSubtract(z, abundances, 1.0)); } }
spectralUnmixing = new UnconstrainedLSU(lsuMatrixElements); } else if (C_LSU.equals(unmixingModelName)) { spectralUnmixing = new ConstrainedLSU(lsuMatrixElements); spectralUnmixing = new FullyConstrainedLSU(lsuMatrixElements); } else if (unmixingModelName == null) { spectralUnmixing = new UnconstrainedLSU(lsuMatrixElements);
public void testUnconstrainedUnmixing() throws IOException { SpectralUnmixing mlm = new UnconstrainedLSU(endmembers.getArray()); Matrix abundUnconstrBeam = new Matrix(mlm.unmix(spectra.getArray())); Matrix abundUnconstrEnvi = Matrix.read(getResourceReader("abundances-unconstr-envi.csv")); Matrix abundUnconstrExpected = Matrix.read(getResourceReader("abundances-unconstr-expected.csv")); assertEquals("Difference of abundances (BEAM minus ENVI, unconstrained)", 0.0, maxAbs(abundUnconstrBeam.minus(abundUnconstrEnvi)), 1e-4); assertEquals("Difference of abundances (BEAM minus EXPECTED, unconstrained)", 0.0, maxAbs(abundUnconstrBeam.minus(abundUnconstrExpected)), 1e-7); }