Skip to content

Commit

Permalink
Mention the mattress.h header in the docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Dec 13, 2024
1 parent 98ea078 commit 34f1054
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/mattress/InitializedMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ def _factorize(group):


class InitializedMatrix:
"""Pointer to an initialized ``tatami::matrix``, for use in C++ code.
"""Pointer to an object containing a ``tatami::Matrix``, typically
generated by :py:func:`~initialize.initialize` for use in C++ code.
Instances of this class should only be created by developers and used
within package functions; this is done by passing the :py:attr:`~ptr`
address to C++ and casting it to a ``mattress::BoundMatrix``. All
``InitializedMatrix`` instances are expected to be transient within a
Python session; they should not be serialized, nor should they be visible
to end users. Each instance will automatically free the C++-allocated
memory upon garbage collection.
address to C++ and casting it to a pointer to a ``mattress::BoundMatrix``
(see the ``mattress.h`` header). All ``InitializedMatrix`` instances are
expected to be transient within a Python session; they should not be
serialized, nor should they be visible to end users. Each instance will
automatically free the C++-allocated memory upon garbage collection.
"""

def __init__(self, ptr: int):
Expand Down Expand Up @@ -66,9 +67,9 @@ def shape(self) -> Tuple[int, int]:
return lib.extract_dim(self._ptr)

@property
def ptr(self):
"""An address to a ``mattress::BoundMatrix`` instance, to be passed
as a ``uintptr_t`` to C++ for casting."""
def ptr(self) -> int:
"""Address to a ``mattress::BoundMatrix`` instance, to be passed as a
``uintptr_t`` to C++ - see the ``mattress.h`` header."""
return self._ptr

@property
Expand Down

0 comments on commit 34f1054

Please sign in to comment.