MPSMatrixSolveTriangular(3) MetalPerformanceShaders.framework MPSMatrixSolveTriangular(3)NAME
MPSMatrixSolveTriangular
SYNOPSIS
#import <MPSMatrixSolve.h>
Inherits MPSMatrixBinaryKernel.
Instance Methods
(nonnull instancetype) - initWithDevice:right:upper:transpose:unit:order:numberOfRightHandSides:alpha:
(void) - encodeToCommandBuffer:sourceMatrix:rightHandSideMatrix:solutionMatrix:
Additional Inherited Members
Detailed Description
MPSMatrixSolve.h MetalPerformanceShaders.framework
Copyright:
Copyright (c) 2016 Apple Inc. All rights reserved. MetalPerformanceShaders filter base classes
This depends on Metal.framework.
A kernel for computing the solution of a linear system of equations using a triangular coefficient matrix.
A MPSMatrixSolveTriangular finds the solution matrix to the triangular system:
op(A) * X = alpha * B or X * op(A) = alpha * B
Where A is either upper or lower triangular and op(A) is A**T or A. B is the array of right hand sides for which the equations are to be
solved. X is the resulting matrix of solutions.
Method Documentation
- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSMatrix *__nonnull) sourceMatrix(MPSMatrix *__nonnull)
rightHandSideMatrix(MPSMatrix *__nonnull) solutionMatrix
Encode a MPSMatrixSolveTriangular kernel into a command Buffer.
Parameters:
commandBuffer A valid MTLCommandBuffer to receive the encoded filter
sourceMatrix A valid MPSMatrix containing the source matrix.
rightHandSideMatrix A valid MPSMatrix containing the right hand side values.
solutionMatrix A valid MPSMatrix to contain the result.
This function encodes the MPSMatrixSolveTriangular object to a valid command buffer.
rightHandSideMatrix and solutionMatrix must be large enough to hold at least order * numberOfRightHandSides values starting at
secondarySourceMatrixOrigin and resultMatrixOrigin respectively.
sourceMatrix must be at least size order x order starting at primarySourceMatrixOrigin.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(BOOL) right(BOOL) upper(BOOL) transpose(BOOL) unit(NSUInteger)
order(NSUInteger) numberOfRightHandSides(double) alpha
Initialize an MPSMatrixSolveTriangular object on a device
Parameters:
device The device on which the kernel will execute.
right A boolean value which indicates if the coefficient matrix is multiplied on the left or right side of the solution. NO indicates
the multiplication is on the left.
upper A boolean value which indicates if the source is lower or upper triangular. NO indicates that the coefficient matrix is lower
triangular.
transpose A boolean value which indicates if the source matrix should be used in transposed form. NO indicates that the coefficient
matrix is to be used normally.
unit A boolean value which indicates if the source matrix is unit triangular.
order The order of the source matrix and, if right == NO, the number of rows in the solution and right hand side matrices. If right ==
YES the number of columns in the solution and right hand side matrices.
numberOfRightHandSides If right == NO, the number of columns in the solution and right hand side matrices. The number of rows
otherwise.
alpha A double precision value used to scale the right hand sides.
This function initializes a MPSMatrixSolveTriangular object. It may allocate device side memory.
Returns:
A valid MPSMatrixSolveTriangular object or nil, if failure.
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSMatrixSolveTriangular(3)
Check Out this Related Man Page
MPSMatrixSoftMax(3) MetalPerformanceShaders.framework MPSMatrixSoftMax(3)NAME
MPSMatrixSoftMax
SYNOPSIS
#import <MPSMatrixSoftMax.h>
Inherits MPSMatrixUnaryKernel.
Inherited by MPSMatrixLogSoftMax.
Instance Methods
(nonnull instancetype) - initWithDevice:
(void) - encodeToCommandBuffer:inputMatrix:resultMatrix:
(nullable instancetype) - initWithCoder:device:
(nonnull instancetype) - copyWithZone:device:
Properties
NSUInteger sourceRows
NSUInteger sourceColumns
Additional Inherited Members
Detailed Description
This depends on Metal.framework.
A softmax kernel that operates on matrices.
A MPSMatrixSoftMax object computes:
B_ij = Exp { A_ij } / ( Sum_k Exp { A_ik } )
A and B are matrices which are represented by MPSMatrix
objects. This filter computes the same result for MPSMatrices as
MPSCNNSoftMax filter does for MPSImages by interpreting the columns
of the matrix as feature channels, that is the sum runs over column indices.
Method Documentation
- (nonnull instancetype) copyWithZone: (nullable NSZone *) zone(nullable id< MTLDevice >) device
Make a copy of this kernel for a new device -
See also:
MPSKernel
Parameters:
zone The NSZone in which to allocate the object
device The device for the new MPSKernel. If nil, then use self.device.
Returns:
a pointer to a copy of this MPSKernel. This will fail, returning nil if the device is not supported. Devices must be
MTLFeatureSet_iOS_GPUFamily2_v1 or later.
Reimplemented from MPSKernel.
- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSMatrix *__nonnull) inputMatrix(MPSMatrix *__nonnull)
resultMatrix
Encode a MPSMatrixSoftMax object to a command buffer.
Parameters:
commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
inputMatrix A valid MPSMatrix object which specifies the input matrix.
resultMatrix A valid MPSMatrix object which specifies the matrix which will be overwritten by the result.
Certain constraints apply to the sizes of the matrices depending on the sizes requested at initialization time as well as the origins at
the time this routine is called:
The result matrix must be large enough to hold a two dimensional array of 'sourceRows' rows and 'sourceColumns' columns beginning at
resultMatrixOrigin.
Each matrix within the range specified by batchStart and batchSize, which also specifies a valid set of matrices within inputMatrix and
resultMatrix, will be processed.
The datatypes of the matrices inputMatrix and resultMatrix must match and be either MPSDataTypeFloat32 or MPSDataTypeFloat16.
- (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device
NSSecureCoding compatability See MPSKernel::initWithCoder.
Parameters:
aDecoder The NSCoder subclass with your serialized MPSMatrixSoftMax
device The MTLDevice on which to make the MPSMatrixSoftMax
Returns:
A new MPSMatrixSoftMax object, or nil if failure.
Reimplemented from MPSKernel.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device
Initialize an MPSMatrixSoftMax object on a device for a given size.
Parameters:
device The device on which the kernel will execute.
Returns:
A valid MPSMatrixSoftMax object or nil, if failure.
Reimplemented from MPSKernel.
Property Documentation
- sourceColumns [read], [write], [nonatomic], [assign]
The number of columns to consider from the source in the operation. This property is modifiable and defaults to NSUIntegerMax and the
number is adjusted dynamically at kernel encode time (see encodeToCommandBuffer) to fit into the source matrix available starting from
sourceMatrixOrigin.y, indicating that by default the whole source matrix is used. If a different size is desired then this should be
modified prior to encoding the kernel. It is the user's responsibility to ensure that the resultMatrix parameter in encodeToCommandBuffer
is large enough to accommodate the results of this operation, otherwise the results of the encode call are undefined. NOTE:
sourceMatrixOrigin and resultMatrixOrigin from MPSMatrixUnaryKernel can be used to control the starting points in the source and
destination at kernel encode time (see encodeToCommandBuffer).
- sourceRows [read], [write], [nonatomic], [assign]
The number of rows to consider from the source in the operation. This property is modifiable and defaults to NSUIntegerMax and the number
is adjusted dynamically at kernel encode time (see encodeToCommandBuffer) to fit into the source matrix available starting from
sourceMatrixOrigin.x, indicating that by default the whole source matrix is used. If a different size is desired then this should be
modified prior to encoding the kernel. It is the user's responsibility to ensure that the resultMatrix parameter in encodeToCommandBuffer
is large enough to accommodate the results of this operation, otherwise the results of the encode call are undefined. NOTE:
sourceMatrixOrigin and resultMatrixOrigin from MPSMatrixUnaryKernel can be used to control the starting points in the source and
destination at kernel encode time (see encodeToCommandBuffer).
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSMatrixSoftMax(3)