Class MrClass
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
The masked counterpart of r_ — NumPy's numpy.ma.mr_ (an MAxisConcatenator):
concatenates masked arrays / slices / scalars along the first axis, propagating the mask, with the SAME
slice-expression grammar as r_ (a colon-string is a slice, a leading directive string
sets axis/ndmin/matrix — the library-wide convention). Reach for it to stitch masked pieces together
the way np.r_ stitches plain arrays.
public sealed class MrClass
- Inheritance
-
MrClass
- Inherited Members
Remarks
Not structured-blocked. The audit long listed mr_ under the structured/record family;
that was wrong. NumPy's MAxisConcatenator is structured only in its de-activated matrix-string
path — its real job is masked concatenation, which composes cleanly here.
How it works. The result DATA is exactly np.r_[key] over the same entries (a masked entry
contributes its data); the result MASK is np.r_[maskKey] where each entry is replaced by
its boolean-mask contribution of the SAME natural shape (a masked entry → its full mask, a plain
array/scalar → all-False, a colon-slice → all-False of the arange's shape, a directive string passes
through). Because both streams run the identical np.r_ grammar, every directive (axis / ndmin /
r/c matrix) lays the mask out to match the data. When NO entry carries a mask the result
is nomask (the fast path), exactly as the sibling stacking wrappers do.
Lone string → MAError. NumPy's mr_ rejects a lone string key (its dangerous
frame-based matrix builder) with MAError("Unavailable for masked array."); reproduced verbatim.
A lone masked array / scalar, or any multi-entry key, is fine.
One documented divergence. A colon-slice entry combined with a trans1d directive
("axis,ndmin,trans1d" with trans1d != -1) lays the DATA out via np.r_'s slice
branch but the MASK via its array branch, whose axis permutations differ only in that rare case; every
realistic usage (concatenation, scalars, axis and matrix directives, ndmin with the default
trans1d=-1) is bit-exact.
https://numpy.org/doc/stable/reference/generated/numpy.ma.mr_.html
Properties
this[object[]]
Expands and concatenates the masked index expression along the first axis.
public NDMaskedArray this[params object[] key] { get; }
Parameters
keyobject[]Masked arrays, plain arrays, scalars, slice-expression strings and leading directive strings — in any mix, following r_'s grammar.
Property Value
- NDMaskedArray
A NDMaskedArray whose data is
np.r_[key]and whose mask is the matching concatenation of the entries' masks (or nomask when none is masked).
Exceptions
- ArgumentNullException
key(or an entry) is null.- MAError
keyis a lone string (NumPy's rejection).