commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otmar Ertl <otmar.e...@gmail.com>
Subject Re: [math] Matrix parallel operations
Date Sat, 02 Jan 2016 16:33:32 GMT
On Sat, Jan 2, 2016 at 4:38 AM, Ole Ersoy <ole.ersoy@gmail.com> wrote:
> Hi,
>
> Hope ya'll are having an awesome new year!
>
> Some matrix operations, like createRealIdentityMatrix can be turned into one
> liners like this:
>
>        IntStream.range(0, dimension).forEach(i -> m.setEntry(i, i, 1.0));
>
> And can be performed in parallel like this:
>         IntStream.range(0, dimension).parallel().forEach(i -> m.setEntry(i,
> i, 1.0));
>
> Applying that approach in general we could probably create a
> ParallelXxxRealMatrix fairly easily.   Just thought I'd float the idea.
>
> Cheers,
> Ole
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

Once we go for Java 8, yes. However, all these constructs have some
overhead. I doubt that the naive parallelization using parallel() is
faster than the sequential counterpart, especially for operations such
as matrix initializations. A more efficient parallel implementation
would require the definition of a Spliterator that divides an
operation into less but larger chunks of work in order to amortize
synchronization costs. In general, the implementation of efficient and
well scaling parallel matrix operations requires more work than
writing just a single line of code.

Otmar

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message