CPolynomial:Empty


The Empty method deletes all coefficients from the coefficient array.

Syntax

CPolynomial:Empty()

Remarks

This resets to zero all 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.

Example

The following script empties the coefficients from CPolynomial P:

P = new_polynomial()

-- 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

Related Topics

CPolynomial


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.