# SparseMatrixSparseMatMul

public final class **SparseMatrixSparseMatMul** Sparse-matrix-multiplies two CSR matrices \`a\` and \`b\`.


Performs a matrix multiplication of a sparse matrix \`a\` with a sparse matrix
\`b\`; returns a sparse matrix \`a \* b\`, unless either \`a\` or \`b\` is transposed or
adjointed.


Each matrix may be transposed or adjointed (conjugated and transposed)
according to the Boolean parameters \`transpose_a\`, \`adjoint_a\`, \`transpose_b\`
and \`adjoint_b\`. At most one of \`transpose_a\` or \`adjoint_a\` may be True.
Similarly, at most one of \`transpose_b\` or \`adjoint_b\` may be True.


The inputs must have compatible shapes. That is, the inner dimension of \`a\`
must be equal to the outer dimension of \`b\`. This requirement is adjusted
according to whether either \`a\` or \`b\` is transposed or adjointed.


The \`type\` parameter denotes the type of the matrix elements. Both \`a\` and \`b\`
must have the same type. The supported types are: \`float32\`, \`float64\`,
\`complex64\` and \`complex128\`.


Both \`a\` and \`b\` must have the same rank. Broadcasting is not supported. If they
have rank 3, each batch of 2D CSRSparseMatrices within \`a\` and \`b\` must have the
same dense shape.


The sparse matrix product may have numeric (non-structural) zeros.
TODO(anudhyan): Consider adding a boolean attribute to control whether to prune
zeros.


Usage example:

    from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops
     
         a_indices = np.array([[0, 0], [2, 3], [2, 4], [3, 0]])
         a_values = np.array([1.0, 5.0, -1.0, -2.0], np.float32)
         a_dense_shape = [4, 5]
     
         b_indices = np.array([[0, 0], [3, 0], [3, 1]])
         b_values = np.array([2.0, 7.0, 8.0], np.float32)
         b_dense_shape = [5, 3]
     
         with tf.Session() as sess:
           # Define (COO format) Sparse Tensors over Numpy arrays
           a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)
           b_st = tf.sparse.SparseTensor(b_indices, b_values, b_dense_shape)
     
           # Convert SparseTensors to CSR SparseMatrix
           a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
               a_st.indices, a_st.values, a_st.dense_shape)
           b_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
               b_st.indices, b_st.values, b_st.dense_shape)
     
           # Compute the CSR SparseMatrix matrix multiplication
           c_sm = sparse_csr_matrix_ops.sparse_matrix_sparse_mat_mul(
               a=a_sm, b=b_sm, type=tf.float32)
     
           # Convert the CSR SparseMatrix product to a dense Tensor
           c_sm_dense = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense(
               c_sm, tf.float32)
           # Evaluate the dense Tensor value
           c_sm_dense_value = sess.run(c_sm_dense)
     
\`c_sm_dense_value\` stores the dense matrix product:

    [[  2.   0.   0.]
          [  0.   0.   0.]
          [ 35.  40.   0.]
          [ -4.   0.   0.]]
     
a: A \`CSRSparseMatrix\`. b: A \`CSRSparseMatrix\` with the same type and rank as \`a\`. type: The type of both \`a\` and \`b\`. transpose_a: If True, \`a\` transposed before multiplication. transpose_b: If True, \`b\` transposed before multiplication. adjoint_a: If True, \`a\` adjointed before multiplication. adjoint_b: If True, \`b\` adjointed before multiplication.

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

### Nested Classes

|---|---|---|---|
| class | [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) || Optional attributes for `https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul` |

### Public Methods

|---|---|
| static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) | [adjointA](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#adjointA(java.lang.Boolean))(Boolean adjointA) |
| static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) | [adjointB](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#adjointB(java.lang.Boolean))(Boolean adjointB) |
| [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Object\> | [asOutput](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#asOutput())() Returns the symbolic handle of a tensor. |
| [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<?\> | [c](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#c())() A CSRSparseMatrix. |
| static \<T\> [SparseMatrixSparseMatMul](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul) | [create](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand<?>,%20org.tensorflow.Operand<?>,%20java.lang.Class<T>,%20org.tensorflow.op.core.SparseMatrixSparseMatMul.Options...))([Scope](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<?\> a, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<?\> b, Class\<T\> type, [Options...](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) options) Factory method to create a class wrapping a new SparseMatrixSparseMatMul operation. |
| static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) | [transposeA](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#transposeA(java.lang.Boolean))(Boolean transposeA) |
| static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) | [transposeB](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul#transposeB(java.lang.Boolean))(Boolean transposeB) |

### Inherited Methods

From class [org.tensorflow.op.PrimitiveOp](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp)

|---|---|
| final boolean | [equals](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |
| final int | [hashCode](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |
| [Operation](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operation) | [op](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying `https://www.tensorflow.org/api_docs/java/org/tensorflow/Operation` |
| final String | [toString](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |

From class java.lang.Object

|---|---|
| boolean | equals(Object arg0) |
| final Class\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| String | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

From interface [org.tensorflow.Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)

|---|---|
| abstract [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Object\> | [asOutput](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |

## Public Methods

#### public static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options)
**adjointA**
(Boolean adjointA)

<br />

##### Parameters

| adjointA | Indicates whether \`a\` should be conjugate-transposed. |
|---|---|

#### public static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options)
**adjointB**
(Boolean adjointB)

<br />

##### Parameters

| adjointB | Indicates whether \`b\` should be conjugate-transposed. |
|---|---|

#### public [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Object\>
**asOutput**
()

Returns the symbolic handle of a tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is
used to obtain a symbolic handle that represents the computation of the input.

<br />

#### public [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<?\>
**c**
()

A CSRSparseMatrix.

#### public static [SparseMatrixSparseMatMul](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul)
**create**
([Scope](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<?\> a, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<?\> b, Class\<T\> type, [Options...](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options) options)

Factory method to create a class wrapping a new SparseMatrixSparseMatMul operation.

##### Parameters

| scope | current scope |
| a | A CSRSparseMatrix. |
| b | A CSRSparseMatrix. |
| options | carries optional attributes values |
|---|---|

##### Returns

- a new instance of SparseMatrixSparseMatMul

#### public static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options)
**transposeA**
(Boolean transposeA)

<br />

##### Parameters

| transposeA | Indicates whether \`a\` should be transposed. |
|---|---|

#### public static [SparseMatrixSparseMatMul.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseMatMul.Options)
**transposeB**
(Boolean transposeB)

<br />

##### Parameters

| transposeB | Indicates whether \`b\` should be transposed. |
|---|---|