Array1D class

This class provides utility functions for 1D arrays (vectors):

  • adding arrays with various options
  • Finding the minimum or maximum values with various options
  • splitting, shuffling, swapping, extracting given index ranges

Constructors

Array1D()

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

integ_trapez(Float64List array, int firstix, int lastix, double bias, double slope) → Float64List
Computes a new array representing the integral function of array in the specified range. array represents the values of a function at equidistant x coordinates. firstix first index in array to contribute to integral. lastix last index in array to contribute to integral. Returns the integral function computed from firstix until lastix with index increment 1. The last value in the returned array is the integral value over the entire region. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Properties

NEG ↔ int
Used in addArrays
read / write
POS ↔ int
Used in addArrays
read / write
POSNEG ↔ int
Used in addArrays
read / write

Static Methods

addArrays(Float64List a1, Float64List a2, int type) → Float64List
Returns the index-wise sum of a1 and a2 according to type: type = POS: adds the positive or zero values of a1 and a2 only type = NEG: adds the negative or zero values of a1 and a2 only type = POSNEG: normal add of all values Application: Building "projections".
getMax(Float64List array) → List
Finds the maximum value of the numbers in array. array may contain null values, they are skipped. Returns the maximum, its index. If 2 maxima with the same value exist, the 1st one is returned.
getMaxInRange(Float64List arr, int firstIx, int lastIx) → double
Finds the maximum value of the numbers in array in the range from firstIx to lastIx, both indices inclusive. Both indices may have the values null (at the same time), the the entire array is searched. array may contain null values, they are skipped. Returns the maximum, if 2 maxima with the same value exist, the 1st one is returned.
getMaxInRangeStep(Float64List array, int startix, int endix, int incr) → List
Finds the maximum value of the numbers in array in the range from firstIx, inclusive, to endix, exclusive. incr is an index increment. If, e.g., incr==1, only every second array element is considered. array may contain null values, they are skipped. Returns the maximum, its index. If 2 maxima with the same value exist, the 1st one is returned.
getMaxIntPos(List<int> array) → List<int>
Finds the positive-valued maximum value of the numbers in array, assuming that array] contains values >= 0. array may contain null values, they are skipped. Returns the maximum, its index. If 2 maxima with the same value exist, the 1st one is returned.
getMin(Float64List array) → List
Finds the minimum value of the numbers in array. array may contain null values, they are skipped. Returns the minimum, its index. If 2 minima with the same value exist, the 1st one is returned.
getMinInRange(Float64List array, int startix, int endix, int incr) → List
Finds the minimum value of the numbers in array in the range from firstIx, inclusive, to endix, exclusive. incr is an index increment. If, e.g., incr==1, only every second array element is considered. array may contain null values, they are skipped. Returns the minimum, its index. If 2 minima with the same value exist, the 1st one is returned.
getMinMaxVals(Float64List array) → List<double>
Returns a pair of doubles which are the max and min values contained in array, in the following order: min, max or max, min depending on whether min occurs before max in the array, or the other way around.
getMinVal(Float64List array) → double
Returns the minimum value of the numbers in array.
getRow(Float64List array, int row, int nrows) → Float64List
Considers array as a two-dimensional array with nrows rows. The rows, when appended to each other in sequence, are building up array. Returns a new array consisting of the row row whose length will be (array.length / nrows). Returns null if row outside range. Conditions: row >= 0. If array.length cannot be divided by nrows without a remainder, the repective part of array can't be obtained. array will remain unmodified.
isPowerOfTwo(int n) → bool
Returns true if n is a power of 2.
nextPowerOfTwo(int n) → int
Returns a number which: [...]
rotate(Float64List array, int n) → void
Rotates array to the right by n positions in place. For example, with n = 3, the array 1,2,3,4,5,6,7 is rotated to 5,6,7,1,2,3,4.
shuffle(Float64List a1, Float64List a2) → Float64List
Merges the arrays a1 and a2 to a new array "result" with double size. The even indices of "result" will be filled with a1, the odd ones of a2. a1 and a2 must have the same length. See also method unshuffle.
splitArray(Float64List array, int size) → List<Float64List>
Makes a 2D array from array. Each row of the 2D array will have size elements. The last row may be smaller if the length of array can't be divided by size without remainder. If size is 0 or equal or greater than the length of array, the result will contain array as its single row.
swap(Float64List array) → void
Inverts the order of array in place. Reverses the order of array in place. Example: 1,2,3,4,5,6,7,8,9,10 => 10,9,8,7,6,5,4,3,2,1 See also method swapHalf.
swapHalf(Float64List array) → void
Reverses the order of the first half and the second half of array in place. Example: 1,2,3,4,5,6,7,8,9,10 => 5,4,3,2,1,10,9,8,7,6. See also method swap.
swapHalfStr(List<String> array) → void
Inverts the order of the first half and the second half of array in place.
swapStr(List<String> array) → void
Inverts the order of array in place.
unshuffle(Float64List array) → List<Float64List>
Makes 2 arrays "resultArray" (of half length) from array: resultArray0 consists of the even indices of array. resultArray1 consists of the even indices of array. Application: array represents a sequence complex numbers: real, imag, real, imag, ..... Then: resultArray0 is the real part: real, real, ..., resultArray1 is the imaginary part: imag, imag, .... See also method shuffle.
zeroFill(Float64List array, int newLength, bool zeroFillExtend) → Float64List
Zero-fills array as follows and returns the result: [...]