normn
The normn functionnormalizes the values in a general lua table that may contain non-numeric values, named keys, and sub-tables, so that their sum equals 1.0. Only numeric values found in the table are used in the calculation. The related norm function normalizes a 1-dimensional array, CImage, or list of numbers. Since an array is a specific type of table that contains only numbers or sub-tables, this function can also be used for arrays
new_table = normn( table )
table is a general lua table.
new_table is the returned table.
The following script creates a Gaussian normal population of 10,000 numbers with the area under the curve normalized to 1.0.
|
-- create a table of 10,000 values and normalize it |
The next example normalizes an ugly, complex table:
|
|
|
-- normalize the table |
Table and Array Functions, norm
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.