To explain that better, with an example: public Matrix Matrix.times(Matrix input);
The standard implementation uses this.like() to create an output matrix and populates it. If the input matrix is sparse, the output should have the same sparse implementation because X times 0 = 0. So, RandomVector and RandomMatrix should use input.like() in this case. On Sat, Nov 20, 2010 at 8:49 PM, Lance Norskog <[email protected]> wrote: > Ok. The use case is read-only random Vector & Matrix classes. They > return the same value for each position. They take no space. > Matrix.like() could make whatever you want: Dense, Sparse, whatever. > > https://issues.apache.org/jira/browse/MAHOUT-550 > > Please have a look and tell me if this is on the right track. > > On Fri, Nov 19, 2010 at 8:44 AM, Jeff Eastman <[email protected]> wrote: >> +1 Seems sensible to me too >> >> -----Original Message----- >> From: Ted Dunning [mailto:[email protected]] >> Sent: Friday, November 19, 2010 8:12 AM >> To: [email protected] >> Subject: Re: Matrix and Vector classes: Read-only semantics >> >> What it really means is fail or return something sensible. I think your >> interpretation >> is pretty sensible. >> >> On Fri, Nov 19, 2010 at 1:28 AM, Lance Norskog <[email protected]> wrote: >> >>> Here's the problem: "empty" means writable. A read-only class cannot >>> do this. I think the semantics meant are: "return a writable Vector >>> with the same dense/sparse styleas this Vector": a dense read-only >>> vector class would create a DenseVector, for example. >>> >>> Yes? No? >>> >> > > > > -- > Lance Norskog > [email protected] > -- Lance Norskog [email protected]
