|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.mklab.nfc.matrix.DoubleMatrixUtil
public final class DoubleMatrixUtil
倍精度(double)型の実行列のユーティリティクラスです。
メソッドの概要 | |
---|---|
static double[][] |
absElementWise(double[][] matrix)
全ての成分の絶対値を成分とする行列を生成します。 |
static double[][] |
add(double[][] a1,
double[][] a2)
行列の和行列を生成します。 |
static double[][] |
addElementWise(double[][] matrix,
double scalar)
行列の全ての成分に実数を加えた行列を生成します。 |
static double[] |
addElementWise(double[] vector,
double scalar)
ベクトル全ての成分に実数を加えたベクトルを生成します。 |
static void |
addSelf(double[][] a1,
double[][] a2)
第1行列に第2行列を加えます。 |
static boolean |
anyZero(double[] vector)
少なくとも1個は零の成分がベクトルに含まれるか判定します。 |
static boolean |
anyZero(double[][] matrix)
少なくとも1個は零の成分が行列に含まれるか判定します。 |
static boolean |
anyZero(double[][] matrix,
double tolerance)
少なくとも1個は絶対値が許容誤差以下である成分が行列に含まれるか判定します。 |
static boolean |
anyZero(double[] vector,
double tolerance)
少なくとも1個は絶対値が許容誤差以下である成分がベクトルに含まれるか判定します。 |
static double[][] |
appendDown(double[][] a1,
double[][] a2)
2個の行列を縦に接続した行列を生成します。 |
static double[][] |
appendRight(double[][] a1,
double[][] a2)
2個の行列を横に接続した行列を生成します。 |
static double[][] |
appendRight(double[] a1,
double[][] a2)
ベクトルの右側に行列を接続した行列を生成します。 |
static double[] |
clone(double[] vector)
ベクトルの複製を生成します。 |
static double[][] |
clone(double[][] matrix)
行列の複製を生成します。 |
static boolean[][] |
compareElements(double[][] matrix,
String operator,
double opponent)
各成分とvalueをoperatorで指定された演算子で比較し、 計算結果を成分とする行列を生成します。 |
static boolean[][] |
compareElements(double[][] a1,
String operator,
double[][] a2)
2個の行列を成分毎にoperatorで指定された演算子で比較し、 計算結果を成分とする行列を生成します。 |
static boolean[][] |
compareElements(double[][] a1,
String operator,
int[][] a2)
2個の行列を成分毎にoperatorで指定された演算子で比較し、 計算結果を成分とする行列を生成します。 |
static boolean[][] |
compareElements(double[][] matrix,
String operator,
Scalar<?> opponent)
各成分とvalueをoperatorで指定された演算子で比較し、 計算結果を成分とする行列を生成します。 |
static void |
copy(double[][] source,
double[][] destination)
行列の成分をコピーします。 |
static void |
copy(double[] source,
double[] destination)
行列の成分をコピーします。 |
static void |
copy(int[][] source,
double[][] destination)
行列の成分をコピーします。 |
static void |
copy(int[] source,
double[] destination)
行列の成分をコピーします。 |
static double[][] |
covariance(double[][] a1,
double[][] a2)
共分散行列を生成します。 |
static double[][] |
createArray(int[][] matrix)
整数行列を実数行列に変換します。 |
static double[][] |
createNormalRandom(int rowSize,
int columnSize)
平均0、分散1の正規分布の乱数を成分とする行列を生成します。 |
static double[][] |
createNormalRandom(int rowSize,
int columnSize,
long seed)
平均0、分散1の正規分布の乱数を成分とする行列を生成します。 |
static double[][] |
createOnes(int rowSize,
int columnSize)
全ての成分が1である行列を生成します。 |
static double[][] |
createUniformRandom(int rowSize,
int columnSize)
0〜1の範囲の一様分布の乱数を成分とする行列を生成します。 |
static double[][] |
createUniformRandom(int rowSize,
int columnSize,
long seed)
0〜1の範囲の一様分布の乱数を成分とする行列を生成します。 |
static double[][] |
createUnit(int rowSize,
int columnSize)
単位行列を生成します。 |
static double[][] |
cumulativeProduct(double[][] matrix)
全ての成分の累積積を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
cumulativeProductColumnWise(double[][] matrix)
列毎に累積積を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
cumulativeProductRowWise(double[][] matrix)
行毎に累積積を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
cumulativeSum(double[][] matrix)
全ての成分の累積和を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
cumulativeSumColumnWise(double[][] matrix)
列毎に累積和を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
cumulativeSumRowWise(double[][] matrix)
行毎に累積和を計算し、計算結果を成分とする行列を生成します。 |
static double[] |
decrement(double[] vector)
全ての成分を1だけ減少させたベクトルを生成します。 |
static double[][] |
decrement(double[][] matrix)
全ての成分を1だけ減少させた行列を生成します。 |
static double[][] |
diagonalToVector(double[][] matrix)
対角成分からなる縦ベクトルを生成します。 |
static double[][] |
divide(double[][] matrix,
double scalar)
成分を実数で割った値を成分とする行列を生成します。 |
static double[][] |
divide(double[][] matrix,
int scalar)
成分を整数で割った値を成分とする行列を生成します。 |
static double[] |
divide(double[] vector,
double scalar)
成分を実数で割った値を成分とする行列を生成します。 |
static double[][] |
divideElementWise(double[][] a1,
double[][] a2)
成分毎の割り算の結果を成分とする行列を生成します。 |
static boolean[][] |
elementWiseFunction(double[][] matrix,
org.mklab.nfc.matrix.BooleanFunction function)
成分毎に関数の計算をし、計算結果を成分とする行列を生成します。 |
static boolean[][] |
elementWiseFunction(double[][] a1,
double[][] a2,
org.mklab.nfc.matrix.BooleanFunctionWithTwoArguments function)
成分毎に関数の計算をし、計算結果を成分とする行列を生成します。 |
static double[][] |
elementWiseFunction(double[][] a1,
double[][] a2,
org.mklab.nfc.matrix.DoubleRealFunctionWithTwoArguments function)
成分毎に関数の計算をし、計算結果を成分とする行列を生成します。 |
static boolean[][] |
elementWiseFunction(double[][] matrix,
double d2,
org.mklab.nfc.matrix.BooleanFunctionWithTwoArguments function)
成分毎に関数の計算をし、計算結果を成分とする行列を生成します。 |
static double[][] |
elementWiseFunction(double[][] matrix,
double d2,
org.mklab.nfc.matrix.DoubleRealFunctionWithTwoArguments function)
成分毎に関数の計算をし、計算結果を成分とする行列を生成します。 |
static double[][] |
elementWiseFunction(double[][] matrix,
org.mklab.nfc.matrix.DoubleRealFunction function)
成分毎に関数の計算をし、計算結果を成分とする行列を生成します。 |
static boolean |
equals(double[][] a1,
double[][] a2)
2個の配列の成分が全て等しか判定します。 |
static boolean |
equals(double[][] a1,
double[][] a2,
double tolerance)
2個の配列の成分の差の絶対値が許容誤差以下であるか判定します。 |
static boolean |
equals(double[] a1,
double[] a2)
2個の配列の成分が全て等しか判定します。 |
static boolean |
equals(double[] a1,
double[] a2,
double tolerance)
2個の配列の成分の差の絶対値が許容誤差以下であるか判定します。 |
static void |
exchangeColumn(double[][] matrix,
int column1,
int column2)
column1列とcolumn2列を入れ替えます。 |
static void |
exchangeRow(double[][] matrix,
int row1,
int row2)
row1行とrow2行を入れ替えます。 |
static double |
frobNorm(double[][] matrix)
行列のフロベニウスノムルを返します。 |
static double[][] |
frobNormColumnWise(double[][] matrix)
列毎のフロベニウスノムルを成分とする行ベクトルを返します。 |
static double[][] |
frobNormRowWise(double[][] matrix)
行毎のフロベニウスノムルを成分とする列ベクトルを返します。 |
static double[][] |
getSubMatrix(double[][] matrix,
int[] rowIndex,
int column)
部分行列を生成します。 |
static double[][] |
getSubMatrix(double[][] matrix,
int[] rowIndex,
int[] columnIndex)
部分行列を生成します。 |
static double[][] |
getSubMatrix(double[][] matrix,
int[] rowIndex,
int columnMin,
int columnMax)
部分行列を生成します。 |
static double[][] |
getSubMatrix(double[][] matrix,
int row,
int[] columnIndex)
部分行列を生成します。 |
static double[][] |
getSubMatrix(double[][] matrix,
int rowMin,
int rowMax,
int[] columnIndex)
部分行列を生成します。 |
static double[][] |
getSubMatrix(double[][] matrix,
int rowMin,
int rowMax,
int columnMin,
int columnMax)
部分行列を生成します。 |
static double[] |
getSubVector(double[] vector,
int[] index)
部分ベクトルを生成します。 |
static double[] |
getSubVector(double[] vector,
int rowMin,
int rowMax)
部分ベクトルを生成します。 |
static double[] |
increment(double[] vector)
全ての成分を1だけ増加させたベクトルを生成します。 |
static double[][] |
increment(double[][] matrix)
全ての成分を1だけ増加させた行列を生成します。 |
static int[] |
indexOfMaximum(double[][] matrix)
最大成分の指数を求めます。 |
static int[] |
indexOfMinimum(double[][] matrix)
最小成分の指数を返します。 |
static double |
infNorm(double[][] matrix)
行列の無限大ノルムを返します。 |
static double[][] |
inverseElementWise(double[][] matrix)
行列の全ての成分の逆数を成分とする行列を生成します。 |
static boolean |
isSameSize(double[] a1,
double[] a2)
2個のベクトルの大きさが等しいか判定します。 |
static boolean |
isUnit(double[][] matrix,
double tolerance)
単位行列であるか判定します。 |
static boolean |
isUnit(double[][] matrix,
NumericalScalar<?> tolerance)
単位行列であるか判定します。 |
static boolean |
isZero(double[][] matrix,
double tolerance)
零行列であるか判定します。 |
static boolean |
isZero(double[][] matrix,
NumericalScalar<?> tolerance)
零行列であるか判定します。 |
static double[][] |
leftDivideElementWise(double[][] a1,
double[][] a2)
成分毎の割り算(左が分母、右が分子)の結果を成分とする行列を生成します。 |
static double[][] |
makeColumnVector(double[][] matrix)
各列ベクトルを縦に結合し、長い列ベクトルを生成します。 |
static double |
max(double[] vector)
ベクトルの最大成分を返します。 |
static double |
max(double[][] matrix)
行列の最大成分を返します。 |
static double[][] |
maxColumnWise(double[][] matrix)
列毎に最大値を計算し、計算結果を成分とする行ベクトルを生成します。 |
static double[][] |
maxElementWise(double[][] a1,
double[][] a2)
成分毎に大きさを比較し、大きい方を成分とする行列を生成します。 |
static Object[] |
maximum(double[][] matrix)
最大成分とその指数を返します。 |
static Object[] |
maximumColumnWise(double[][] matrix)
列毎の最大成分とその指数を返します。 |
static Object[] |
maximumRowWise(double[][] matrix)
行毎の最大成分とその指数を返します。 |
static double[][] |
maxRowWise(double[][] matrix)
行毎に最大値を計算し、計算結果を成分とする列ベクトルを生成します。 |
static double |
mean(double[][] matrix)
全ての成分の平均値を返します。 |
static double[][] |
meanColumnWise(double[][] matrix)
列毎に全ての成分の平均値を計算し、計算結果を成分とする行ベクトルを生成します。 |
static double[][] |
meanRowWise(double[][] matrix)
行毎に全ての成分の平均値を計算し、計算結果を成分とする列ベクトルを生成します。 |
static double |
median(double[][] matrix)
全ての成分のメジアンを返します。 |
static double[][] |
medianColumnWise(double[][] matrix)
列毎のメジアンを成分とする行ベクトルを生成します。 |
static double[][] |
medianRowWise(double[][] matrix)
行毎のメジアンを成分とする列ベクトルを生成します。 |
static double |
min(double[] vector)
ベクトルの最小成分を返します。 |
static double |
min(double[][] matrix)
行列の最小成分を返します。 |
static double[][] |
minColumnWise(double[][] matrix)
列毎に最小値を計算し、計算結果を成分とする行ベクトルを生成します。 |
static double[][] |
minElementWise(double[][] a1,
double[][] a2)
成分毎に大きさを比較し、小さい方を成分とする行列を生成します。 |
static Object[] |
minimum(double[][] matrix)
最小成分と指数を返します。 |
static Object[] |
minimumColumnWise(double[][] matrix)
列毎に最小成分とその指数を返します。 |
static Object[] |
minimumRowWise(double[][] matrix)
行毎の最小成分とその指数を返します。 |
static double[][] |
minRowWise(double[][] matrix)
行毎に最小値を計算し、計算結果を成分とする行ベクトルを生成します。 |
static double[][] |
multiply(double[][] matrix,
double scalar)
行列に実数を掛けた行列を生成します。 |
static double[][] |
multiply(double[][] a1,
double[][] a2)
2個の行列の積行列を生成します。 |
static double[][] |
multiply(double[][] matrix,
int scalar)
行列に整数を掛けた行列を生成します。 |
static double[][] |
multiplyElementWise(double[][] a1,
double[][] a2)
成分毎の乗算結果を成分とする行列を生成します。 |
static void |
multiplySelf(double[][] matrix,
double scalar)
行列自身に実数を掛けます。 |
static double |
norm(double[][] matrix,
NormType type)
行列のノルムを返します。 |
static double[][] |
permutateSelf(double[][] matrix,
int[] pivot,
int count,
boolean rowExchange)
行や列を交換します。 |
static double[][] |
powerElementWise(double[][] matrix,
double scalar)
行列の全ての成分毎に累乗を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
powerElementWise(double[][] a1,
double[][] a2)
行列の成分毎に累乗を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
powerElementWise(double[][] matrix,
int scalar)
全ての成分の累乗を成分とする行列を生成します。 |
static double[][] |
powerElementWise(double[][] a1,
int[][] a2)
行列の成分毎に累乗を計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
powerElementWise(double scalar,
double[][] matrix)
実数の累乗を行列の全ての成分毎に計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
powerElementWise(double scalar,
int[][] matrix)
実数の累乗を行列の全ての成分毎に計算し、計算結果を成分とする行列を生成します。 |
static double[][] |
powerElementWise(int[][] matrix,
double d)
全ての成分の累乗を成分とする行列を生成します。 |
static double[][] |
powerElementWise(int[][] a1,
double[][] a2)
行列の成分毎に累乗を計算し、計算結果を成分とする行列を生成します。 |
static void |
print(double[][] matrix,
Writer output,
String format,
GridElementAlignment alignment,
int maxColumnSize)
ライターに出力します。 |
static double |
product(double[][] matrix)
全ての成分の積を返します。 |
static double[][] |
productColumnWise(double[][] matrix)
列毎に全ての成分の積を計算し、計算結果を成分とする行ベクトルを生成します。 |
static double[][] |
productRowWise(double[][] matrix)
行毎に全ての成分の積を計算し、計算結果を成分とする列ベクトルを生成します。 |
static void |
quickSort(double[] vector,
int[] index,
int start,
int end)
ベクトルの成分を昇順にソートした結果を返します。 |
static double[][] |
readMatFormat(int rowSize,
int columnSize,
StreamTokenizer st)
ストリームトークンナイザから読み込んだ行列(MATフォーマット)を返します。 |
static double[][] |
readMxFormat(InputStream input,
MxDataHead head)
入力ストリームから読み込んだ(MXフォーマット)行列を返します。 |
static double[][] |
removeColumnVectors(double[][] matrix,
int[] columnIndex)
指定された列を削除した行列を生成します。 |
static double[][] |
removeColumnVectors(double[][] matrix,
int columnMin,
int columnMax)
指定された列を削除した行列を生成します。 |
static double[][] |
removeRowVectors(double[][] matrix,
int[] rowIndex)
指定された行を削除した行列を生成します。 |
static double[][] |
removeRowVectors(double[][] matrix,
int rowMin,
int rowMax)
指定された行を削除した行列を生成します。 |
static double[][] |
reshape(double[][] matrix,
int newRowSize,
int newColumnSize)
行列の成分を変えずに、行列の大きさ(行の数と列の数)を変形します。 |
static double[][] |
reshape(double[] vector,
int newRowSize,
int newColumnSize)
ベクトルの成分を変えずに、行列に変形します。 |
static double[][] |
resize(double[][] matrix,
int newRowSize,
int newColumnSize)
newRowSize *newColumnSize にサイズ変更します。 |
static double[] |
series(double from,
double to,
double by)
from からto までのby 飛びの実数を成分とする行ベクトルを返します。 |
static void |
setSubMatrix(double[][] destination,
int[] rowIndex,
int[] columnIndex,
double[][] source)
与えられた位置に行列を代入します。 |
static void |
setSubMatrix(double[][] destination,
int[] rowIndex,
int columnMin,
int columnMax,
double[][] source)
与えられた位置に行列を代入します。 |
static void |
setSubMatrix(double[][] destination,
int rowTo,
int columnTo,
double[][] source,
int rowMin,
int rowMax,
int columnMin,
int columnMax)
配列 to のrowTo 行columnTo 列を始点として、
配列from のrowMin 行columnMin 列から
rowMax 行columnMax 列までの値をコピーします。 |
static void |
setSubMatrix(double[][] destination,
int rowMin,
int rowMax,
int[] columnIndex,
double[][] source)
与えられた位置に行列を代入します。 |
static void |
setSubMatrix(double[][] destination,
int rowMin,
int rowMax,
int columnMin,
int columnMax,
double[][] source)
与えられた位置に行列を代入します。 |
static void |
setSubVector(double[] destination,
int to,
double[] source,
int min,
int max)
配列 destination のrowTo 行を始点として、
配列source の
rowMin 行からrowMax 行までの値をコピーします。 |
static void |
setSubVector(double[] destination,
int min,
int max,
double[] source)
与えられた位置にベクトルを代入します。 |
static void |
setZero(double[] matrix)
ベクトルの全ての成分に零を代入します。 |
static void |
setZero(double[][] matrix)
行列の全ての成分に零を代入します。 |
static org.mklab.nfc.matrix.IndexedDoubleElements |
sortColumnWise(double[][] matrix)
列毎とに昇順に並び替えた行列と元の位置を示す指数を返します。 |
static org.mklab.nfc.matrix.IndexedDoubleElements |
sortRowWise(double[][] matrix)
行毎に昇順に並び替えた行列と元の位置を示す指数を返します。 |
static double |
std(double[][] matrix)
全ての成分の標準偏差を返します。 |
static double[][] |
stdColumnWise(double[][] matrix)
列毎に標準偏差を計算し、計算結果を成分とする列ベクトルを生成します。 |
static double[][] |
stdRowWise(double[][] matrix)
行毎に標準偏差を計算し、計算結果を成分とする列ベクトルを生成します。 |
static double[][] |
subtract(double[][] a1,
double[][] a2)
行列の差行列を生成します。 |
static double[][] |
subtractElementWise(double[][] matrix,
double scalar)
行列の全ての成分から実数を引いた行列を生成します。 |
static double |
sum(double[][] matrix)
全ての成分の和を返します。 |
static double[][] |
sumColumnWise(double[][] matrix)
列毎に全ての成分の和を計算し、計算結果を成分とする行ベクトルを生成します。 |
static double[][] |
sumRowWise(double[][] matrix)
行毎に全ての成分の和を計算し、計算結果を成分とする列ベクトルを生成します。 |
static int[] |
toIntMatrix(double[] vector)
全ての実数成分を最も近い整数に丸めるた行列を生成します。 |
static String |
toMmString(double[][] matrix,
String format)
行列をMMフォーマットの文字列に変換します。 |
static double |
trace(double[][] matrix)
全対角成分の和(トレース)を返します。 |
static double[][] |
transpose(double[][] matrix)
転置行列を生成します。 |
static void |
transpose(double[][] matrix,
double[][] result)
転置行列の成分を設定します。 |
static double[][] |
unaryMinus(double[][] matrix)
成分の符号を反転した行列を生成します。 |
static double |
variance(double[][] matrix)
分散を返します。 |
static double[][] |
vectorToDiagonal(double[] vector)
ベクトルの成分を対角成分とする対角行列を生成します。 |
static void |
writeMatFormat(double[][] matrix,
OutputStream output)
出力ストリームに行列をMATフォーマットで出力します。 |
static void |
writeMatFormat(double[][] matrix,
String fileName)
指定したファイルに行列をMATフォーマットで保存します。 |
static void |
writeMxFormat(double[][] matrix,
OutputStream output,
String name)
行列を出力ストリームにMXフォーマットで出力します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
メソッドの詳細 |
---|
public static boolean equals(double[] a1, double[] a2)
a1
- 第一行列a2
- 第二行列
public static boolean equals(double[] a1, double[] a2, double tolerance)
a1
- 第一行列a2
- 第二行列tolerance
- 許容誤差
public static boolean equals(double[][] a1, double[][] a2)
a1
- 第一行列a2
- 第二行列
public static boolean equals(double[][] a1, double[][] a2, double tolerance)
a1
- 第一行列a2
- 第二行列tolerance
- 許容誤差
public static final double[][] getSubMatrix(double[][] matrix, int rowMin, int rowMax, int columnMin, int columnMax)
matrix
- 元の行列rowMin
- 始まり行(0から始まります)rowMax
- 終わり行(0から始まります)columnMin
- 始まり列(0から始まります)columnMax
- 終わり列(0から始まります)
public static final double[][] getSubMatrix(double[][] matrix, int[] rowIndex, int column)
matrix
- 元の行列rowIndex
- 該当する行の番号column
- 列番号
public static final double[][] getSubMatrix(double[][] matrix, int[] rowIndex, int columnMin, int columnMax)
matrix
- 元の行列rowIndex
- 該当する行の番号columnMin
- 始まりの列columnMax
- 終わりの列
public static final double[][] getSubMatrix(double[][] matrix, int row, int[] columnIndex)
matrix
- 元の行列row
- 行の番号columnIndex
- 該当する列の番号
public static final double[][] getSubMatrix(double[][] matrix, int rowMin, int rowMax, int[] columnIndex)
matrix
- 元の行列rowMin
- 始まりの行rowMax
- 終わりの行columnIndex
- 該当する列の番号
public static final double[][] getSubMatrix(double[][] matrix, int[] rowIndex, int[] columnIndex)
matrix
- 元の行列rowIndex
- 該当する行の番号columnIndex
- 該当する列の番号
public static final double[] getSubVector(double[] vector, int[] index)
vector
- 元のベクトルindex
- 該当する行の番号
public static final double[] getSubVector(double[] vector, int rowMin, int rowMax)
vector
- 元のベクトルrowMin
- 開始位置rowMax
- 終了位置
public static double[][] appendDown(double[][] a1, double[][] a2)
a1
- 上側の行列a2
- 下側の行列
public static final double[][] appendRight(double[][] a1, double[][] a2)
a1
- 左側の行列a2
- 右側の行列
public static final double[][] appendRight(double[] a1, double[][] a2)
a1
- 左側のベクトルa2
- 右側の行列
public static double[][] absElementWise(double[][] matrix)
matrix
- 元の行列
public static double[][] powerElementWise(double[][] matrix, int scalar)
matrix
- 元の行列scalar
- 累乗の指数
public static boolean anyZero(double[][] matrix)
matrix
- 判定する対象の行列
public static boolean anyZero(double[][] matrix, double tolerance)
matrix
- 判定する対象の行列tolerance
- 許容誤差
public static boolean anyZero(double[] vector)
vector
- 判定する対象のベクトル
public static boolean anyZero(double[] vector, double tolerance)
vector
- 判定する対象のベクトルtolerance
- 許容誤差
public static final double[][] clone(double[][] matrix)
matrix
- 複製の元となる行列
public static final double[] clone(double[] vector)
vector
- 複製の元となるベクトル
public static final void copy(double[][] source, double[][] destination)
source
- コピー元destination
- コピー先public static final void copy(int[][] source, double[][] destination)
source
- コピー元destination
- コピー先public static final void copy(double[] source, double[] destination)
source
- コピー元destination
- コピー先public static final void copy(int[] source, double[] destination)
source
- コピー元destination
- コピー先public static final boolean isZero(double[][] matrix, double tolerance)
matrix
- 判定する行列tolerance
- 許容誤差
public static final boolean isZero(double[][] matrix, NumericalScalar<?> tolerance)
matrix
- 判定する行列tolerance
- 許容誤差
public static final boolean isUnit(double[][] matrix, double tolerance)
matrix
- 判定する行列tolerance
- 許容誤差
public static final boolean isUnit(double[][] matrix, NumericalScalar<?> tolerance)
matrix
- 判定する行列tolerance
- 許容誤差
public static final void setZero(double[][] matrix)
matrix
- 零を代入する行列public static final void setZero(double[] matrix)
matrix
- 零を代入するベクトルpublic static final double[][] transpose(double[][] matrix)
matrix
- 元の行列
public static final void transpose(double[][] matrix, double[][] result)
matrix
- 元の行列result
- 転置行列の成分を代入する行列public static double[][] inverseElementWise(double[][] matrix)
matrix
- 元の行列
public static final void addSelf(double[][] a1, double[][] a2)
a1
- 第1行列a2
- 第2行列public static final double[][] multiply(double[][] a1, double[][] a2)
a1
- 掛けられる行列a2
- 掛ける行列
public static final double[][] createUnit(int rowSize, int columnSize)
rowSize
- 行の数columnSize
- 列の数
public static final double[][] createOnes(int rowSize, int columnSize)
rowSize
- 行の数columnSize
- 列の数
public static final double[][] createUniformRandom(int rowSize, int columnSize)
rowSize
- 行の数columnSize
- 列の数
public static final double[][] createUniformRandom(int rowSize, int columnSize, long seed)
rowSize
- 行の数columnSize
- 列の数seed
- 乱数の種
public static final double[][] createNormalRandom(int rowSize, int columnSize)
rowSize
- 行の数columnSize
- 列の数
public static final double[][] createNormalRandom(int rowSize, int columnSize, long seed)
rowSize
- 行の数columnSize
- 列の数seed
- 乱数の種
public static final double[] series(double from, double to, double by)
from
からto
までのby
飛びの実数を成分とする行ベクトルを返します。
from
- 始点to
- 終点by
- 間隔
public static final void setSubMatrix(double[][] destination, int rowTo, int columnTo, double[][] source, int rowMin, int rowMax, int columnMin, int columnMax)
to
のrowTo
行columnTo
列を始点として、
配列from
のrowMin
行columnMin
列から
rowMax
行columnMax
列までの値をコピーします。
destination
- コピー先rowTo
- 変更開始行columnTo
- 変更開始列source
- コピー元rowMin
- コピー開始行rowMax
- コピー開始列columnMin
- コピー終了行columnMax
- コピー終了列public static final void setSubMatrix(double[][] destination, int rowMin, int rowMax, int columnMin, int columnMax, double[][] source)
destination
- 値を設定する行列rowMin
- 行の始まりrowMax
- 行の終わりcolumnMin
- 列の始まりcolumnMax
- 列の終わりsource
- 設定する行列public static final void setSubMatrix(double[][] destination, int[] rowIndex, int columnMin, int columnMax, double[][] source)
destination
- 値を設定する行列rowIndex
- 指定する行を含む指数columnMin
- 列の始まりcolumnMax
- 列の終りsource
- 代入する行列public static final void setSubMatrix(double[][] destination, int[] rowIndex, int[] columnIndex, double[][] source)
destination
- 値を設定する行列rowIndex
- 指定する行を含む指数columnIndex
- 指定する列を含む指数source
- 代入する行列public static final void setSubMatrix(double[][] destination, int rowMin, int rowMax, int[] columnIndex, double[][] source)
destination
- 値を設定する行列rowMin
- 行の始まりrowMax
- 行の終りcolumnIndex
- 指定する列を含む指数source
- 代入する行列public static final void setSubVector(double[] destination, int min, int max, double[] source)
destination
- 値を設定するベクトルmin
- 成分の始まりmax
- 成分の終りsource
- 代入するベクトルpublic static final void setSubVector(double[] destination, int to, double[] source, int min, int max)
destination
のrowTo
行を始点として、
配列source
の
rowMin
行からrowMax
行までの値をコピーします。
destination
- コピー先to
- 変更開始行source
- コピー元min
- コピー開始行max
- コピー開始列public static final void exchangeColumn(double[][] matrix, int column1, int column2)
matrix
- 対象の行列column1
- 指定列1column2
- 指定列2public static final void exchangeRow(double[][] matrix, int row1, int row2)
matrix
- 対象の行列row1
- 指定行1row2
- 指定行2public static final double[][] permutateSelf(double[][] matrix, int[] pivot, int count, boolean rowExchange)
matrix
- 対象となる行列pivot
- 交換する行番号や列番号の配列count
- 交換する数rowExchange
- 行を交換する場合true
public static final void multiplySelf(double[][] matrix, double scalar)
matrix
- 対象となる行列scalar
- 乗じる実数public static final double[][] multiply(double[][] matrix, int scalar)
matrix
- 対象となる行列scalar
- 乗じる整数
public static final double[][] multiply(double[][] matrix, double scalar)
matrix
- 対象となる行列scalar
- 乗じる実数
public static final double[][] unaryMinus(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] increment(double[][] matrix)
matrix
- 対象となる行列
public static final double[] increment(double[] vector)
vector
- 対象となるベクトル
public static final double[][] decrement(double[][] matrix)
matrix
- 対象となる行列
public static final double[] decrement(double[] vector)
vector
- 対象となるベクトル
public static int[] toIntMatrix(double[] vector)
vector
- 対象となる行列
public static final double[][] vectorToDiagonal(double[] vector)
vector
- 対象となるベクトル
public static double[][] removeRowVectors(double[][] matrix, int rowMin, int rowMax)
matrix
- 対象となる行列rowMin
- 開始行rowMax
- 終了行
public static double[][] removeRowVectors(double[][] matrix, int[] rowIndex)
matrix
- 元の行列rowIndex
- 削除する行の番号
public static double[][] removeColumnVectors(double[][] matrix, int columnMin, int columnMax)
matrix
- 対象となる行列columnMin
- 開始列columnMax
- 終了列
public static double[][] removeColumnVectors(double[][] matrix, int[] columnIndex)
matrix
- 元の行列columnIndex
- 削除する列の番号
public static final double[][] reshape(double[][] matrix, int newRowSize, int newColumnSize)
matrix
- 対象となる行列newRowSize
- 変更後の行の数newColumnSize
- 変更後の列の数
public static final double[][] reshape(double[] vector, int newRowSize, int newColumnSize)
vector
- 対象となるベクトルnewRowSize
- 行の数newColumnSize
- 列の数
public static final double[][] multiplyElementWise(double[][] a1, double[][] a2)
a1
- 掛けられる行列a2
- 掛ける行列
public static final double[][] maxElementWise(double[][] a1, double[][] a2)
a1
- 第一行列a2
- 第二行列
public static final double[][] minElementWise(double[][] a1, double[][] a2)
a1
- 第一行列a2
- 第二行列
public static double[][] divide(double[][] matrix, int scalar)
matrix
- 対象となる行列scalar
- 割る整数
public static double[][] divide(double[][] matrix, double scalar)
matrix
- 対象となる行列scalar
- 割る実数
public static double[] divide(double[] vector, double scalar)
vector
- 対象となる行列scalar
- 割る実数
public static final double[][] divideElementWise(double[][] a1, double[][] a2)
a1
- 割られる行列a2
- 割る行列
public static final double[][] leftDivideElementWise(double[][] a1, double[][] a2)
a1
- 割る行列a2
- 割られる行列
public static final double[][] addElementWise(double[][] matrix, double scalar)
matrix
- 対象となる行列scalar
- 加える実数
public static final double[] addElementWise(double[] vector, double scalar)
vector
- 対象となるベクトルscalar
- 加える実数
public static final double[][] subtractElementWise(double[][] matrix, double scalar)
matrix
- 対象となる行列scalar
- 引く実数
public static final double[][] powerElementWise(double scalar, double[][] matrix)
scalar
- 累乗される実数matrix
- 累乗の指数を成分とする行列
public static final double[][] powerElementWise(double[][] matrix, double scalar)
matrix
- 累乗の対象となる値を成分とする行列scalar
- 累乗の指数
public static final double[][] powerElementWise(double[][] a1, double[][] a2)
a1
- 累乗の対象となる値を成分とする行列a2
- 累乗の指数(実数)を成分とする行列
public static final double[][] powerElementWise(double[][] a1, int[][] a2)
a1
- 累乗の対象となる値を成分とする行列a2
- 累乗の指数(整数)を成分とする行列
public static final boolean isSameSize(double[] a1, double[] a2)
a1
- 第一ベクトルa2
- 第二ベクトル
public static final double[][] add(double[][] a1, double[][] a2)
a1
- 加えられる行列a2
- 加える行列
public static final double[][] subtract(double[][] a1, double[][] a2)
a1
- 引かれる行列a2
- 引く行列
public static final double max(double[][] matrix)
matrix
- 対象となる行列
public static double max(double[] vector)
vector
- 対象となるベクトル
public static double min(double[][] matrix)
matrix
- 対象となる行列
public static double min(double[] vector)
vector
- 対象となるベクトル
public static double sum(double[][] matrix)
matrix
- 対象となる行列
public static final double product(double[][] matrix)
matrix
- 対象となる行列
public static final double mean(double[][] matrix)
matrix
- 対象となる行列
public static final double std(double[][] matrix)
matrix
- 対象となる行列
public static final double frobNorm(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] frobNormRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] frobNormColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double norm(double[][] matrix, NormType type)
matrix
- 対象となる行列type
- ノルムの種類(NormType.ONE:1ノルム、NormType.TWO:2ノルム(最大特異値))
public static final double infNorm(double[][] matrix)
matrix
- 対象となる行列
public static final double trace(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] diagonalToVector(double[][] matrix)
matrix
- 対象となる行列
public static final void quickSort(double[] vector, int[] index, int start, int end)
vector
- 対象となるベクトルindex
- 並び替えた成分の番号を記憶する配列start
- ソートの対象となる成分の開始番号end
- ソートの対象となる成分の終了番号public static final org.mklab.nfc.matrix.IndexedDoubleElements sortRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final org.mklab.nfc.matrix.IndexedDoubleElements sortColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] readMatFormat(int rowSize, int columnSize, StreamTokenizer st) throws IOException
rowSize
- 行の数columnSize
- 列の数st
- データを読み込むストリームトークンナイザ
IOException
- ストリームトークンナイザから読み込めない場合public static void writeMatFormat(double[][] matrix, String fileName) throws IOException
fileName
- 作成するmatファイル名matrix
- 対象となる行列
IOException
- 入出力エラーが発生した場合public static void writeMatFormat(double[][] matrix, OutputStream output) throws IOException
matrix
- 対象となる行列output
- 出力ストリーム
IOException
- ストリームに出力できない場合public static final void writeMxFormat(double[][] matrix, OutputStream output, String name) throws IOException
matrix
- 対象となる行列output
- 出力ストリームname
- 行列の名前
IOException
- ストリームに出力できない場合public static final double[][] readMxFormat(InputStream input, MxDataHead head) throws IOException
input
- 入力ストリームhead
- MXフォーマットのヘッダ情報
IOException
- 入力ストリームから読み込めない場合public static final String toMmString(double[][] matrix, String format)
matrix
- 対象となる行列format
- 成分の出力フォーマット
public static final double[][] productRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] productColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] sumRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] sumColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] meanColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] meanRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] cumulativeProductColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] cumulativeProductRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] cumulativeSumColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] cumulativeSumRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] minColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] minRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] maxColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] maxRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] stdColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] stdRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] cumulativeProduct(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] cumulativeSum(double[][] matrix)
matrix
- 対象となる行列
public static final Object[] minimum(double[][] matrix)
matrix
- 対象となる行列
public static int[] indexOfMinimum(double[][] matrix)
matrix
- 対象となる行列
public static final Object[] minimumColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final Object[] minimumRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final Object[] maximum(double[][] matrix)
matrix
- 対象となる行列
public static int[] indexOfMaximum(double[][] matrix)
matrix
- 対象となる行列
public static final Object[] maximumColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static final Object[] maximumRowWise(double[][] matrix)
matrix
- 対象となる行列
public static final double[][] elementWiseFunction(double[][] matrix, org.mklab.nfc.matrix.DoubleRealFunction function)
matrix
- 対象となる行列function
- 実数関数(引数1個)
public static final double[][] elementWiseFunction(double[][] a1, double[][] a2, org.mklab.nfc.matrix.DoubleRealFunctionWithTwoArguments function)
a1
- 第一引数を成分とする行列a2
- 第二引数を成分とする行列function
- 実数関数(引数2個)
public static final double[][] elementWiseFunction(double[][] matrix, double d2, org.mklab.nfc.matrix.DoubleRealFunctionWithTwoArguments function)
matrix
- 第一引数を成分とする行列d2
- 第二引数function
- 実数関数(引数2個)
public static final boolean[][] elementWiseFunction(double[][] matrix, org.mklab.nfc.matrix.BooleanFunction function)
matrix
- 関数の引数を成分とする行列function
- ブーリアン関数(引数1個)
public static final boolean[][] elementWiseFunction(double[][] a1, double[][] a2, org.mklab.nfc.matrix.BooleanFunctionWithTwoArguments function)
a1
- 第一引数を成分とする行列a2
- 第二引数を成分とする行列function
- ブーリアン関数(引数2個)
public static final boolean[][] elementWiseFunction(double[][] matrix, double d2, org.mklab.nfc.matrix.BooleanFunctionWithTwoArguments function)
matrix
- 第一引数を成分とする行列d2
- 第二引数function
- ブーリアン関数(引数2個)
public static final boolean[][] compareElements(double[][] matrix, String operator, double opponent)
matrix
- 対象となる行列operator
- 比較演算子(". <", ". <=", ".>", ".>=", ".==", ".!=")opponent
- 比較対象
public static final boolean[][] compareElements(double[][] matrix, String operator, Scalar<?> opponent)
matrix
- 対象となる行列operator
- 比較演算子(". <", ". <=", ".>", ".>=", ".==", ".!=")opponent
- 比較対象
public static final boolean[][] compareElements(double[][] a1, String operator, double[][] a2)
a1
- 第一行列operator
- 比較演算子(". <", ". <=", ".>", ".>=", ".==", ".!=")a2
- 第二行列
public static final boolean[][] compareElements(double[][] a1, String operator, int[][] a2)
a1
- 第一行列operator
- 比較演算子(". <", ". <=", ".>", ".>=", ".==", ".!=")a2
- 第二行列
public static final double[][] resize(double[][] matrix, int newRowSize, int newColumnSize)
newRowSize
*newColumnSize
にサイズ変更します。
reshape(double[][], int, int)
とは異なり、成分位置の変更はせず,
自身より大きなサイズに変更する時は,0が埋められ、 自身より小さなサイズに変更する時は余分な成分は切り取られます。
matrix
- 対象となる行列newRowSize
- 新しい行の数newColumnSize
- 新しいレスう
public static final double[][] powerElementWise(int[][] matrix, double d)
matrix
- 元の行列d
- 累乗の指数
public static final double[][] powerElementWise(int[][] a1, double[][] a2)
a1
- 累乗の対象となる値を成分とする行列a2
- 累乗の指数(実数)を成分とする行列
public static double[][] powerElementWise(double scalar, int[][] matrix)
scalar
- 累乗される実数matrix
- 累乗の指数を成分とする行列
public static final double[][] createArray(int[][] matrix)
matrix
- 整数行列
public static void print(double[][] matrix, Writer output, String format, GridElementAlignment alignment, int maxColumnSize)
matrix
- 対象となる行列output
- ライターformat
- 成分の出力フォーマットalignment
- 成分の出力配置maxColumnSize
- 最大列の数public static double median(double[][] matrix)
matrix
- 対象となる行列
public static double[][] medianColumnWise(double[][] matrix)
matrix
- 対象となる行列
public static double[][] medianRowWise(double[][] matrix)
matrix
- 対象となる行列
public static double[][] covariance(double[][] a1, double[][] a2)
a1
- データ列1 (行ベクトル又は列ベクトル)a2
- データ列2 (行ベクトル又は列ベクトル)
public static double variance(double[][] matrix)
matrix
- データ列 (行ベクトル又は列ベクトル)
public static double[][] makeColumnVector(double[][] matrix)
matrix
- 対象となる行列
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |