**Table of Content**

**Search clouds**

**Licenses**

**Author's resources**

You are a guest. Restricted access. Read more.

The SCaVis contains many high-performance Java packages to construct random matrices. Please read this section which shows how to define matrices.

- LinearAlgebra - A Native jHPlot Linear Algebra package
- Jama - A Java Matrix Package
- ParallelColt - high-performance calculations on multiple cores
- EJML - Efficient Java Matrix Library

In this example we will illustrate the capabilities of the EJML library. Let us create a 20×20 matrix with random numbers between -10 and 10. The script below generates this matrix and visualize it:

You are not full member and have a limited access to this section.
One can unlock this part after becoming a full member.

This is the generated image. Block means an element is zero. Red positive and blue negative, while more intense the color larger the element's absolute value is.

For more information how to generate random matrices, read ` RandomMatrices`

class.

Matrix creation and manipulation can be fully multithreaded. In this approach, all processing cores of your computer will be used for calculations (or only a certain number of core as you have specified). Below we give a simple example. In the example below we create a large matrix 2000×2000 and calculate various characteristics of such matrix (cardinality, vectorize). We compare single threaded calculations with multithreaded ones (in this case, we set the number of cores to 2, but feel free to set to a large value).

To build random 2D matrices use `DoubleFactory2D`

class. Here is a short example to create
1000×1000 matrix and fill it with random numbers:

from cern.colt.matrix import * from edu.emory.mathcs.utils import ConcurrencyUtils ConcurrencyUtils.setNumberOfThreads(4) # set 4 numbers of threads M=tdouble.DoubleFactory2D.dense.random(1000, 1000) # random matrix

In the example below we create a large matrix 2000×2000 and calculate various characteristics of such matrix (cardinality, vectorize). We compare single threaded calculations with multithreaded ones (in this case, we set the number of cores to 2, but feel free to set to a large value).

You are not full member and have a limited access to this section.
One can unlock this part after becoming a full member.

This example shows the the speed of the calculations is inversely propositional to the number of processing cores.

— *Sergei Chekanov 2010/03/07 16:37*