numpy.ma.dot#

ma.dot(a,b,strict=False,out=None)[source]#

Return the dot product of two arrays.

This function is the equivalent ofnumpy.dot that takes masked valuesinto account. Note thatstrict andout are in different positionthan in the method version. In order to maintain compatibility with thecorresponding method, it is recommended that the optional arguments betreated as keyword only. At some point that may be mandatory.

Parameters:
a, bmasked_array_like

Inputs arrays.

strictbool, optional

Whether masked data are propagated (True) or set to 0 (False) forthe computation. Default is False. Propagating the mask means thatif a masked value appears in a row or column, the whole row orcolumn is considered masked.

outmasked_array, optional

Output argument. This must have the exact kind that would be returnedif it was not used. In particular, it must have the right type, must beC-contiguous, and its dtype must be the dtype that would be returnedfordot(a,b). This is a performance feature. Therefore, if theseconditions are not met, an exception is raised, instead of attemptingto be flexible.

See also

numpy.dot

Equivalent function for ndarrays.

Examples

>>>importnumpyasnp>>>a=np.ma.array([[1,2,3],[4,5,6]],mask=[[1,0,0],[0,0,0]])>>>b=np.ma.array([[1,2],[3,4],[5,6]],mask=[[1,0],[0,0],[0,0]])>>>np.ma.dot(a,b)masked_array(  data=[[21, 26],        [45, 64]],  mask=[[False, False],        [False, False]],  fill_value=999999)>>>np.ma.dot(a,b,strict=True)masked_array(  data=[[--, --],        [--, 64]],  mask=[[ True,  True],        [ True, False]],  fill_value=999999)
On this page