function [calcabs calcconcs]=oparef(obsdata,ncomp,refvectors)

	dissimilarity=zeros(1,rows(obsdata));
	for n=1:columns(refvectors)
		refvectors(:,n)=refvectors(:,n)./sqrt(sum(dot(refvectors(:,n),refvectors(:,n)))); # 'removed '
	endfor

#	size(refvectors)
	calcabs=refvectors./sqrt(sum(dot(refvectors,refvectors)));

	for n=columns(calcabs)+1:ncomp
#		size(ys)
#		n
		for m=1:rows(obsdata)
			testvectors=[calcabs obsdata(m,:)']';
			dissimily(1,m)=det(testvectors*testvectors');
		endfor

		[maxvalue whichindex]=max(dissimily);

		calcabs=[calcabs (obsdata(whichindex,:)'./sqrt(sum(dot(obsdata(whichindex,:),obsdata(whichindex,:)'))))];
	endfor
	calcabs=calcabs';
	calcconcs=obsdata*pinv(calcabs);
endfunction
