I assume that your matrix is not sparse, you cannot use float instead of double, and that there is really no way to allocate the required memory to your JVM. In this case you should create a binary file on disk:
- Code: Select all
Matrix m = new DenseFileMatrix2D(new File("myfile.dat"), 10000, 10000);
This will create a file with exactly 800MB with one double for every 8 Bytes. If possible, you should read and write the data starting from the first row to the last, otherwise seeking in the file will slow down performance.
CSV files are only supported for reading, and I guess this is related to your second question: Of course it is possible to convert a double without loss into a String, the same happens for BigDecimal in Java. But - and this is the problem if UJMP would try to write to a CSV file - all columns would have to have the same width in this case, to ensure that no data from the next column is overwritten, when a longer String must be stored. For reading, UJMP builds an index of the file, so the columns can have different widths, as is common in CSV files. Don't know if this has become clear.
Yes, the basic matrix operations plus, minus, scale, multiply and transpose can take advantage of multi-core CPUs. They do this for some matrix implementations when the matrix is sufficiently large, so that the overhead for creating threads is small compared to the performance gain.
Note however, that this will probably not bring a performance gain for your matrix on disk, as the HDD is the bottleneck. To prevent this, you can do:
- Code: Select all
UJMPSettings.setNumberOfThreads(1);