.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\normalize.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_normalize.py: Row-wise Matrix Normalization Example ===================================== Normalize each row of a matrix by dividing by its L2 norm. .. GENERATED FROM PYTHON SOURCE LINES 7-25 .. rst-class:: sphx-glr-script-out .. code-block:: none Input matrix: [[1 2 3] [4 5 6]] Row-wise normalized matrix normalize(x): [[0.26726124 0.53452248 0.80178373] [0.45584231 0.56980288 0.68376346]] | .. code-block:: Python import numpy as np from spheresmooth import normalize # Example matrix (2 × 3) x = np.array([ [1, 2, 3], [4, 5, 6] ]) print("Input matrix:") print(x) # Row-wise normalization x_norm = normalize(x) print("\nRow-wise normalized matrix normalize(x):") print(x_norm) .. _sphx_glr_download_auto_examples_normalize.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: normalize.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: normalize.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: normalize.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_