Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A minimal PythonObject configuration for the SciPy package
ResourceFunction["PythonObject"][…,"Configuration"→ResourceFunction["SciPyObject"]] returns a PythonObject with a special configuration for the Python package SciPy. |
Create a Python object for the SciPy's compressed sparse row matrix:
In[1]:= | ![]() |
Out[1]= | ![]() |
Define a sparse matrix in Python:
In[2]:= | ![]() |
Out[2]= | ![]() |
Convert the Python object to SparseArray:
In[3]:= | ![]() |
Out[3]= | ![]() |
Display in the dense form:
In[4]:= | ![]() |
Out[37]= | ![]() |
Clean up by closing the Python session:
In[38]:= | ![]() |
The resource function ProbNumObject uses the SciPyObject configuration for sparse matrices:
In[39]:= | ![]() |
Out[39]= | ![]() |
Use Python's random number generator:
In[40]:= | ![]() |
Out[40]= | ![]() |
Create a random sparse symmetric positive definite matrix with ProbNumObject:
In[41]:= | ![]() |
Out[41]= | ![]() |
Convert the Python-side matrix to SparseArray:
In[42]:= | ![]() |
Out[42]= | ![]() |
Display in the dense form:
In[43]:= | ![]() |
Out[89]= | ![]() |
Clean up by closing the Python session:
In[90]:= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License