A Float constant as a GPUExpression.
A Float constant as a GPUExpression.
An Int constant as a GPUExpression.
An Int constant as a GPUExpression.
An array variable in a GPU kernel
An array variable in a GPU kernel
An expression in a GPU kernel
An expression in a GPU kernel
A scalar/vector variable in a GPU kernel
A scalar/vector variable in a GPU kernel
Square root of -1
Square root of -1
Begin an anonymous block.
Begin an anonymous block.
Debug the GPUOperator.
Debug the GPUOperator.
Begin an "else" block.
Begin an "else" block.
Begin an "elseif" block.
Begin an "elseif" block.
Begin a "for" block.
Begin a "for" block.
Begin a "forEachTensorElement" block.
Begin a "forEachTensorElement" block.
Override global thread allocation.
Override global thread allocation. Typically used to create a thread per tensor element in a field, though the field may be illusory, not corresponding to any input or output field. This gives you raw control over thread allocation.
Each thread can see its identity in the global thread space from the constants:
_layer _row _column _tensorElement
Basically this creates a thread for each element in a tensor field.
The shape of the global threads allocated. This may be 1D, 2D or 3D, and each thread can see its identity with the _layer, _row, and _column constants.
The shape of the tensors in the (possibly illusory) field. One thread is created for each tensor in that field.
Statement for the global thread allocation override.
Override global thread allocation.
Override global thread allocation. Typically used to create a thread per tensor in a field, though the field may be illusory, not corresponding to any input or output field. This gives you raw control over thread allocation.
Each thread can see its identity in the global thread space from the constants:
_layer _row _column
The shape of the global threads allocated. This may be 1D, 2D or 3D, and each thread can see its identity with the _layer, _row, and _column constants.
Statement for the global thread allocation override.
Begin an "if" block.
Begin an "if" block.
Declare an array variable to be local.
Declare an array variable to be local.
Declare a variable to be local.
Declare a variable to be local.
Override local thread allocation (work group size).
Override local thread allocation (work group size).
The shape of the work group threads.
Statement for the local thread allocation override
Create a pointer to an array element.
Create a pointer to an array element.
Create a pointer to a variable.
Create a pointer to a variable.
Read the tensor in a 3D field using explicit addressing.
Read the tensor in a 3D field using explicit addressing.
The tensor field to be read.
The layer address of the tensor.
The row address of the tensor.
The column address of the tensor.
The value of the tensor as an expression.
Read the tensor in a 2D field using explicit addressing.
Read the tensor in a 2D field using explicit addressing.
The tensor field to be read.
The row address of the tensor.
The column address of the tensor.
The value of the tensor as an expression.
Read the tensor in a 1D field using explicit addressing.
Read the tensor in a 1D field using explicit addressing.
The tensor field to be read.
The column address of the tensor.
The value of the tensor as an expression.
Read the "current" tensor (addressed by _layer, _row, _column).
Read the "current" tensor (addressed by _layer, _row, _column).
The tensor field to be read.
The value of the tensor as an expression.
Read the tensor in a 3D field using explicit addressing.
Read the tensor in a 3D field using explicit addressing.
The tensor field to be read.
The layer address of the tensor.
The row address of the tensor.
The column address of the tensor.
The element (index) of the tensor to be read.
The value of the tensor as an expression.
Read the tensor in a 2D field using explicit addressing.
Read the tensor in a 2D field using explicit addressing.
The tensor field to be read.
The row address of the tensor.
The column address of the tensor.
The element (index) of the tensor to be read.
The value of the tensor as an expression.
Read the tensor in a 1D field using explicit addressing.
Read the tensor in a 1D field using explicit addressing.
The tensor field to be read.
The column address of the tensor.
The element (index) of the tensor to be read.
The value of the tensor as an expression.
Read the "current" tensor (addressed by _layer, _row, _column).
Read the "current" tensor (addressed by _layer, _row, _column).
The tensor field to be read.
The element (index) of the tensor to be read.
The value of the tensor as an expression.
Synchronize threads with a barrier with respect to global memory.
Synchronize threads with a barrier with respect to global memory.
Synchronize threads with a barrier with respect to local memory.
Synchronize threads with a barrier with respect to local memory.
Create a 3D array of tensors, where the tensor type is defined the type of tensors in a field.
Create a 3D array of tensors, where the tensor type is defined the type of tensors in a field.
The tensor field to be analyzed.
Layers in tensor array.
Rows in tensor array.
Columns in tensor array.
The declaration for the array.
Create a 2D array of tensors, where the tensor type is defined the type of tensors in a field.
Create a 2D array of tensors, where the tensor type is defined the type of tensors in a field.
The tensor field to be analyzed.
Rows in tensor array.
Columns in tensor array.
The declaration for the array.
Create a 1D array of tensors, where the tensor type is defined the type of tensors in a field.
Create a 1D array of tensors, where the tensor type is defined the type of tensors in a field.
The tensor field to be analyzed.
Length of tensor array.
The declaration for the array.
Create a 3D array of tensor elements, where the element type is defined by the type of tensors in a field.
Create a 3D array of tensor elements, where the element type is defined by the type of tensors in a field.
The tensor field to be analyzed.
Layers in tensor array.
Rows in tensor array.
Columns in tensor array.
The declaration for the array.
Create a 2D array of tensor elements, where the element type is defined by the type of tensors in a field.
Create a 2D array of tensor elements, where the element type is defined by the type of tensors in a field.
The tensor field to be analyzed.
Rows in tensor array.
Columns in tensor array.
The declaration for the array.
Create a 1D array of tensor elements, where the element type is defined by the type of tensors in a field.
Create a 1D array of tensor elements, where the element type is defined by the type of tensors in a field.
The tensor field to be analyzed.
Length of tensor array.
The declaration for the array.
Create an element variable of type defined by the tensors in a field.
Create an element variable of type defined by the tensors in a field.
The tensor field to be analyzed.
The value of the tensor as an expression.
Create a variable of type defined by the tensors in a field.
Create a variable of type defined by the tensors in a field.
The tensor field to be analyzed.
The value of the tensor as an expression.
Declare an array variable to be volatile.
Declare an array variable to be volatile.
Declare a variable to be volatile.
Declare a variable to be volatile.
Begin a "while" block.
Begin a "while" block.
Write a tensor to an indexed location in a 3D output field.
Write a tensor to an indexed location in a 3D output field.
The index of the output field to be written (e.g. _out0)
The tensor to be written
The layer index of the location to be written with the tensor.
The row index of the location to be written with the tensor.
The column index of the location to be written with the tensor.
Write a tensor to an indexed location in a 2D output field.
Write a tensor to an indexed location in a 2D output field.
The index of the output field to be written (e.g. _out0)
The tensor to be written
The row index of the location to be written with the tensor.
The column index of the location to be written with the tensor.
Write a tensor to an indexed location in a 1D output field.
Write a tensor to an indexed location in a 1D output field.
The index of the output field to be written (e.g. _out0)
The tensor to be written
The column index of the location to be written with the tensor.
Write a tensor to an output field using the default location for the current thread (_layer, _row, _column).
Write a tensor to an output field using the default location for the current thread (_layer, _row, _column). Note that if this is a 0D field, though, the tensor will be written to the single location in that field regardless of the (_layer, _row, _column) thread variables.
The index of the output field to be written (e.g. _out0)
The tensor to be written
Write a tensor element to an indexed location in a 3D output field.
Write a tensor element to an indexed location in a 3D output field.
The index of the output field to be written (e.g. _out0)
The tensor element to be written
The layer index of the location to be written with the tensor element.
The row index of the location to be written with the tensor element.
The column index of the location to be written with the tensor element.
The index of the element to be written; this will most commonly be _tensorElement, but it is not restricted to that.
Write a tensor element to an indexed location in a 2D output field.
Write a tensor element to an indexed location in a 2D output field.
The index of the output field to be written (e.g. _out0)
The tensor element to be written
The row index of the location to be written with the tensor element.
The column index of the location to be written with the tensor element.
The index of the element to be written; this will most commonly be _tensorElement, but it is not restricted to that.
Write a tensor element to an indexed location in a 1D output field.
Write a tensor element to an indexed location in a 1D output field.
The index of the output field to be written (e.g. _out0)
The tensor element to be written
The column index of the location to be written with the tensor element.
The index of the element to be written; this will most commonly be _tensorElement, but it is not restricted to that.
Write a tensor element to an output field using the default location for the current thread (_layer, _row, _column).
Write a tensor element to an output field using the default location for the current thread (_layer, _row, _column). Note that if this is a 0D field, though, the tensor will be written to the single location in that field regardless of the (_layer, _row, _column) thread variables.
The index of the output field to be written (e.g. _out0)
The tensor element to be written
The index of the element to be written; this will most commonly be _tensorElement, but it is not restricted to that.
Take the absolute value of every numeric element in field
.
Take the absolute value of every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to absoluteValue(x).
Take the arccosine of every numeric element in field
.
Take the arccosine of every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to acos(x).
Take the arcsine of every numeric element in field
.
Take the arcsine of every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to asin(x).
Compute atan2 of two identically shaped scalar fields.
Compute atan2 of two identically shaped scalar fields.
The input field.
A scalar field that's the atan2 of the two input fields.
Convolve a vector field with a vector-field filter frame.
Convolve a vector field with a vector-field filter frame.
The input field.
The filter to use for convolution; must be square and with odd size in each dimension.
Policy to use for handling convolution along borders, implicitly helps to determine size of output field.
Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.
The number of logical (possibly multi-plane) images present in the input field.
Input field convolved with filter
using the supplied border
and sampling policies.
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.
The input field.
A scalar field representing the backward divergence of an input vector field.
Compute the backward gradient of a 2D scalar or vector field.
Compute the backward gradient of a 2D scalar or vector field.
The input field.
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.
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.
The input field.
The factor by which the input field tensor length is reduced.
A vector field with each element equal to the max() of factor
components of the corresponding vector in the input field.
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.
The input field.
The factor by which the input field tensor length is reduced.
A vector field with each element equal to the min() of factor
components of the corresponding vector in the input field.
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.
The input field.
The factor by which the input field tensor length is reduced.
A vector field with each element equal to the sum of factor
components of the corresponding vector in the input field.
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)
The input field.
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.
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.
The input scalar or vector field.
Composed color field.
Create a color field from three scalar fields.
Create a color field from three scalar fields.
The red component scalar field.
The green component scalar field.
The blue component scalar field.
Color field composed of (red, green, blue).
Create a complex field from a real field.
Create a complex field from a real field.
Real input scalar field.
Complex version of real, with imaginary part set to zeros.
Create a complex field from two scalar fields
Create a complex field from two scalar fields
Real part of the created complex field.
Imaginary part of the created complex field.
Complex field composed of the real and imaginary inputs
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.
The Complex to be converted to a CogComplex
The CogComplex created from c
.
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.
The complex fields to be stacked into a complex vector field.
The resulting complex vector field.
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.
The complex fields to be stacked into a complex vector field.
The resulting complex vector field.
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.
The complex vector to be converted to a 0D complex vector field.
A 0D complex vector field initialized to v
.
Take the complex conjugate of each element in a complex field
Take the complex conjugate of each element in a complex field
The input field.
Conjugate of the input field.
Convolve a scalar/vector/matrix field with a filter.
Convolve a scalar/vector/matrix field with a filter.
The input field.
The filter to use for convolution; must be square and with odd size in each dimension.
Policy to use for handling convolution along borders, implicitly helps to determine size of output field.
Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.
Input field convolved with filter
using the supplied border
and sampling policies.
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.
The input field.
The filter to use for convolution; must be square and with odd size in each dimension.
Policy to use for handling convolution along borders, implicitly helps to determine size of output field.
Upsampling, downsampling optionally embedded in the convolution, also helps to determine the size of output field.
The number of logical (possibly multi-plane) images present in the input field.
Input field convolved with filter
using the supplied border
and sampling policies.
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).
The input field.
The filter to use for convolving the rows with odd size in each dimension.
The filter to use for convolving the columns with odd size in each dimension.
Policy to use for handling convolution along borders, implicitly helps to determine size of output field.
Input field convolved with filters using the supplied border policy.
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.
The input field.
A copy of the input field.
Take the cosine of every numeric element in field
.
Take the cosine of every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to cos(x).
Take the hyperbolic cosine of every numeric element in field
.
Take the hyperbolic cosine of every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to cosh(x).
Cross-correlate a scalar/vector/matrix field with a filter.
Cross-correlate a scalar/vector/matrix field with a filter.
The input field.
The filter to use for cross-correlation; must be square and with odd size in each dimension.
Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.
Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.
Input field cross-correlated with filter
using the supplied
border and sampling policies.
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.
The input field.
The filter to use for cross-correlation; must be square and with odd size in each dimension.
Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.
Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.
The number of logical (possibly multi-plane) images present in the input field.
Input field cross-correlated with filter
using the supplied
border and sampling policies.
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).
The input field.
The filter to use for cross-correlating the rows with odd size in each dimension.
The filter to use for cross-correlating the columns with odd size in each dimension.
Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.
Input field cross-correlated with filters using the supplied border policy.
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.
The input field.
Scalar field to multiply with field
.
"cross dot" product of field
and f2
.
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]
The input field.
The DCT of the input.
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]
The input field.
The DCT of the input.
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]
The input field.
The DCT of the input.
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]
The input field.
The DCT of the input.
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.
The input field.
Other field to "dot" with field
field.
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.
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:
The input field.
The sampling factor, defaults to 2.
The offset within the scaled up field to put the input data, defaults to an offset of 0.
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.
The input field.
Field equal to input field with each element, x, mapped to exp(x).
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.
The input field.
Policy to use for producing border values.
The integer dimensions of the expanded output field.
Expanded field with new elements filled in from the nearest input
edge per borderPolicy
.
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
The input field.
Policy to use for producing border values.
The shape of the expanded output field.
Expanded field with new elements filled in from the nearest input
edge per borderPolicy
.
Compute the FFT of a complex field.
Compute the FFT of a complex field.
The input field.
FFT of the input field.
Compute the FFT of the columns only in a 2D complex field.
Compute the FFT of the columns only in a 2D complex field.
The input field.
Input with each columns transformed by the FFT.
Compute the inverse FFT of a complex field (includes scaling).
Compute the inverse FFT of a complex field (includes scaling).
The input field.
Inverse FFT of the input field.
Compute the inverseFFT of the columns only in a 2D complex field.
Compute the inverseFFT of the columns only in a 2D complex field.
The input field.
Input with each columns transformed by the inverse FFT.
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).
The real component of the complex field input.
The imaginary component of the complex field input.
Inverse FFT of the input field, returned as a Tuple2 of the real and imaginary part fields.
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.
The input field.
Input with each row transformed by the inverse FFT.
Compute the FFT of a real field.
Compute the FFT of a real field.
The real component of the input whose imaginary component is 0.
FFT of the input, returned as a Tuple2 of the real and imaginary part fields.
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.
The real component of the complex field input.
The imaginary component of the complex field input.
FFT of the input, returned as a Tuple2 of the real and imaginary part fields.
Compute the FFT of the rows only in a 2D complex field.
Compute the FFT of the rows only in a 2D complex field.
The input field.
Input with each row transformed by the FFT.
Implicit conversion of an array of Fields to an array of ScalarFields.
Implicit conversion of an array of Fields to an array of ScalarFields.
An array of Fields.
An array of MatrixFields.
Implicit conversion of an array of Fields to an array of ScalarFields.
Implicit conversion of an array of Fields to an array of ScalarFields.
An array of Fields.
An array of ScalarFields.
Implicit conversion of an array of Fields to an array of ScalarFields.
Implicit conversion of an array of Fields to an array of ScalarFields.
An array of Fields.
An array of VectorFields.
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.
The input field.
0D scalar field holding the max value in input field.
Find the median value in a scalar field.
Find the median value in a scalar field.
The input field.
0D scalar field holding the median value of the input field.
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.
The input field.
0D scalar field holding the min value in input field.
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.
The input field.
0D scalar field holding the sum of values in input field.
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.
A field which needs coercion to the ColorField type.
The converted field.
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.
A field which needs coercion to the ComplexField type.
The converted field.
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.
A field which needs coercion to the ComplexVectorField type.
The converted field.
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.
A field which needs coercion to the MatrixField type.
The converted field.
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.
A field which needs coercion to the ScalarField type.
The converted field.
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.
A field which needs coercion to the VectorField type.
The converted field.
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
The input field.
A flipped version of the input field.
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.
The Float to be converted to a CogFloat
The CogFloat created from f
.
Float --> Complex
Float --> Complex
Implicitly convert a float to an expression.
Implicitly convert a float to an expression.
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.
The input field.
Field where every number element has been "floored" to an integer.
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.
The input field.
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.
Extract the imaginary part of a complex field as a scalar field.
Extract the imaginary part of a complex field as a scalar field.
The input field.
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.
Int --> Complex
Int --> Complex
Implicitly convert an int to an expression.
Implicitly convert an int to an expression.
Declare an internal error described by message
.
Declare an internal error described by message
.
Apply the natural logarithm to every numeric element in field
.
Apply the natural logarithm to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to log(x).
Take the magnitude of each element in a complex field
Take the magnitude of each element in a complex field
The input field.
Magnitude of the input field.
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.
The scalar fields to be stacked into a matrix field.
The resulting matrix field.
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.
The scalar fields to be stacked into a matrix field.
The resulting matrix field.
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.
The vector fields to be stacked into a matrix field.
The resulting matrix field.
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.
The vector fields to be stacked into a matrix field.
The resulting matrix field.
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.
The input field.
The index of the desired row to strip out of each matrix and use as a vector.
A vector field made up of the stripped out vectors from the input matrix field.
Select the maximum value of corresponding elements in two scalar fields.
Select the maximum value of corresponding elements in two scalar fields.
The input field.
Second scalar field to compare with field
.
Scalar field where each element is the largest corresponding
elements in field
or f2
.
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
.
The input field.
Operand for max operator.
A field equal to field
with each element, x
, mapped to
max(x, that)
.
Select the minimum value of corresponding elements in two scalar fields.
Select the minimum value of corresponding elements in two scalar fields.
The input field.
Second scalar field to compare with field
.
Scalar field where each element is the smallest corresponding
elements in field
or f2
.
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
.
The input field.
Operand for min operator.
A field equal to field
with each element, x
, mapped to
min(x, that)
.
Normalize a scalar field using the L1 norm.
Normalize a scalar field using the L1 norm.
The input field.
A normalized copy of the input field.
Normalize a scalar field using the L2 norm.
Normalize a scalar field using the L2 norm.
The input field.
A normalized copy of the input field.
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]
The input field.
Phase of the input field.
Create a complex field from polar coordinates.
Create a complex field from polar coordinates.
Scalar field where each scalar is the magnitude of the desired complex field.
Scalar field where each scalar is the phase of the desired complex field.
Complex field built from magnitude and phase.
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
.
The input field.
The exponent.
Input field with every number raised to the power that
.
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
.
The input field.
The exponent.
Input field with every number raised to the power that
.
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.
The fields to be probed.
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.
The field to be probed.
User's name for the field. If not supplied, the field is probed but uses system-inferred naming for the field.
The field being probed.
Cross-correlate a vector field with a vector-field filter frame.
Cross-correlate a vector field with a vector-field filter frame.
The input field.
The filter to use for cross-correlation; must be square and with odd size in each dimension.
Policy to use for handling cross-correlation along borders, implicitly helps to determine size of output field.
Upsampling, downsampling optionally embedded in the crossCorrelation, also helps to determine the size of output field.
The number of logical (possibly multi-plane) images present in the input field.
Input field cross-correlated with filter
using the supplied
border and sampling policies.
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.
The input field.
The number of bits of precision to use
A Vector field where each point in the field is random
Extract the real part of a complex field as a scalar field.
Extract the real part of a complex field as a scalar field.
The input field.
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.
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.
The input field.
Input field with each numeric element, x, mapped to 1/x.
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.
The input field.
A scalar field with each element equal to the maximum of the components of the corresponding vector in the input field.
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.
The input field.
A scalar field with each element equal to the minimum of the components of the corresponding vector in the input field.
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.
The input field.
A scalar field with each element equal to the sum of components of the corresponding vector in the input field.
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).
The input field.
The shape of the resulting output field.
A matrix field with the same field shape as f2
and tensor
shape the same as the input scalar field.
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.
The input field.
the output field shape to use
the output tensor shape to use
Warn of uses of reshape that had different behaviors prior to libcog 4.3
The input field, reshaped, with the same elements in the same linear order.
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.
The input field.
A sequence of new sizes for each dimensions. The product of this sequence must equal the number of elements in the input field.
The input field, reshaped, with the same elements in the same linear order.
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).
The input field.
Scalar field operand which have the same field shape as
field
.
Product of field
and f2
.
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)
0-dimensional scalar field supplying the index for the array to be read.
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.
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.
The input field.
Number of pixels to shift field.
Number of pixels to shift field.
Shifted input field.
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.
The input field.
Number of pixels to shift field.
Shifted input field.
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.
The input field.
Number of pixels to shift field.
Number of pixels to shift field.
Shifted input field.
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.
The input field.
Number of pixels to shift field.
Shifted input field.
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
The input field.
Field equal to input field with each element, x, mapped to signum(x).
Apply the sine operator to every numeric element in field
.
Apply the sine operator to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to sin(x).
Apply the hyperbolic sine operator to every numeric element in field
.
Apply the hyperbolic sine operator to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to sinh(x).
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
The input field.
Vector field argument.
The solution, x, to the set of linear equations.
Apply the square operator to every numeric element in field
.
Apply the square operator to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to (x * x).
Apply the square root operator to every numeric element in field
.
Apply the square root operator to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to sqrt(x).
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.
The fields to be stacked.
The resulting, higher-order tensor field.
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.
The fields to be stacked.
The resulting, higher-order tensor field.
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.
The input field.
The guide vector.
Shape of the window.
Policy for handling border processing.
Extracted window.
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.
The input field.
Sizes (rows and columns) of each subfield. Must be odd.
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.
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.
The input field.
Input field expanded by 2X in each dimension with pixel replication.
Apply the tangent operator to every numeric element in field
.
Apply the tangent operator to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to tan(x).
Apply the hyperbolic tangent operator to every numeric element in field
.
Apply the hyperbolic tangent operator to every numeric element in field
.
The input field.
Field equal to input field with each element, x, mapped to tanh(x).
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.
The input field.
The converted field.
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.
The input field.
The converted field.
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.
The input field.
The converted field.
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.
The input field.
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.
The input field.
The converted field.
Converts Float constants to their OpenCL equivalents, including the special cases.
Converts Float constants to their OpenCL equivalents, including the special cases.
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.
The input field.
The converted field.
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.
The input field.
The converted 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.
(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.
The input field.
Matrix field or vector field; must have the same field shape
as field
.
Matrix field or vector representing the matrix multiplications of corresponding elements in the two input fields.
Transpose a 2D tensor field or color field.
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.
The input field.
Copy of input matrix field with all matrices transposed.
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
The input field.
Copy of input matrix field with all vectors transposed to single row matrices.
"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).
The input field.
Desired shape of the resulting field; must not be larger in any dimension than the corresponding dimension of the input field
The trimmed field.
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}
The input field.
The sampling factor, defaults to 2.
The offset within the scaled up field to put the input data, defaults to an offset of 0.
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.
The input field.
The element of each vector to be extracted.
Input field with tensor order reduced by one.
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
The input field.
Input field with tensor order reduced by one.
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.
Color field to be converted to vector field.
Vector field, with each vector holding the red, green, blue components.
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.
The scalar fields to be stacked into a vector field.
The resulting vector field.
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.
The scalar fields to be stacked into a vector field.
The resulting vector field.
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.
The scalar fields to be stacked into a vector field.
The resulting vector field.
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.
The vector to be converted to a 0D vector field.
A 0D vector field initialized to v
.
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.
The input field.
The guiding vector field.
Policy for handling borders.
Input field, warped by the guide.
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.
The input field.
A scalar field with the same shape as the input, with a single element containing 1.0f and the rest containing 0.0f.
Override global thread allocation.
Override global thread allocation.
The field type on which to model thread allocation; the thread allocator will treat this as though the output tensor field were of this type, which typically means you'll get a thread per tensor (or tensor element in some cases)
Statement for the global thread allocation override.
(Since version Cog 4.1) use _globalThreads(Shape) or _globalThreads(Shape, Shape) instead
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.
The input field.
(Since version 4.1.1) inefficient, use domain transform filter instead
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.
The input field.
Scalar field holding the condition numbers for the corresponding matrices in the input matrix field.
(Since version 4.1.1) will be moved to a library
Compute the determinant of every matrix in a matrix field.
Compute the determinant of every matrix in a matrix field.
The input field.
Scalar field holding the determinants for the corresponding matrices in the input matrix field.
(Since version 4.1.1) will be moved to a library
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.
The input field.
The cumulative domain transform for the image.
Radius of box filter.
The domain transform of the columns (equation 11) in the Gastal paper as a scalar field.
(Since version 4.1.1) will be moved to a library
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.
The input field.
The cumulative domain transform for the image.
Radius of box filter.
The domain transform of the rows (equation 11) in the Gastal paper as a scalar field.
(Since version 4.1.1) will be moved to a library
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.
The input field.
Width of filter in space.
Width of filter in range.
The domain transform of the rows (equation 11) in the Gastal paper as a scalar field.
(Since version 4.1.1) will be moved to a library
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.
The input field.
A matrix field where each matrix is the (approximate) inverse of the corresponding matrix in the input matrix field.
(Since version 4.1.1) will be moved to a library
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.
The input field.
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
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
.
(Since version 4.1.1) will be moved to a library
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.
The input field.
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
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.
(Since version 4.1.1) will be moved to a library
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.
The input field.
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
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
.
(Since version 4.1.1) will be moved to a library
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.
The input field.
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
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.
(Since version 4.1.1) will be moved to a library
Find the location/position of the maximum element in a scalar field.
Find the location/position of the maximum element in a scalar field.
The input field.
A 0D vector field containing a vector holding the indices of the maximum element.
(Since version 4.1.1) will be moved to a library
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.
The input field.
A 2D scalar field with the same field shape as the input, with each element median filtered.
(Since version 4.1.1) will be moved to a library
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.
The input field.
A copy of the input field with locally non-maximum values set to zero.
(Since version 4.1.1) will be moved to a library
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.
The input field.
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).
A copy of the input field with locally non-maximum values set to zero.
(Since version 4.1.1) will be moved to a library