Warning: This API is deprecated and will be removed in a future
version of TensorFlow after
the replacement is stable.
SparseMatrixSparseCholesky
Stay organized with collections
Save and categorize content based on your preferences.
Computes the sparse Cholesky decomposition of `input`.
Computes the Sparse Cholesky decomposition of a sparse matrix, with the given
fill-in reducing permutation.
The input sparse matrix and the fill-in reducing permutation `permutation` must
have compatible shapes. If the sparse matrix has rank 3; with the batch
dimension `B`, then the `permutation` must be of rank 2; with the same batch
dimension `B`. There is no support for broadcasting.
Furthermore, each component vector of `permutation` must be of length `N`,
containing each of the integers {0, 1, ..., N - 1} exactly once, where `N` is
the number of rows of each component of the sparse matrix.
Each component of the input sparse matrix must represent a symmetric positive
definite (SPD) matrix; although only the lower triangular part of the matrix is
read. If any individual component is not SPD, then an InvalidArgument error is
thrown.
The returned sparse matrix has the same dense shape as the input sparse matrix.
For each component `A` of the input sparse matrix, the corresponding output
sparse matrix represents `L`, the lower triangular Cholesky factor satisfying
the following identity:
A = L * Lt
where Lt denotes the transpose of L (or its conjugate transpose, if `type` is
`complex64` or `complex128`).
The `type` parameter denotes the type of the matrix elements. The supported
types are: `float32`, `float64`, `complex64` and `complex128`.
Usage example:
from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops
a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]])
a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32)
a_dense_shape = [4, 4]
with tf.Session() as sess:
# Define (COO format) SparseTensor over Numpy array.
a_st = tf.sparse.SparseTensor(a_indices, a_values, a_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)
# Obtain the Sparse Cholesky factor using AMD Ordering for reducing zero
# fill-in (number of structural non-zeros in the sparse Cholesky factor).
ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix)
cholesky_sparse_matrices = (
sparse_csr_matrix_ops.sparse_matrix_sparse_cholesky(
sparse_matrix, ordering_amd, type=tf.float32))
# Convert the CSRSparseMatrix Cholesky factor to a dense Tensor
dense_cholesky = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense(
cholesky_sparse_matrices, tf.float32)
# Evaluate the dense Tensor value.
dense_cholesky_value = sess.run(dense_cholesky)
`dense_cholesky_value` stores the dense Cholesky factor:
[[ 1. 0. 0. 0.]
[ 0. 1.41 0. 0.]
[ 0. 0.70 1.58 0.]
[ 0. 0. 0. 2.]]
input: A `CSRSparseMatrix`.
permutation: A `Tensor`.
type: The type of `input`.
Inherited Methods
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()
|
Public Methods
public
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.
Factory method to create a class wrapping a new SparseMatrixSparseCholesky operation.
Parameters
scope |
current scope |
input |
A `CSRSparseMatrix`. |
permutation |
A fill-in reducing permutation matrix. |
Returns
- a new instance of SparseMatrixSparseCholesky
public
Output<?>
output
()
The sparse Cholesky decompsition of `input`.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-02-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-02-12 UTC."],[],[],null,["# SparseMatrixSparseCholesky\n\npublic final class **SparseMatrixSparseCholesky** \nComputes the sparse Cholesky decomposition of \\`input\\`.\n\n\nComputes the Sparse Cholesky decomposition of a sparse matrix, with the given\nfill-in reducing permutation.\n\n\nThe input sparse matrix and the fill-in reducing permutation \\`permutation\\` must\nhave compatible shapes. If the sparse matrix has rank 3; with the batch\ndimension \\`B\\`, then the \\`permutation\\` must be of rank 2; with the same batch\ndimension \\`B\\`. There is no support for broadcasting.\n\n\nFurthermore, each component vector of \\`permutation\\` must be of length \\`N\\`,\ncontaining each of the integers {0, 1, ..., N - 1} exactly once, where \\`N\\` is\nthe number of rows of each component of the sparse matrix.\n\n\nEach component of the input sparse matrix must represent a symmetric positive\ndefinite (SPD) matrix; although only the lower triangular part of the matrix is\nread. If any individual component is not SPD, then an InvalidArgument error is\nthrown.\n\n\nThe returned sparse matrix has the same dense shape as the input sparse matrix.\nFor each component \\`A\\` of the input sparse matrix, the corresponding output\nsparse matrix represents \\`L\\`, the lower triangular Cholesky factor satisfying\nthe following identity: \n\n A = L * Lt\n \nwhere Lt denotes the transpose of L (or its conjugate transpose, if \\`type\\` is \\`complex64\\` or \\`complex128\\`).\n\n\nThe \\`type\\` parameter denotes the type of the matrix elements. The supported\ntypes are: \\`float32\\`, \\`float64\\`, \\`complex64\\` and \\`complex128\\`.\n\n\nUsage example: \n\n from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops\n \n a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]])\n a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32)\n a_dense_shape = [4, 4]\n \n with tf.Session() as sess:\n # Define (COO format) SparseTensor over Numpy array.\n a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)\n \n # Convert SparseTensors to CSR SparseMatrix.\n a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(\n a_st.indices, a_st.values, a_st.dense_shape)\n \n # Obtain the Sparse Cholesky factor using AMD Ordering for reducing zero\n # fill-in (number of structural non-zeros in the sparse Cholesky factor).\n ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix)\n cholesky_sparse_matrices = (\n sparse_csr_matrix_ops.sparse_matrix_sparse_cholesky(\n sparse_matrix, ordering_amd, type=tf.float32))\n \n # Convert the CSRSparseMatrix Cholesky factor to a dense Tensor\n dense_cholesky = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense(\n cholesky_sparse_matrices, tf.float32)\n \n # Evaluate the dense Tensor value.\n dense_cholesky_value = sess.run(dense_cholesky)\n \n\\`dense_cholesky_value\\` stores the dense Cholesky factor: \n\n [[ 1. 0. 0. 0.]\n [ 0. 1.41 0. 0.]\n [ 0. 0.70 1.58 0.]\n [ 0. 0. 0. 2.]]\n \ninput: A \\`CSRSparseMatrix\\`. permutation: A \\`Tensor\\`. type: The type of \\`input\\`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cObject\\\u003e | [asOutput](/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseCholesky#asOutput())() Returns the symbolic handle of a tensor. |\n| static \\\u003cT\\\u003e [SparseMatrixSparseCholesky](/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseCholesky) | [create](/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseCholesky#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand\u003c?\u003e,%20org.tensorflow.Operand\u003cjava.lang.Integer\u003e,%20java.lang.Class\u003cT\u003e))([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e input, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cInteger\\\u003e permutation, Class\\\u003cT\\\u003e type) Factory method to create a class wrapping a new SparseMatrixSparseCholesky operation. |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e | [output](/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseCholesky#output())() The sparse Cholesky decompsition of \\`input\\`. |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.op.PrimitiveOp](/api_docs/java/org/tensorflow/op/PrimitiveOp) \n\n|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| final boolean | [equals](/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |\n| final int | [hashCode](/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |\n| [Operation](/api_docs/java/org/tensorflow/Operation) | [op](/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying [Operation](/api_docs/java/org/tensorflow/Operation) |\n| final String | [toString](/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [org.tensorflow.Operand](/api_docs/java/org/tensorflow/Operand) \n\n|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| abstract [Output](/api_docs/java/org/tensorflow/Output)\\\u003cObject\\\u003e | [asOutput](/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |\n\nPublic Methods\n--------------\n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cObject\\\u003e\n**asOutput**\n()\n\nReturns the symbolic handle of a tensor.\n\nInputs to TensorFlow operations are outputs of another TensorFlow operation. This method is\nused to obtain a symbolic handle that represents the computation of the input.\n\n\u003cbr /\u003e\n\n#### public static [SparseMatrixSparseCholesky](/api_docs/java/org/tensorflow/op/core/SparseMatrixSparseCholesky)\n**create**\n([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e input, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cInteger\\\u003e permutation, Class\\\u003cT\\\u003e type)\n\nFactory method to create a class wrapping a new SparseMatrixSparseCholesky operation. \n\n##### Parameters\n\n| scope | current scope |\n| input | A \\`CSRSparseMatrix\\`. |\n| permutation | A fill-in reducing permutation matrix. |\n|-------------|----------------------------------------|\n\n##### Returns\n\n- a new instance of SparseMatrixSparseCholesky \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e\n**output**\n()\n\nThe sparse Cholesky decompsition of \\`input\\`."]]