begin # file a block, fn SubSample(), 2004 July 04, Jim Worthey
# Converted from a routine now called SubSampleVrhel
function SubSample(Spectrum, Lamz, NewLamz) begin
# Spectrum is the known vector, at 1 nm steps.
# Lamz is the domain of spectrum, for example lambdas.
# NewLamz is the new domain, which should be a subset of Lamz.
NumLamz = rowdim(Lamz)
LamLoHi = [Lamz(1), Lamz(end)] # ??
LamLo = LamLoHi(1)
NewLoHi = [NewLamz(1), NewLamz(end)]
NumNew = rowdim(NewLamz)
NumKols = coldim(Spectrum)
VexNew = zeros(NumNew,NumKols)
for j = 1 to NumNew begin
lambda = NewLamz(j)
oldindex = lambda - LamLo + 1
if Lamz(oldindex) <> lambda then begin
beep
dumb = ["In SubSample(), oldindex = ", ntoa(oldindex),...
", but lambda = ",ntoa(lambda)]
print(dumb)
halt
end # if Lamz(
VexNew.row(j) = Spectrum.row( oldindex )
end # for j
return VexNew
end # function SubSample()
end # entire file a block