CPolynomial:Empty
The Empty method deletes all coefficients from the set.
CPolynomial:Empty() |
This resets to zero array elements without deleting the CPolynomial object itself. If you delete the CPolynomial, the object is set to nil and cannot be used again without creating a new instance with new. By calling Empty, the existing CPolynomial can be used to Set new orders, and so forth.
The following script fragment empties the coefficients from CPolynomial P:
P = CPolynomial:new() |
-- create a CPolynomial |
P:Set( 0, 5.5) |
-- set coef[0] |
P:Set( 1, 0.144) |
-- set coef[1] |
P:Set( 4, -1.045e-6) |
-- set coef[4] |
Printf("Ncoefs = %d", P:Count()) |
-- result: Ncoefs = 3 |
P:Empty() |
-- empty the CPolynomial object |
Printf("Ncoefs = %d", P:Count()) |
-- result: Ncoefs = 0 |
P:delete() |
-- if finished with P, clean up memory |