Linear least-squares analysis of PIXE spectra