WIP: Masked arrays

Before I start implementing all the operations for masked arrays, it'd be great if someone (e.g. @nouiz) could let me know whether this is correct i.e. whether the files are in the correct place, whether I derived from the correct classes, etc. This is my first attempt at a PR to Theano, so I'm not sure how some things should be done.
Sound good.

On Sat, Oct 25, 2014 at 8:21 AM, Bart van Merriënboer <
notifications@github.com> wrote:

> In theano/masked/type.py:
>
> > +        self.ttype = ttype
> > +        self.mask_ttype = TensorType('int8', ttype.broadcastable)
> > +
> > +    def __str__(self):
> > +        return 'Masked{}'.format(self.ttype)
> > +
> > +    def filter(self, x, strict=False, allow_downcast=None):
> > +        if strict:
> > +            if not isinstance(x, np.ma.MaskedArray):
> > +                raise TypeError('Expected a masked array')
> > +        if allow_downcast:
> > +            x = np.ma.array(theano._asarray(x.data, dtype=self.dtype),
> > +                            mask=x.mask)
> > +        if self.ttype.is_valid_value(x.data):
> > +            # TODO Check mask for validity?
> > +            return np.ma.array(x.data, mask=x.mask)
>
> The thing here is that self.mask_ttype.is_valid_value(x.mask) will return
> False because x.mask.dtype = bool while mask_ttype.dtype = int8. Can I do
> self.mask_ttype.is_valid_value(x.mask.view('int8')?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Theano/Theano/pull/2209/files#r19375138>.
>