Guest User

Untitled

a guest
Jul 12th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Initialization variables:
  2. a = p+1;
  3. b = a+1;
  4. nb = 1;
  5. c1 = 0;
  6. c1 (nt+1) = 1;
  7. mbar = p + 2 + nt + m;
  8. ki = 1;
  9. si = 1;
  10. while b < mbar do
  11.   cnb+1 = 0; // Initialize the next extraction operator row.
  12.   // Count multiplicity of the knot at location b.
  13.   add = 0;
  14.   if si <= m && spans(si) = ki do
  15.     mult = 0;
  16.     add = 1;
  17.     // Add the new knot to the knot vector.
  18.     Ubar(b+1:mbar+p-m+si) = Ubar(b:mbar+p-m+si-1);
  19.     Ubar(b) = U(si);
  20.     si = si + 1;
  21.   else
  22.     ki = ki+1;
  23.     i = b;
  24.     while b < m && Ubar(b+1) == Ubar(b) do b = b+1;
  25.     mult = b-i+1;
  26.   end
  27.   if mult < p do
  28.     numer = Ubar(b)-Ubar(a);
  29.     for j = p,p-1,. . .,mult+1 do
  30.       alphas(j-mult) = numer / (Ubar(a+j+add)-Ubar(a));
  31.     end
  32.     r = p-mult;
  33.     // Update the matrix coefficients for r new knots
  34.     for j=1,2,. . .,r do
  35.       save = r-j+1;
  36.       s = mult+j;
  37.       for k=p+1,p,. . .,s+1 do
  38.       alpha = alphas(k-s);
  39.       cnb (k) = alpha*cnb (k) + (1.0-alpha)*cnb (k-1);
  40.     end
  41.     if b < m do
  42.       // Update overlapping coefficients of the next operator row.
  43.       cnb+1 (save) = cnb (p+1);
  44.     end
  45.   end
  46.   nb = nb + 1; // Finished with the current operator.
  47.   if b < m do
  48.     // Update indices for the next operator.
  49.     a = b;
  50.     b = b+1;
  51.   end
  52. end
Add Comment
Please, Sign In to add comment