Trait

cogx.api

CogFunctionAPI

Related Doc: package api

Permalink

trait CogFunctionAPI extends SemanticError with ImplicitConversions

Function API for Cog.

Algebraic operators are defined in CogOperatorAPI.

Linear Supertypes
ImplicitConversions, SemanticError, CompilerError, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CogFunctionAPI
  2. ImplicitConversions
  3. SemanticError
  4. CompilerError
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def abs(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the absolute value of every numeric element in field.

    Take the absolute value of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to absoluteValue(x).

  5. def acos(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the arccosine of every numeric element in field.

    Take the arccosine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to acos(x).

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def asin(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the arcsine of every numeric element in field.

    Take the arcsine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to asin(x).

  8. def atan2(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute atan2 of two identically shaped scalar fields.

    Compute atan2 of two identically shaped scalar fields.

    field

    The input field.

    returns

    A scalar field that's the atan2 of the two input fields.

  9. def backProjectFrame(field: compiler.parser.syntaxtree.Field, filter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): compiler.parser.syntaxtree.Field

    Permalink

    Convolve a vector field with a vector-field filter frame.

    Convolve a vector field with a vector-field filter frame.

    field

    The input field.

    filter

    The filter to use for convolution; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field convolved with filter using the supplied border and sampling policies.

  10. def backwardDivergence(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the backward divergence of a 2D vector field.

    Compute the backward divergence of a 2D vector field.

    This is the adjoint operator of forwardGradient.

    field

    The input field.

    returns

    A scalar field representing the backward divergence of an input vector field.

  11. def backwardGradient(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the backward gradient of a 2D scalar or vector field.

    Compute the backward gradient of a 2D scalar or vector field.

    field

    The input field.

    returns

    For a scalar field input, a vector field representing the forward gradient of the input; for a vector input field, an order 4 tensor field representing the forward gradient of the input.

  12. def blockReduceMax(field: compiler.parser.syntaxtree.Field, factor: Int): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a vector field to a shorter (by factor factor) vector field by taking the max() of the first factor input vector elements to form the first output vector element, and so forth.

    Reduce a vector field to a shorter (by factor factor) vector field by taking the max() of the first factor input vector elements to form the first output vector element, and so forth.

    field

    The input field.

    factor

    The factor by which the input field tensor length is reduced.

    returns

    A vector field with each element equal to the max() of factor components of the corresponding vector in the input field.

  13. def blockReduceMin(field: compiler.parser.syntaxtree.Field, factor: Int): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a vector field to a shorter (by factor factor) vector field by taking the min() of the first factor input vector elements to form the first output vector element, and so forth.

    Reduce a vector field to a shorter (by factor factor) vector field by taking the min() of the first factor input vector elements to form the first output vector element, and so forth.

    field

    The input field.

    factor

    The factor by which the input field tensor length is reduced.

    returns

    A vector field with each element equal to the min() of factor components of the corresponding vector in the input field.

  14. def blockReduceSum(field: compiler.parser.syntaxtree.Field, factor: Int): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a vector field to a shorter (by factor factor) vector field by summing the first factor input vector elements to form the first output vector element, and so forth.

    Reduce a vector field to a shorter (by factor factor) vector field by summing the first factor input vector elements to form the first output vector element, and so forth.

    field

    The input field.

    factor

    The factor by which the input field tensor length is reduced.

    returns

    A vector field with each element equal to the sum of factor components of the corresponding vector in the input field.

  15. def centralGradient(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the central gradient of a scalar of vector field.

    Compute the central gradient of a scalar of vector field.

    The central gradient at the point (x, y) is computed using the values at (x - 1, y), (x, y - 1), (x, y + 1), and (x + 1, y + 1)

    field

    The input field.

    returns

    For a scalar field input, returns a vectorField representing the central gradient of the input. For a vector field input, returns an order-4 tensor field representing the central gradient of the input.

  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. def colorField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Create a color field from either a scalar field (with an implicit assumption that the field represents a grayscale image) or a vector field (with the implicit assumption that the vector field represents the (red, green, blue) components of the color image.

    Create a color field from either a scalar field (with an implicit assumption that the field represents a grayscale image) or a vector field (with the implicit assumption that the vector field represents the (red, green, blue) components of the color image.

    field

    The input scalar or vector field.

    returns

    Composed color field.

  18. def colorField(red: compiler.parser.syntaxtree.Field, green: compiler.parser.syntaxtree.Field, blue: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Create a color field from three scalar fields.

    Create a color field from three scalar fields.

    red

    The red component scalar field.

    green

    The green component scalar field.

    blue

    The blue component scalar field.

    returns

    Color field composed of (red, green, blue).

  19. def complex(real: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Create a complex field from a real field.

    Create a complex field from a real field.

    real

    Real input scalar field.

    returns

    Complex version of real, with imaginary part set to zeros.

  20. def complex(real: compiler.parser.syntaxtree.Field, imaginary: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Create a complex field from two scalar fields

    Create a complex field from two scalar fields

    real

    Real part of the created complex field.

    imaginary

    Imaginary part of the created complex field.

    returns

    Complex field composed of the real and imaginary inputs

  21. implicit def complexToCogComplex(c: cogmath.algebra.complex.Complex): CogComplex

    Permalink

    Implicit conversion of a Complex to a CogComplex which allows for fields to be combined with floating point numbers in a simple way.

    Implicit conversion of a Complex to a CogComplex which allows for fields to be combined with floating point numbers in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + Complex

    and

    Complex + Field

    are both legal and compilable with this implicit conversion.

    c

    The Complex to be converted to a CogComplex

    returns

    The CogComplex created from c.

    Definition Classes
    ImplicitConversions
  22. def complexVectorField(fields: Array[compiler.parser.syntaxtree.ComplexField]): compiler.parser.syntaxtree.ComplexVectorField

    Permalink

    Create a complex vector field by stacking complex scalar fields.

    Create a complex vector field by stacking complex scalar fields.

    For example, this can be used to stack N complex fields to a single complex vector field where each vector is of length N.

    fields

    The complex fields to be stacked into a complex vector field.

    returns

    The resulting complex vector field.

  23. def complexVectorField(fields: compiler.parser.syntaxtree.ComplexField*): compiler.parser.syntaxtree.ComplexVectorField

    Permalink

    Create a complex vector field by stacking complex scalar fields.

    Create a complex vector field by stacking complex scalar fields.

    For example, this can be used to stack N complex fields to a single complex vector field where each vector is of length N.

    fields

    The complex fields to be stacked into a complex vector field.

    returns

    The resulting complex vector field.

  24. implicit def complexVectorTo0DComplexVectorField(v: cogmath.algebra.complex.ComplexVector): compiler.parser.syntaxtree.ComplexVectorField

    Permalink

    Implicit conversion of a ComplexVector to a 0D constant ComplexVectorField which allows for fields to be combined with ComplexVectors in a simple way.

    Implicit conversion of a ComplexVector to a 0D constant ComplexVectorField which allows for fields to be combined with ComplexVectors in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + ComplexVector

    and

    ComplexVector + Field

    are both legal and compilable with this implicit conversion.

    v

    The complex vector to be converted to a 0D complex vector field.

    returns

    A 0D complex vector field initialized to v.

    Definition Classes
    ImplicitConversions
  25. def conjugate(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the complex conjugate of each element in a complex field

    Take the complex conjugate of each element in a complex field

    field

    The input field.

    returns

    Conjugate of the input field.

  26. def convolve(field: compiler.parser.syntaxtree.Field, filter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution): compiler.parser.syntaxtree.Field

    Permalink

    Convolve a scalar/vector/matrix field with a filter.

    Convolve a scalar/vector/matrix field with a filter.

    field

    The input field.

    filter

    The filter to use for convolution; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.

    returns

    Input field convolved with filter using the supplied border and sampling policies.

  27. def convolveFilterAdjoint(field: compiler.parser.syntaxtree.Field, filter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): compiler.parser.syntaxtree.Field

    Permalink

    Convolve a vector field with a vector-field with "filter adjoint" plane mixing.

    Convolve a vector field with a vector-field with "filter adjoint" plane mixing.

    field

    The input field.

    filter

    The filter to use for convolution; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field convolved with filter using the supplied border and sampling policies.

  28. def convolveSeparable(field: compiler.parser.syntaxtree.Field, rowFilter: compiler.parser.syntaxtree.Field, columnFilter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy): compiler.parser.syntaxtree.Field

    Permalink

    Convolve a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    Convolve a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    field

    The input field.

    rowFilter

    The filter to use for convolving the rows with odd size in each dimension.

    columnFilter

    The filter to use for convolving the columns with odd size in each dimension.

    borderPolicy

    Policy to use for handling convolution along borders, implicitly helps to determine size of output field.

    returns

    Input field convolved with filters using the supplied border policy.

  29. def copy(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Create a copy of a field.

    Create a copy of a field. This should not be used normally in a user model, but exists as a debugging tool to help identify Cog core issues. The Cog compiler uses this method internally between pipeline stages that have no other computation between them.

    field

    The input field.

    returns

    A copy of the input field.

  30. def cos(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the cosine of every numeric element in field.

    Take the cosine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to cos(x).

  31. def cosh(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the hyperbolic cosine of every numeric element in field.

    Take the hyperbolic cosine of every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to cosh(x).

  32. def crossCorrelate(field: compiler.parser.syntaxtree.Field, filter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution): compiler.parser.syntaxtree.Field

    Permalink

    Cross-correlate a scalar/vector/matrix field with a filter.

    Cross-correlate a scalar/vector/matrix field with a filter.

    field

    The input field.

    filter

    The filter to use for cross-correlation; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.

    returns

    Input field cross-correlated with filter using the supplied border and sampling policies.

  33. def crossCorrelateFilterAdjoint(field: compiler.parser.syntaxtree.Field, filter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): compiler.parser.syntaxtree.Field

    Permalink

    Cross-correlate a vector field with a vector-field with "filter adjoint" plane mixing.

    Cross-correlate a vector field with a vector-field with "filter adjoint" plane mixing.

    field

    The input field.

    filter

    The filter to use for cross-correlation; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field cross-correlated with filter using the supplied border and sampling policies.

  34. def crossCorrelateSeparable(field: compiler.parser.syntaxtree.Field, rowFilter: compiler.parser.syntaxtree.Field, columnFilter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy): compiler.parser.syntaxtree.Field

    Permalink

    Cross-correlate a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    Cross-correlate a scalar/vector/matrix field with a row filter and a column filter (separable convolution).

    field

    The input field.

    rowFilter

    The filter to use for cross-correlating the rows with odd size in each dimension.

    columnFilter

    The filter to use for cross-correlating the columns with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    returns

    Input field cross-correlated with filters using the supplied border policy.

  35. def crossDot(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Multiply a 2D matrix field, field, by a 2D scalar field, f2, to produce a 2D scalar field.

    Multiply a 2D matrix field, field, by a 2D scalar field, f2, to produce a 2D scalar field.

    The scalar field f2 must have the same shape as the matrices in field. This operator is basically pretending that the f2 scalar field is really a matrix and simply dotting that matrix with every matrix in the matrix field field, producing a scalar in the corresponding position of the result scalar field.

    field

    The input field.

    f2

    Scalar field to multiply with field.

    returns

    "cross dot" product of field and f2.

  36. def dct(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Takes the DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    Takes the DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed: Field =
    val restored = transformed.dctInverse
    // restored is approximately equal to field

    For a somewhat faster version, see dctTransposed.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

  37. def dctInverse(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed = field.dct
    val restored = transformed.dctInverse
    // restored is approximately equal to field

    For a somewhat faster version, see dctInverseTransposed.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

  38. def dctInverseTransposed(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    Takes the inverse DCT (discrete cosine transform) of a 2D field, producing a field with the same shape as the input.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed = field.dctTransposed
    val restored = transformed.dctInverseTransposed
    // restored is approximately equal to field

    This is a somewhat faster version of dctInverse where the transpose is not important to (or can be compensated within) an application.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

  39. def dctTransposed(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Takes the DCT (discrete cosine transform) of a 2D field and transposes it, producing a field with the same shape as the input transposed.

    Takes the DCT (discrete cosine transform) of a 2D field and transposes it, producing a field with the same shape as the input transposed.

    The following sequence will return the original input, within the bounds of computational error:

    val field
    val transformed = field.dctTransposed
    val restored = transformed.dctInverseTransposed
    // restored is approximately equal to field

    This is a somewhat faster version of dct where the transpose is not important to (or can be compensated within) an application.

    The DCT has several requirements:

    The number of rows and columns must each be a power of 2.

    Rows and columns are restricted to the range [256, 2048]

    field

    The input field.

    returns

    The DCT of the input.

  40. def dot(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Takes the inner product of two identically shaped tensor fields to create a scalar field.

    Takes the inner product of two identically shaped tensor fields to create a scalar field.

    The tensors in both fields must have the same shape. Dotting two tensors involves multiplying corresponding elements in the two tensors and summing the products.

    field

    The input field.

    f2

    Other field to "dot" with field field.

    returns

    Scalar field where each scalar element is computed from the dot product of the tensors in the corresponding location of the two input tensor fields.

  41. def downsample(field: compiler.parser.syntaxtree.Field, factor: Int = 2, phase: Int = 0): compiler.parser.syntaxtree.Field

    Permalink

    Downsample a field by taking every nth element.

    Downsample a field by taking every nth element.

    Example: for input field {1,2,3,4}

    input.downsample(2) yields {1,3}
    
    input.downsample(2,1) yields {2,4}

    Further examples of downsampling on a 2-dimensional input:

    field

    The input field.

    factor

    The sampling factor, defaults to 2.

    phase

    The offset within the scaled up field to put the input data, defaults to an offset of 0.

  42. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  43. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  44. def exp(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the exponential function to every numeric element in field.

    Apply the exponential function to every numeric element in field. This works for complex and real fields.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to exp(x).

  45. def expand(field: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, sizes: Int*): compiler.parser.syntaxtree.Field

    Permalink

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin.

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin. The supported border policies are BorderZero, BorderClamp and BorderCyclic.

    See expand(borderPolicy, shape) for a description of the border policies.

    field

    The input field.

    borderPolicy

    Policy to use for producing border values.

    sizes

    The integer dimensions of the expanded output field.

    returns

    Expanded field with new elements filled in from the nearest input edge per borderPolicy.

  46. def expand(field: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, shape: cogmath.geometry.Shape): compiler.parser.syntaxtree.Field

    Permalink

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin.

    Expand an N-dimensional field by padding it with values per the border policy, maintaining the origin. The supported border policies are BorderZero, BorderClamp and BorderCyclic.

    With the BorderZero policy, the border values are all 0.

    Border Zero Example. A 3 x 4 input field:

    1  2  3  4
    5 -1 -1  6
    7  8  9  0

    If we expand this to 7 x 8, we fill the new elements with zeroes:

    1  2  3  4  0  0  0  0
    5 -1 -1  6  0  0  0  0
    7  8  9  0  0  0  0  0
    0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0

    With the BorderClamp policy, the border is extended outwards into the expanded output field, wrapping around as though the output field were a torus. This is useful when doing convolution with the FFT and one wishes to minimize border effects by "border clamping".

    BorderClamp Example. A 3 x 4 input field:

    1  2  3  4
    5 -1 -1  6
    7  8  9  0

    If we expand this to 7 x 8, we extend the borders, wrapping around as though the output field were a torus:

    1  2  3  4  4  4  1  1
    5 -1 -1  6  6  6  5  5
    7  8  9  0  0  0  7  7
    7  8  9  0  0  0  0  0
    7  8  9  0  0  0  0  0
    1  2  3  4  0  0  0  0
    1  2  3  4  0  0  0  0

    With the BorderCyclic policy, the border values emulate a cyclic "wrap-around" in the original field, as though the input field were a torus. This is useful when doing cyclic convolution with the FFT and one wishes expand the field to make it a power of 2 (necessary for the FFT) while still preserving cyclic convolution

    BorderCyclic Example. A 3 x 4 input field:

    1  2  3  4
    5 -1 -1  6
    7  8  9  0

    If we expand this to 7 x 8, we extend the borders, wrapping around as though the input field were a torus:

    1  2  3  4  1  2  3  4
    5 -1 -1  6  5 -1 -1  6
    7  8  9  0  7  8  9  0
    1  2  3  4  1  2  3  4
    5 -1 -1  6  5 -1 -1  6
    5 -1 -1  6  5 -1 -1  6
    7  8  9  0  7  8  9  0
    field

    The input field.

    borderPolicy

    Policy to use for producing border values.

    shape

    The shape of the expanded output field.

    returns

    Expanded field with new elements filled in from the nearest input edge per borderPolicy.

  47. def fft(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the FFT of a complex field.

    Compute the FFT of a complex field.

    field

    The input field.

    returns

    FFT of the input field.

  48. def fftColumns(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the FFT of the columns only in a 2D complex field.

    Compute the FFT of the columns only in a 2D complex field.

    field

    The input field.

    returns

    Input with each columns transformed by the FFT.

  49. def fftInverse(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the inverse FFT of a complex field (includes scaling).

    Compute the inverse FFT of a complex field (includes scaling).

    field

    The input field.

    returns

    Inverse FFT of the input field.

  50. def fftInverseColumns(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the inverseFFT of the columns only in a 2D complex field.

    Compute the inverseFFT of the columns only in a 2D complex field.

    field

    The input field.

    returns

    Input with each columns transformed by the inverse FFT.

  51. def fftInverseRI(real: compiler.parser.syntaxtree.Field, imaginary: compiler.parser.syntaxtree.Field): (compiler.parser.syntaxtree.Field, compiler.parser.syntaxtree.Field)

    Permalink

    Compute the inverse FFT of a complex field represented as separate real and imaginary fields (includes scaling).

    Compute the inverse FFT of a complex field represented as separate real and imaginary fields (includes scaling).

    real

    The real component of the complex field input.

    imaginary

    The imaginary component of the complex field input.

    returns

    Inverse FFT of the input field, returned as a Tuple2 of the real and imaginary part fields.

  52. def fftInverseRows(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the inverse FFT of the rows only in a 2D complex field.

    Compute the inverse FFT of the rows only in a 2D complex field.

    field

    The input field.

    returns

    Input with each row transformed by the inverse FFT.

  53. def fftRI(real: compiler.parser.syntaxtree.Field): (compiler.parser.syntaxtree.Field, compiler.parser.syntaxtree.Field)

    Permalink

    Compute the FFT of a real field.

    Compute the FFT of a real field.

    real

    The real component of the input whose imaginary component is 0.

    returns

    FFT of the input, returned as a Tuple2 of the real and imaginary part fields.

  54. def fftRI(real: compiler.parser.syntaxtree.Field, imaginary: compiler.parser.syntaxtree.Field): (compiler.parser.syntaxtree.Field, compiler.parser.syntaxtree.Field)

    Permalink

    Compute the FFT of a complex field that is input as two separate real and imaginary fields.

    Compute the FFT of a complex field that is input as two separate real and imaginary fields.

    real

    The real component of the complex field input.

    imaginary

    The imaginary component of the complex field input.

    returns

    FFT of the input, returned as a Tuple2 of the real and imaginary part fields.

  55. def fftRows(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the FFT of the rows only in a 2D complex field.

    Compute the FFT of the rows only in a 2D complex field.

    field

    The input field.

    returns

    Input with each row transformed by the FFT.

  56. implicit def fieldArrayToMatrixFieldArray(a: Array[compiler.parser.syntaxtree.Field]): Array[compiler.parser.syntaxtree.MatrixField]

    Permalink

    Implicit conversion of an array of Fields to an array of ScalarFields.

    Implicit conversion of an array of Fields to an array of ScalarFields.

    a

    An array of Fields.

    returns

    An array of MatrixFields.

    Definition Classes
    ImplicitConversions
  57. implicit def fieldArrayToScalarFieldArray(a: Array[compiler.parser.syntaxtree.Field]): Array[compiler.parser.syntaxtree.ScalarField]

    Permalink

    Implicit conversion of an array of Fields to an array of ScalarFields.

    Implicit conversion of an array of Fields to an array of ScalarFields.

    a

    An array of Fields.

    returns

    An array of ScalarFields.

    Definition Classes
    ImplicitConversions
  58. implicit def fieldArrayToVectorFieldArray(a: Array[compiler.parser.syntaxtree.Field]): Array[compiler.parser.syntaxtree.VectorField]

    Permalink

    Implicit conversion of an array of Fields to an array of ScalarFields.

    Implicit conversion of an array of Fields to an array of ScalarFields.

    a

    An array of Fields.

    returns

    An array of VectorFields.

    Definition Classes
    ImplicitConversions
  59. def fieldReduceMax(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a scalar field to a 0D scalar containing a single element which is the maximum element in the input field.

    Reduce a scalar field to a 0D scalar containing a single element which is the maximum element in the input field.

    field

    The input field.

    returns

    0D scalar field holding the max value in input field.

  60. def fieldReduceMedian(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Find the median value in a scalar field.

    Find the median value in a scalar field.

    field

    The input field.

    returns

    0D scalar field holding the median value of the input field.

  61. def fieldReduceMin(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a scalar field to a 0D scalar containing a single element which is the minimum element in the input field.

    Reduce a scalar field to a 0D scalar containing a single element which is the minimum element in the input field.

    field

    The input field.

    returns

    0D scalar field holding the min value in input field.

  62. def fieldReduceSum(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a scalar field to a 0D scalar containing the sum of all the elements in the input field.

    Reduce a scalar field to a 0D scalar containing the sum of all the elements in the input field.

    field

    The input field.

    returns

    0D scalar field holding the sum of values in input field.

  63. implicit def fieldToColorField(f: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ColorField

    Permalink

    Implicit conversion of a Field to a ColorField.

    Implicit conversion of a Field to a ColorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ColorField but stored in a Field variable. This method also supports converting a ScalarField or VectorField to a ColorField.

    f

    A field which needs coercion to the ColorField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  64. implicit def fieldToComplexField(f: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ComplexField

    Permalink

    Implicit conversion of a Field to a ComplexField.

    Implicit conversion of a Field to a ComplexField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexField but stored in a Field variable. This method also supports converting a ScalarField to a ComplexField.

    f

    A field which needs coercion to the ComplexField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  65. implicit def fieldToComplexVectorField(f: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ComplexVectorField

    Permalink

    Implicit conversion of a Field to a ComplexField.

    Implicit conversion of a Field to a ComplexField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexField but stored in a Field variable. This method also supports converting a ScalarField to a ComplexField.

    f

    A field which needs coercion to the ComplexVectorField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  66. implicit def fieldToMatrixField(f: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.MatrixField

    Permalink

    Implicit conversion of a Field to a MatrixField.

    Implicit conversion of a Field to a MatrixField. Since Field is abstract, the only possible conversion is if the field is already a MatrixField but is stored in a Field variable. This merely does the necessary type coercion.

    f

    A field which needs coercion to the MatrixField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  67. implicit def fieldToScalarField(f: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ScalarField

    Permalink

    Implicit conversion of a Field to a ScalarField.

    Implicit conversion of a Field to a ScalarField. Since Field is abstract, the only possible conversion is if the field is already a ScalarField but is stored in a Field variable. This merely does the necessary type coercion.

    f

    A field which needs coercion to the ScalarField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  68. implicit def fieldToVectorField(f: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.VectorField

    Permalink

    Implicit conversion of a Field to a VectorField.

    Implicit conversion of a Field to a VectorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a VectorField but stored in a Field variable. This method also supports converting a ColorField to a VectorField.

    f

    A field which needs coercion to the VectorField type.

    returns

    The converted field.

    Definition Classes
    ImplicitConversions
  69. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  70. def flip(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Flip a field along every dimension.

    Flip a field along every dimension.

    Example. This 2D scalar field:

    1  2  3
    4  5  6
    7  8  9

    looks like this when flipped:

    9  8  7
    6  5  4
    3  2  1
    field

    The input field.

    returns

    A flipped version of the input field.

  71. implicit def floatToCogFloat(f: Float): CogFloat

    Permalink

    Implicit conversion of a Float to a CogFloat which allows for fields to be combined with floating point numbers in a simple way.

    Implicit conversion of a Float to a CogFloat which allows for fields to be combined with floating point numbers in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + Float

    and

    Float + Field

    are both legal and compilable with this implicit conversion.

    f

    The Float to be converted to a CogFloat

    returns

    The CogFloat created from f.

    Definition Classes
    ImplicitConversions
  72. def floor(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Map each numeric element of the input field to the largest integer which is less than or equal to that element.

    Map each numeric element of the input field to the largest integer which is less than or equal to that element.

    field

    The input field.

    returns

    Field where every number element has been "floored" to an integer.

  73. def forwardGradient(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the forward gradient of a 2D scalar or vector field.

    Compute the forward gradient of a 2D scalar or vector field.

    This is the adjoint operator of backwardDivergence.

    field

    The input field.

    returns

    For a scalar field input, a vector field representing the forward gradient of the input; for a vector input field, an order 4 tensor field representing the forward gradient of the input.

  74. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  75. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  76. def imaginaryPart(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Extract the imaginary part of a complex field as a scalar field.

    Extract the imaginary part of a complex field as a scalar field.

    field

    The input field.

    returns

    A scalar field with the same shape as the input, with each element equal to the imaginary part of the corresponding complex element in the input.

  77. def internalError(message: String): Unit

    Permalink

    Declare an internal error described by message.

    Declare an internal error described by message.

    Definition Classes
    CompilerError
  78. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  79. def log(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the natural logarithm to every numeric element in field.

    Apply the natural logarithm to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to log(x).

  80. def magnitude(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the magnitude of each element in a complex field

    Take the magnitude of each element in a complex field

    field

    The input field.

    returns

    Magnitude of the input field.

  81. def matrixField(fields: Array[Array[compiler.parser.syntaxtree.Field]]): compiler.parser.syntaxtree.MatrixField

    Permalink

    Create a matrix field from a 2D array of scalar fields.

    Create a matrix field from a 2D array of scalar fields.

    For example, this can be used to stack N x K scalar fields to a single matrix field. Each matrix in the result will be N x K.

    fields

    The scalar fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

  82. def matrixField(fields: Array[Array[compiler.parser.syntaxtree.ScalarField]]): compiler.parser.syntaxtree.MatrixField

    Permalink

    Create a matrix field from a 2D array of scalar fields.

    Create a matrix field from a 2D array of scalar fields.

    For example, this can be used to stack N x K scalar fields to a single matrix field. Each matrix in the result will be N x K.

    fields

    The scalar fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

  83. def matrixField(fields: Array[compiler.parser.syntaxtree.VectorField]): compiler.parser.syntaxtree.MatrixField

    Permalink

    Create a matrix field from vector fields by "stacking" the vector fields.

    Create a matrix field from vector fields by "stacking" the vector fields.

    For example, this can be used to stack N vector fields to a single matrix field. If the length of the vectors in the vector fields is K, then each matrix in the result will be N x K.

    fields

    The vector fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

  84. def matrixField(fields: compiler.parser.syntaxtree.VectorField*): compiler.parser.syntaxtree.MatrixField

    Permalink

    Create a matrix field from vector fields by "stacking" the vector fields.

    Create a matrix field from vector fields by "stacking" the vector fields.

    For example, this can be used to stack N vector fields to a single matrix field. If the length of the vectors in the vector fields is K, then each matrix in the result will be N x K.

    fields

    The vector fields to be stacked into a matrix field.

    returns

    The resulting matrix field.

  85. def matrixRow(field: compiler.parser.syntaxtree.Field, index: Int): compiler.parser.syntaxtree.Field

    Permalink

    Convert a matrix field to a vector field by stripping out one row from each matrix in the field and making it a vector.

    Convert a matrix field to a vector field by stripping out one row from each matrix in the field and making it a vector.

    field

    The input field.

    index

    The index of the desired row to strip out of each matrix and use as a vector.

    returns

    A vector field made up of the stripped out vectors from the input matrix field.

  86. def max(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Select the maximum value of corresponding elements in two scalar fields.

    Select the maximum value of corresponding elements in two scalar fields.

    field

    The input field.

    f2

    Second scalar field to compare with field.

    returns

    Scalar field where each element is the largest corresponding elements in field or f2.

  87. def max(field: compiler.parser.syntaxtree.Field, value: Float): compiler.parser.syntaxtree.Field

    Permalink

    For every element, x, in field, compute max(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result.

    For every element, x, in field, compute max(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result. The resulting field has the same field shape and tensor shape as filed.

    field

    The input field.

    value

    Operand for max operator.

    returns

    A field equal to field with each element, x, mapped to max(x, that).

  88. def min(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Select the minimum value of corresponding elements in two scalar fields.

    Select the minimum value of corresponding elements in two scalar fields.

    field

    The input field.

    f2

    Second scalar field to compare with field.

    returns

    Scalar field where each element is the smallest corresponding elements in field or f2.

  89. def min(field: compiler.parser.syntaxtree.Field, value: Float): compiler.parser.syntaxtree.Field

    Permalink

    For every element, x, in field, compute min(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result.

    For every element, x, in field, compute min(x, that) where 1.0f represents a "true" result and 0.0f represents a "false" result. The resulting field has the same field shape and tensor shape as field.

    field

    The input field.

    value

    Operand for min operator.

    returns

    A field equal to field with each element, x, mapped to min(x, that).

  90. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  91. def normalizeL1(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Normalize a scalar field using the L1 norm.

    Normalize a scalar field using the L1 norm.

    field

    The input field.

    returns

    A normalized copy of the input field.

  92. def normalizeL2(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Normalize a scalar field using the L2 norm.

    Normalize a scalar field using the L2 norm.

    field

    The input field.

    returns

    A normalized copy of the input field.

  93. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  94. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  95. def phase(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Take the phase of each element in a complex field.

    Take the phase of each element in a complex field.

    This is also commonly called arg. This is a number in the range (-Pi, Pi]

    field

    The input field.

    returns

    Phase of the input field.

  96. def polarComplex(magnitude: compiler.parser.syntaxtree.Field, phase: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Create a complex field from polar coordinates.

    Create a complex field from polar coordinates.

    magnitude

    Scalar field where each scalar is the magnitude of the desired complex field.

    phase

    Scalar field where each scalar is the phase of the desired complex field.

    returns

    Complex field built from magnitude and phase.

  97. def pow(field: compiler.parser.syntaxtree.Field, that: Float): compiler.parser.syntaxtree.Field

    Permalink

    Raise each number in field to the power that.

    Raise each number in field to the power that. The resulting field has the same field shape and tensor shape as field.

    field

    The input field.

    that

    The exponent.

    returns

    Input field with every number raised to the power that.

  98. def pow(field: compiler.parser.syntaxtree.Field, that: Int): compiler.parser.syntaxtree.Field

    Permalink

    Raise each number in field to the power that.

    Raise each number in field to the power that. The resulting field has the same field shape and tensor shape as field.

    field

    The input field.

    that

    The exponent.

    returns

    Input field with every number raised to the power that.

  99. def probe(fields: compiler.parser.syntaxtree.Field*): Unit

    Permalink

    User mechanism for marking multiple fields as "probed"

    User mechanism for marking multiple fields as "probed"

    If a field is visible to reflection, it will be automatically named.

    fields

    The fields to be probed.

  100. def probe(field: compiler.parser.syntaxtree.Field, userName: String = null): compiler.parser.syntaxtree.Field

    Permalink

    User mechanism for marking a field as "probed," optionally supplying a name for the field.

    User mechanism for marking a field as "probed," optionally supplying a name for the field.

    If a field is visible to reflection, it will be automatically named. In that case supplying a userName is unnecessary and not recommended.

    field

    The field to be probed.

    userName

    User's name for the field. If not supplied, the field is probed but uses system-inferred naming for the field.

    returns

    The field being probed.

  101. def projectFrame(field: compiler.parser.syntaxtree.Field, filter: compiler.parser.syntaxtree.Field, borderPolicy: platform.types.BorderPolicy, samplingPolicy: platform.types.ConvolutionSamplingPolicy = NoSamplingConvolution, batchSize: Int = 1): compiler.parser.syntaxtree.Field

    Permalink

    Cross-correlate a vector field with a vector-field filter frame.

    Cross-correlate a vector field with a vector-field filter frame.

    field

    The input field.

    filter

    The filter to use for cross-correlation; must be square and with odd size in each dimension.

    borderPolicy

    Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.

    samplingPolicy

    Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.

    batchSize

    The number of logical (possibly multi-plane) images present in the input field.

    returns

    Input field cross-correlated with filter using the supplied border and sampling policies.

  102. def random(field: compiler.parser.syntaxtree.Field, bits: Int): compiler.parser.syntaxtree.Field

    Permalink

    Compute a random field based on this input field using cellular automaton based RNG.

    Compute a random field based on this input field using cellular automaton based RNG. The output ranges from [0 to 1] (inclusive) and is uniformly distributed.

    field

    The input field.

    bits

    The number of bits of precision to use

    returns

    A Vector field where each point in the field is random

  103. def realPart(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Extract the real part of a complex field as a scalar field.

    Extract the real part of a complex field as a scalar field.

    field

    The input field.

    returns

    A scalar field with the same shape as the input, with each element equal to the real part of the corresponding complex element in the input.

  104. def reciprocal(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Perform 1/x operation on every numeric element of a field.

    Perform 1/x operation on every numeric element of a field.

    Somewhat dangerous to use if any element in the field could be zero, since the resulting element would be NaN which does not throw an exception.

    field

    The input field.

    returns

    Input field with each numeric element, x, mapped to 1/x.

  105. def reduceMax(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a vector field to a scalar field by mapping each vector to the maximum of its components.

    Reduce a vector field to a scalar field by mapping each vector to the maximum of its components.

    field

    The input field.

    returns

    A scalar field with each element equal to the maximum of the components of the corresponding vector in the input field.

  106. def reduceMin(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a vector field to a scalar field by mapping each vector to the minimum of its components.

    Reduce a vector field to a scalar field by mapping each vector to the minimum of its components.

    field

    The input field.

    returns

    A scalar field with each element equal to the minimum of the components of the corresponding vector in the input field.

  107. def reduceSum(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Reduce a vector field to a scalar field by mapping each vector to the sum of its components.

    Reduce a vector field to a scalar field by mapping each vector to the sum of its components.

    field

    The input field.

    returns

    A scalar field with each element equal to the sum of components of the corresponding vector in the input field.

  108. def replicate(field: compiler.parser.syntaxtree.Field, shape: cogmath.geometry.Shape): compiler.parser.syntaxtree.Field

    Permalink

    Replicate a scalar field as matrices in a matrix field (each matrix in the matrix field is identical to the input scalar field).

    Replicate a scalar field as matrices in a matrix field (each matrix in the matrix field is identical to the input scalar field).

    field

    The input field.

    shape

    The shape of the resulting output field.

    returns

    A matrix field with the same field shape as f2 and tensor shape the same as the input scalar field.

  109. def reshape(field: compiler.parser.syntaxtree.Field, fieldShape: cogmath.geometry.Shape, tensorShape: cogmath.geometry.Shape, checkLegacyReshape: Boolean = Cog.checkLegacyReshape): compiler.parser.syntaxtree.Field

    Permalink

    Change the shape of a scalar field without changing the number of elements in it.

    Change the shape of a scalar field without changing the number of elements in it.

    This depends on the row-major ordering we use for elements in a field. Elements in any scalar field, regardless of dimension, have that linear ordering. Reshaping preserves that ordering; it really does nothing more than change the sizes of each dimension of the field.

    field

    The input field.

    fieldShape

    the output field shape to use

    tensorShape

    the output tensor shape to use

    checkLegacyReshape

    Warn of uses of reshape that had different behaviors prior to libcog 4.3

    returns

    The input field, reshaped, with the same elements in the same linear order.

  110. def reshape(field: compiler.parser.syntaxtree.Field, size: Int*): compiler.parser.syntaxtree.Field

    Permalink

    Change the shape of a scalar field without changing the number of elements in it.

    Change the shape of a scalar field without changing the number of elements in it.

    This depends on the row-major ordering we use for elements in a field. Elements in any scalar field, regardless of dimension, have that linear ordering. Reshaping preserves that ordering; it really does nothing more than change the sizes of each dimension of the field.

    field

    The input field.

    size

    A sequence of new sizes for each dimensions. The product of this sequence must equal the number of elements in the input field.

    returns

    The input field, reshaped, with the same elements in the same linear order.

  111. def reverseCrossDot(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Multiply a matrix field, field, by a scalar field, f2, to produce a scalar field.

    Multiply a matrix field, field, by a scalar field, f2, to produce a scalar field.

    The matrix field and scalar field operands must have identical field shapes. Each scalar element of the scalar field is multiplied by the corresponding element in the matrix field. These products are then summed to produce the scalar field result (which has the same shape as the matrices in the matrix field).

    field

    The input field.

    f2

    Scalar field operand which have the same field shape as field.

    returns

    Product of field and f2.

  112. def select[T <: compiler.parser.syntaxtree.Field](fields: Array[T], index: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Dynamically select a scalar field from an array of scalar fields.

    Dynamically select a scalar field from an array of scalar fields.

    Example:

    val fields: Array[ScalarFieldExpr] = ...
    val index: ScalarFieldExpr
    val selected: ScalarFieldExpr = select(fields, index)
    index

    0-dimensional scalar field supplying the index for the array to be read.

    returns

    If index is in-bounds for the array, returns the selected field from that array; if index is out-of-bounds, returns a field of NaNs.

  113. def shift(field: compiler.parser.syntaxtree.Field, rowShift: Int, colShift: Int): compiler.parser.syntaxtree.Field

    Permalink

    Shift a 2D scalar field in both dimensions, pulling in zeroes where necessary.

    Shift a 2D scalar field in both dimensions, pulling in zeroes where necessary. Negative shift amounts result in shifts up and to the left, while positive shift amounts result in shifts down and to the right.

    field

    The input field.

    rowShift

    Number of pixels to shift field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

  114. def shift(field: compiler.parser.syntaxtree.Field, colShift: Int): compiler.parser.syntaxtree.Field

    Permalink

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in zeroes where necessary.

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in zeroes where necessary.

    field

    The input field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

  115. def shiftCyclic(field: compiler.parser.syntaxtree.Field, rowShift: Int, colShift: Int): compiler.parser.syntaxtree.Field

    Permalink

    Shift a 2D scalar field in both dimensions, pulling in values from the opposite side where necessary.

    Shift a 2D scalar field in both dimensions, pulling in values from the opposite side where necessary. Negative shift amounts result in shifts up and to the left, while positive shift amounts result in shifts down and to the right.

    field

    The input field.

    rowShift

    Number of pixels to shift field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

  116. def shiftCyclic(field: compiler.parser.syntaxtree.Field, colShift: Int): compiler.parser.syntaxtree.Field

    Permalink

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in values from the opposite side where necessary.

    Shift a 1D scalar field left (negative colShift) or right (positive colShift), pulling in values from the opposite side where necessary.

    field

    The input field.

    colShift

    Number of pixels to shift field.

    returns

    Shifted input field.

  117. def signum(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the signum operator to every numeric element in field.

    Apply the signum operator to every numeric element in field.

    Signum(x) is defined to be:

    1 if x > 0

    0 if x: Field =

    -1 if x < 0

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to signum(x).

  118. def sin(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the sine operator to every numeric element in field.

    Apply the sine operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to sin(x).

  119. def sinh(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the hyperbolic sine operator to every numeric element in field.

    Apply the hyperbolic sine operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to sinh(x).

  120. def solve(field: compiler.parser.syntaxtree.Field, b: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Solve Ax - b

    Solve Ax - b

    This actually solves the equation for each matrix / vector pair in the fields field and b, producing a vector field representing x. The vectors in b must be length 2 and the matrices in field must be 2 x 2. Solves the equations using the pseudo inverse

    field

    The input field.

    b

    Vector field argument.

    returns

    The solution, x, to the set of linear equations.

  121. def sq(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the square operator to every numeric element in field.

    Apply the square operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to (x * x).

  122. def sqrt(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the square root operator to every numeric element in field.

    Apply the square root operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to sqrt(x).

  123. def stack[T <: compiler.parser.syntaxtree.Field](fields: Array[T]): compiler.parser.syntaxtree.Field

    Permalink

    Stack tensor fields to create a higher-order tensor field.

    Stack tensor fields to create a higher-order tensor field.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The fields to be stacked.

    returns

    The resulting, higher-order tensor field.

  124. def stack(fields: compiler.parser.syntaxtree.Field*): compiler.parser.syntaxtree.Field

    Permalink

    Stack tensor fields to create a higher-order tensor field.

    Stack tensor fields to create a higher-order tensor field.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The fields to be stacked.

    returns

    The resulting, higher-order tensor field.

  125. def subfield(field: compiler.parser.syntaxtree.Field, guide: compiler.parser.syntaxtree.Field, shape: cogmath.geometry.Shape, border: platform.types.BorderPolicy = BorderClamp): compiler.parser.syntaxtree.Field

    Permalink

    Extracts a window from a 1D or 2D scalar, vector or matrix field, guided by a 0D vector field called "the guide." The guide specifies the upper-left-most (or left-most for 1D fields) point of the window, and shape specifies the size of the window.

    Extracts a window from a 1D or 2D scalar, vector or matrix field, guided by a 0D vector field called "the guide." The guide specifies the upper-left-most (or left-most for 1D fields) point of the window, and shape specifies the size of the window.

    A guiding vector with value (v1, v2) means a given point (row, col) extracts the element at location (row + v1, col + v2) as its output. If that location falls outside of the field, the BorderPolicy attached to the the opcode determines how the missing value is computed. If either of the guide vector components v1 and v2 is non-integral, bilinear interpolation is used to to determine the approximate value.

    field

    The input field.

    guide

    The guide vector.

    shape

    Shape of the window.

    border

    Policy for handling border processing.

    returns

    Extracted window.

  126. def subfields(field: compiler.parser.syntaxtree.Field, diameter: Int): compiler.parser.syntaxtree.Field

    Permalink

    Extract all subfields from a 2D scalar field into a 2-D vector field.

    Extract all subfields from a 2D scalar field into a 2-D vector field.

    field

    The input field.

    diameter

    Sizes (rows and columns) of each subfield. Must be odd.

    returns

    A 2-D vector field where the length of the vector equals the number of diameter x diameter subfields in the input. For example, a 4 x 4 input field has four subfields of size 3 x 3, so this operator would return a 2-D vector field of size 3 x 3 (the size of the subfields) with vectors of length 4. Each layer of the vector field is one subfield of of the input.

  127. def supersample(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Supersample a scalar field by 2X in each dimension, replicating pixels to fill in the gaps.

    Supersample a scalar field by 2X in each dimension, replicating pixels to fill in the gaps.

    field

    The input field.

    returns

    Input field expanded by 2X in each dimension with pixel replication.

  128. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  129. def tan(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the tangent operator to every numeric element in field.

    Apply the tangent operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to tan(x).

  130. def tanh(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Apply the hyperbolic tangent operator to every numeric element in field.

    Apply the hyperbolic tangent operator to every numeric element in field.

    field

    The input field.

    returns

    Field equal to input field with each element, x, mapped to tanh(x).

  131. def toColorField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ColorField

    Permalink

    Explicit conversion of a Field to a ColorField.

    Explicit conversion of a Field to a ColorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ColorField but stored in a Field variable. This method also supports converting a ScalarField or VectorField to a ColorField.

    field

    The input field.

    returns

    The converted field.

  132. def toComplexField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ComplexField

    Permalink

    Explicit conversion of a Field to a ComplexField.

    Explicit conversion of a Field to a ComplexField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexField but stored in a Field variable. This method also supports converting a ScalarField to a ComplexField.

    field

    The input field.

    returns

    The converted field.

  133. def toComplexVectorField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ComplexVectorField

    Permalink

    Explicit conversion of a Field to a ComplexVectorField.

    Explicit conversion of a Field to a ComplexVectorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a ComplexVectorField but stored in a Field variable. This method also supports converting a VectorField to a ComplexVectorField.

    field

    The input field.

    returns

    The converted field.

  134. def toGenericComplexField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Another explicit conversion, this time working on both ScalarFields and VectorFields.

    Another explicit conversion, this time working on both ScalarFields and VectorFields. The return type is Field though, the common base class of both ComplexFields and ComplexScalarFields.

    field

    The input field.

  135. def toMatrixField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.MatrixField

    Permalink

    Explicit conversion of a Field to a MatrixField.

    Explicit conversion of a Field to a MatrixField. Since Field is abstract, the only possible conversion is if the field is already a MatrixField but is stored in a Field variable. This merely does the necessary type coercion.

    field

    The input field.

    returns

    The converted field.

  136. def toScalarField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.ScalarField

    Permalink

    Explicit conversion of a Field to a ScalarField.

    Explicit conversion of a Field to a ScalarField. Since Field is abstract, the only possible conversion is if the field is already a ScalarField but is stored in a Field variable. This merely does the necessary type coercion.

    field

    The input field.

    returns

    The converted field.

  137. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  138. def toVectorField(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.VectorField

    Permalink

    Explicit conversion of a Field to a VectorField.

    Explicit conversion of a Field to a VectorField. Field is abstract, so this method will perform the appropriate type coercion if the field is already a VectorField but stored in a Field variable. This method also supports converting a ColorField to a VectorField.

    field

    The input field.

    returns

    The converted field.

  139. def transform(field: compiler.parser.syntaxtree.Field, f2: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    (1) Multiply a matrix field by a matrix field to produce a matrix field; or (2) multiply a matrix field by a vector field to produce a vector field.

    (1) Multiply a matrix field by a matrix field to produce a matrix field; or (2) multiply a matrix field by a vector field to produce a vector field.

    For case (1), corresponding matrices in field and f2 are multiplied using standard matrix multiplication to produce the corresponding matrix in the resulting matrix field.

    For case (2), corresponding matrix/vector pari in field and f2 are multiplied using standard matrix/vector multiplication to produce the corresponding vector (a linear transformation of the input vector) in the resulting vector field.

    field

    The input field.

    f2

    Matrix field or vector field; must have the same field shape as field.

    returns

    Matrix field or vector representing the matrix multiplications of corresponding elements in the two input fields.

  140. def transpose(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Transpose a 2D tensor field or color field.

    Transpose a 2D tensor field or color field.

    field

    The input field.

  141. def transposeMatrices(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Transpose all the matrices in a matrix field to produce a new matrix field.

    Transpose all the matrices in a matrix field to produce a new matrix field.

    field

    The input field.

    returns

    Copy of input matrix field with all matrices transposed.

  142. def transposeVectors(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Transpose each vector in a vector field to a single row matrix, thus creating a matrix field from a vector field

    Transpose each vector in a vector field to a single row matrix, thus creating a matrix field from a vector field

    field

    The input field.

    returns

    Copy of input matrix field with all vectors transposed to single row matrices.

  143. def trim(field: compiler.parser.syntaxtree.Field, resultShape: cogmath.geometry.Shape): compiler.parser.syntaxtree.Field

    Permalink

    "Trim" a field to a smaller size by clipping off indices (maintaining the origin).

    "Trim" a field to a smaller size by clipping off indices (maintaining the origin).

    field

    The input field.

    resultShape

    Desired shape of the resulting field; must not be larger in any dimension than the corresponding dimension of the input field

    returns

    The trimmed field.

  144. def upsample(field: compiler.parser.syntaxtree.Field, factor: Int = 2, phase: Int = 0): compiler.parser.syntaxtree.Field

    Permalink

    Upsample with zeroes inserted between field points, increasing the size of the input in all dimensions.

    Upsample with zeroes inserted between field points, increasing the size of the input in all dimensions.

    Example: for input field {1,2,3}

    input.upsample(2) yields {1,0,2,0,3,0}
    
    input.upsample(2,1) yields {0,1,0,2,0,3}
    field

    The input field.

    factor

    The sampling factor, defaults to 2.

    phase

    The offset within the scaled up field to put the input data, defaults to an offset of 0.

  145. def vectorElement(field: compiler.parser.syntaxtree.Field, index: Int): compiler.parser.syntaxtree.Field

    Permalink

    Convert a vector field to a scalar field by extracting one element of each vector.

    Convert a vector field to a scalar field by extracting one element of each vector.

    field

    The input field.

    index

    The element of each vector to be extracted.

    returns

    Input field with tensor order reduced by one.

  146. def vectorElements(field: compiler.parser.syntaxtree.Field, indices: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Convert a vector field to a smaller vector field by extracting a dynamically indexed a range of elements

    Convert a vector field to a smaller vector field by extracting a dynamically indexed a range of elements

    field

    The input field.

    returns

    Input field with tensor order reduced by one.

  147. def vectorField(field: compiler.parser.syntaxtree.ColorField): compiler.parser.syntaxtree.VectorField

    Permalink

    Convert a color field to a vector field, with each vector of length 3 representing, in order, the red, green and blue components of the corresponding pixel.

    Convert a color field to a vector field, with each vector of length 3 representing, in order, the red, green and blue components of the corresponding pixel.

    field

    Color field to be converted to vector field.

    returns

    Vector field, with each vector holding the red, green, blue components.

  148. def vectorField(fields: Array[compiler.parser.syntaxtree.Field]): compiler.parser.syntaxtree.VectorField

    Permalink

    Create a vector field from scalar fields by "stacking" the scalar fields.

    Create a vector field from scalar fields by "stacking" the scalar fields.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The scalar fields to be stacked into a vector field.

    returns

    The resulting vector field.

  149. def vectorField(fields: Array[compiler.parser.syntaxtree.ScalarField]): compiler.parser.syntaxtree.VectorField

    Permalink

    Create a vector field from scalar fields by "stacking" the scalar fields.

    Create a vector field from scalar fields by "stacking" the scalar fields.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The scalar fields to be stacked into a vector field.

    returns

    The resulting vector field.

  150. def vectorField(fields: compiler.parser.syntaxtree.ScalarField*): compiler.parser.syntaxtree.VectorField

    Permalink

    Create a vector field from scalar fields by "stacking" the scalar fields.

    Create a vector field from scalar fields by "stacking" the scalar fields.

    For example, this can be used to stack N scalar fields to a single vector field where each vector is of length N.

    fields

    The scalar fields to be stacked into a vector field.

    returns

    The resulting vector field.

  151. implicit def vectorTo0DVectorField(v: cogmath.algebra.real.Vector): compiler.parser.syntaxtree.VectorField

    Permalink

    Implicit conversion of a Vector to a 0D constant VectorField which allows for fields to be combined with vectors in a simple way.

    Implicit conversion of a Vector to a 0D constant VectorField which allows for fields to be combined with vectors in a simple way. This makes it possible to express commutative operations with a common syntax.

    For example

    Field + Vector

    and

    Vector + Field

    are both legal and compilable with this implicit conversion.

    v

    The vector to be converted to a 0D vector field.

    returns

    A 0D vector field initialized to v.

    Definition Classes
    ImplicitConversions
  152. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  153. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  154. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  155. def warp(field: compiler.parser.syntaxtree.Field, guide: compiler.parser.syntaxtree.Field, border: platform.types.BorderPolicy = BorderClamp): compiler.parser.syntaxtree.Field

    Permalink

    Warps a 2D scalar, vector or matrix field, guided by a vector field called "the guide." The guide must either be zero-dimensional, in which case the input field is translated uniformly, or must be a 2D vector field with exactly the same shape as the input.

    Warps a 2D scalar, vector or matrix field, guided by a vector field called "the guide." The guide must either be zero-dimensional, in which case the input field is translated uniformly, or must be a 2D vector field with exactly the same shape as the input.

    The guiding vector with value (v1, v2) at a given point (row, col) extracts the element at location (row - v1, col - v2) as its output. If that location falls outside of the field, the BorderPolicy attached to the the opcode determines how the missing value is computed. If either of the guide vector components v1 and v2 is non-integral, bilinear interpolation is used to to determine the approximate value.

    field

    The input field.

    guide

    The guiding vector field.

    border

    Policy for handling borders.

    returns

    Input field, warped by the guide.

  156. def winnerTakeAll(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the "winner" of a scalar field by mapping its largest element to 1.0f and the other elements to 0.0f

    Compute the "winner" of a scalar field by mapping its largest element to 1.0f and the other elements to 0.0f

    This is not well-defined when multiple elements share the maximum value, so beware.

    field

    The input field.

    returns

    A scalar field with the same shape as the input, with a single element containing 1.0f and the rest containing 0.0f.

Deprecated Value Members

  1. def bilateralFilter(field: compiler.parser.syntaxtree.Field, spatialFilter: cogmath.algebra.real.Matrix, rangeSigma: Float): compiler.parser.syntaxtree.Field

    Permalink

    Perform bilateral filtering using spatialFilter for spatial filtering (typically this will be a truncated Gaussian) and a Gaussian with width rangeSigma for range filtering.

    Perform bilateral filtering using spatialFilter for spatial filtering (typically this will be a truncated Gaussian) and a Gaussian with width rangeSigma for range filtering.

    WARNING: This is an old algorithm that is not very efficient. Consider a newer algorithm such as domain transform filtering.

    field

    The input field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) inefficient, use domain transform filter instead

  2. def conditionNumber(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Given a matrix field, compute the condition number for each matrix in that field.

    Given a matrix field, compute the condition number for each matrix in that field. This is currently limited to fields containing 2 x 2 matrices.

    field

    The input field.

    returns

    Scalar field holding the condition numbers for the corresponding matrices in the input matrix field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  3. def determinant(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Compute the determinant of every matrix in a matrix field.

    Compute the determinant of every matrix in a matrix field.

    field

    The input field.

    returns

    Scalar field holding the determinants for the corresponding matrices in the input matrix field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  4. def domainFilterColumns(field: compiler.parser.syntaxtree.Field, domainTransform: compiler.parser.syntaxtree.ScalarField, boxFilterRadius: Float): compiler.parser.syntaxtree.Field

    Permalink

    Perform a "domain filter" on the columns of a color field as a step in edge-aware normalized convolution.

    Perform a "domain filter" on the columns of a color field as a step in edge-aware normalized convolution. This "correlates" an adaptive box filter with each pixel in the columns of the color field, guided by domainTransform.

    This operation works only on color fields and is an optimization. The following code sequences, A and B, are functionally identical:

    // Prepare for filtering
    val rowTransform: Field =
    val colTransform: Field =
    
    // Sequence A (slower)
    var smooth = colorImage
    smooth = smooth.domainFilterRows(rowTransform, ...)
    smooth = smooth.transpose.domainFilterRows(colTransform, ...).transpose
    
    // Sequence B, using this operation (faster, no transposes)
    var smooth = colorImage
    smooth = smooth.domainFilterRows(rowTransform, ...)
    smooth = smooth.domainFilterColumns(colTransform, ...)

    For details, see the paper "Domain transform for edge-aware image and video processing," Gastal and Oliveira, 2011. Normally this is not useful for end-users, but you're welcome to try it if you would like to write your own edge-aware filters.

    field

    The input field.

    domainTransform

    The cumulative domain transform for the image.

    boxFilterRadius

    Radius of box filter.

    returns

    The domain transform of the columns (equation 11) in the Gastal paper as a scalar field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  5. def domainFilterRows(field: compiler.parser.syntaxtree.Field, domainTransform: compiler.parser.syntaxtree.Field, boxFilterRadius: Float): compiler.parser.syntaxtree.Field

    Permalink

    Perform a "domain filter" on the rows of a tensor or color field as a step in edge-aware normalized convolution.

    Perform a "domain filter" on the rows of a tensor or color field as a step in edge-aware normalized convolution. This "correlates" an adaptive box filter with each pixel in the rows of the color field, guided by domainTransform.

    For details, see the paper "Domain transform for edge-aware image and video processing," Gastal and Oliveira, 2011. Normally this is not useful for end-users, but you're welcome to try it if you would like to write your own edge-aware filters.

    field

    The input field.

    domainTransform

    The cumulative domain transform for the image.

    boxFilterRadius

    Radius of box filter.

    returns

    The domain transform of the rows (equation 11) in the Gastal paper as a scalar field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  6. def domainTransformRows(field: compiler.parser.syntaxtree.Field, spaceSigma: Float, rangeSigma: Float): compiler.parser.syntaxtree.Field

    Permalink

    Perform a "domain transform" on the rows of a color field or tensor field as a step in edge-aware normalized convolution.

    Perform a "domain transform" on the rows of a color field or tensor field as a step in edge-aware normalized convolution.

    For details, see the paper "Domain transform for edge-aware image and video processing," Gastal and Oliveira, 2011. Normally this is not useful for end-users, but you're welcome to try it if you would like to write your own edge-aware filters.

    field

    The input field.

    spaceSigma

    Width of filter in space.

    rangeSigma

    Width of filter in range.

    returns

    The domain transform of the rows (equation 11) in the Gastal paper as a scalar field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  7. def invertMatrices(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Invert all matrices in a matrix field using Gauss-Jordan elimination.

    Invert all matrices in a matrix field using Gauss-Jordan elimination.

    This is numerically stable only for small matrices, and let's not even get in to singular matrices. Be careful.

    field

    The input field.

    returns

    A matrix field where each matrix is the (approximate) inverse of the corresponding matrix in the input matrix field.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  8. def localMax(field: compiler.parser.syntaxtree.Field, neighborhood: cogmath.algebra.real.Matrix): compiler.parser.syntaxtree.Field

    Permalink

    Find the local maximum of a neighborhood centered on each pixel in a 2D scalar field.

    Find the local maximum of a neighborhood centered on each pixel in a 2D scalar field.

    For each point in the input 2D scalar field, this searches a small neighborhood of that point and extracts the largest scalar found.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the maximum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local max search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A scalar field with the same shape as the input, where each element is equal to the local max of the input field as defined by neighborhood.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  9. def localMaxPosition(field: compiler.parser.syntaxtree.Field, neighborhood: cogmath.algebra.real.Matrix): compiler.parser.syntaxtree.Field

    Permalink

    For a scalar field, find the relative position of the local maximum of a neighborhood centered on the current pixel.

    For a scalar field, find the relative position of the local maximum of a neighborhood centered on the current pixel. This is returned as vector field, with each vector's tail at the current pixel and the head pointing at the pixel containing the neighborhood's local maximum.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the maximum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local max search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A vector field with the same field shape as the input scalar field, with each vector pointing to the maximum value in the neighborhood relative to the center of the neighborhood.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  10. def localMin(field: compiler.parser.syntaxtree.Field, neighborhood: cogmath.algebra.real.Matrix): compiler.parser.syntaxtree.Field

    Permalink

    Find the local minimum of a neighborhood centered on each pixel in a 2D scalar field.

    Find the local minimum of a neighborhood centered on each pixel in a 2D scalar field.

    For each point in the input 2D scalar field, this searches a small neighborhood of that point and extracts the smallest scalar found.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the minimum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local max search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A scalar field with the same shape as the input, where each element is equal to the local min of the input field as defined by neighborhood.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  11. def localMinPosition(field: compiler.parser.syntaxtree.Field, neighborhood: cogmath.algebra.real.Matrix): compiler.parser.syntaxtree.Field

    Permalink

    For a scalar field, find the relative position of the local minimum of a neighborhood centered on the current pixel.

    For a scalar field, find the relative position of the local minimum of a neighborhood centered on the current pixel. This is returned as vector field, with each vector's tail at the current pixel and the head pointing at the pixel containing the neighborhood's local manimum.

    The neighborhood is defined by a matrix which is centered on the point. A non-zero value in the kernel means the corresponding point in the field is part of the neighborhood, while a zero implies the point should be ignored.

    For example, the kernel

    1 1 0
    1 1 0
    0 0 0

    specifies the 2 x 2 neighborhood for the minimum value search.

    field

    The input field.

    neighborhood

    An odd-sized matrix describing the neighborhood for doing the local min search. TO DO: This will become a field rather than a matrix. XXX

    returns

    A vector field with the same field shape as the input scalar field, with each vector pointing to the minimum value in the neighborhood relative to the center of the neighborhood.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  12. def maxPosition(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Find the location/position of the maximum element in a scalar field.

    Find the location/position of the maximum element in a scalar field.

    field

    The input field.

    returns

    A 0D vector field containing a vector holding the indices of the maximum element.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  13. def medianFilter(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Filter a 2D input scalar field with a 3 x 3 median filter.

    Filter a 2D input scalar field with a 3 x 3 median filter.

    field

    The input field.

    returns

    A 2D scalar field with the same field shape as the input, with each element median filtered.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  14. def nonMaximumSuppression(field: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Forces locally non-maximum pixels to zero for both scalar fields and vector fields.

    Forces locally non-maximum pixels to zero for both scalar fields and vector fields.

    Locality is defined to be the 8 nearest neighbors to a given pixel. If a pixel is greater than or equal to any of those neighbors, its value is left intact on the output, otherwise it's set to zero. Note that border pixels have only 5 nearest neighbors and corner pixels have only 3 nearest neighbors, so those are the only ones checked.

    Vector fields are treated as though they were an array of scalar fields, so non-maximum suppression is executed independently on each.

    field

    The input field.

    returns

    A copy of the input field with locally non-maximum values set to zero.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

  15. def orientedNonMaximumSuppression(field: compiler.parser.syntaxtree.Field, orientation: compiler.parser.syntaxtree.Field): compiler.parser.syntaxtree.Field

    Permalink

    Forces locally non-maximum pixels to zero for calar fields, but only when comparing the pixels on either side of a given pixel, using orientation to define where to look for the two pixels for comparison.

    Forces locally non-maximum pixels to zero for calar fields, but only when comparing the pixels on either side of a given pixel, using orientation to define where to look for the two pixels for comparison.

    field

    The input field.

    orientation

    A scalar field holding the local orientation of the input field at every point. Orientation ranges from -Pi/2 to Pi/2, where the corresponding orientation rotates clockwise from horizontal (-Pi/2) to vertical (0) to horizontal (Pi/2).

    returns

    A copy of the input field with locally non-maximum values set to zero.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.1.1) will be moved to a library

Inherited from ImplicitConversions

Inherited from SemanticError

Inherited from CompilerError

Inherited from AnyRef

Inherited from Any

Ungrouped