pro xform_redden,colin,xformsav,colout
; this routine transforms the reddening vector array colin according
; to the set of linear transformation coefficients found in file xformsav,
; containing data written by m67_color_fit,
; and returns the transformed reddenings in colout.
; Requires 9 colors: u-g, g-r, r-i, i-z, z-J, J-H, H-K, g-Gred, g-D51
;  The algebra behind this is:
;  xform_color computes transformed stellar colors as
;
;   c'* = c* + aa + bb*(g*-r* - 0.5)
;
;   If c* is reddened by delta(c) before the transformation then
;
;   c'* = c* + aa + bb*(g*-r* - 0.5) + delta(c) + bb*(delta(g-r))

restore,xformsav
xx=colin(1,*)
colout=colin
for i=0,8 do begin
  colout(i,*)=colout(i,*)+bb(i)*xx
endfor

end