こんにちは、私はここの初心者です。
次のマトリックスを出力するオープン ソース ライブラリ (Matrix Toolkits for Java) の次のコードを使用しています。
1000 1000 5
3 5 1.000000000000e+00
1000,1000,5 を返す文字列分割を実行しようとしています。
使ってみた String[] parts = str.trim().split("\\s");
しかし、\s を文字列トークンとして使用するのは間違っているようです。代わりに何を使用すればよいでしょうか?
どうもありがとう!
public String toString() {
// Output into coordinate format. Indices start from 1 instead of 0
Formatter out = new Formatter();
out.format("%10d %10d %19d\n", numRows, numColumns, Matrices
.cardinality(this));
for (MatrixEntry e : this)
if (e.get() != 0)
out.format("%10d %10d % .12e\n", e.row() + 1, e.column() + 1, e
.get());
return out.toString();
}