function [knotsx,knotsy,coefs,n,k]=tspbrk(tsp,print)
%TSPBRK	Take apart a tensor product spline in B-form.
%
%        [knotsx,knotsy,coefs,n,k]=tspbrk(tsp,print)
%
%  breaks apart a tensor product spline in B-form and, optionally, prints its 
%  parts.

% C. de Boor : Feb.4, 1991
% Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.


if (tsp(1)~=21),
   error('the input array does not seem to describe a tensor product spline')
else,
   r=tsp(2);c=tsp(3);
   coefs=zeros(r,c);coefs(:)=tsp(3+[1:r*c]);
   kx=tsp(4+r*c);knotsx=tsp(4+r*c+[1:kx+r]);
   ky=tsp(5+r*c+kx+r);knotsy=tsp(5+r*c+kx+r+[1:ky+c]);
   if (nargin>1), knotsx,knotsy,coefs,[r,c],[kx,ky],end
end
