Package org.apache.sysds.runtime.matrix.data

# Class LibMatrixNative

java.lang.Object
org.apache.sysds.runtime.matrix.data.LibMatrixNative

public class LibMatrixNative extends Object

## Constructor Summary

Constructors
Constructor
Description
`LibMatrixNative()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`conv2d(MatrixBlock input, MatrixBlock filter, MatrixBlock outputBlock, DnnParameters params)`
This method performs convolution (i.e.
`static void`
`conv2dBackwardData(MatrixBlock filter, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)`
This method computes the backpropagation errors for previous layer of convolution operation
`static void`
`conv2dBackwardFilter(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)`
This method computes the backpropogation errors for filter of convolution operation
`static void`
`fromFloatBuffer(FloatBuffer buff, double[] output)`
`static boolean`
`isMatMultMemoryBound(int m1Rlen, int m1Clen, int m2Clen)`
`static boolean`
`isSinglePrecision()`
`static MatrixBlock`
`matrixMult(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, int k)`
Performs matrix multiplication using native library if BLAS is available or else falls back to Java BLAS.
`static void`
`tsmm(MatrixBlock m1, MatrixBlock ret, boolean leftTrans, int k)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LibMatrixNative

public LibMatrixNative()

## Method Details

### isMatMultMemoryBound

public static boolean isMatMultMemoryBound(int m1Rlen, int m1Clen, int m2Clen)

### matrixMult

public static MatrixBlock matrixMult(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, int k)
Performs matrix multiplication using native library if BLAS is available or else falls back to Java BLAS.

Parameters:
  `m1` - lhs matrix block
  `m2` - rhs matrix block
  `ret` - output matrix block
  `k` - number of threads
Returns:
  the ret matrixBlock if allocated otherwise a new matrixBlock.

### tsmm

public static void tsmm(MatrixBlock m1, MatrixBlock ret, boolean leftTrans, int k)

### conv2d

public static void conv2d(MatrixBlock input, MatrixBlock filter, MatrixBlock outputBlock, DnnParameters params)
This method performs convolution (i.e. cross-correlation) operation on input

Parameters:
  `input` - input batch
  `filter` - filter
  `outputBlock` - output of convolution
  `params` - convolution parameters

### conv2dBackwardFilter

public static void conv2dBackwardFilter(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)
This method computes the backpropogation errors for filter of convolution operation

Parameters:
  `input` - input image
  `dout` - errors from next layer
  `outputBlock` - output errors
  `params` - convolution parameters

### conv2dBackwardData

public static void conv2dBackwardData(MatrixBlock filter, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)
This method computes the backpropagation errors for previous layer of convolution operation

Parameters:
  `filter` - filter used in conv2d
  `dout` - errors from next layer
  `outputBlock` - output errors
  `params` - convolution parameters

### isSinglePrecision

public static boolean isSinglePrecision()

### fromFloatBuffer

public static void fromFloatBuffer(FloatBuffer buff, double[] output)