|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.mklab.nfc.matrix.BooleanMatrixUtil
public final class BooleanMatrixUtil
BooleanMatrix
のユーティリティクラスです。
メソッドの概要 | |
---|---|
static boolean |
allTrue(boolean[][] matrix)
全成分を調べ、全成分がtrueならtrue、そうでなければfalseを返します。 |
static boolean[] |
allTrueColumnWise(boolean[][] matrix)
成分を列毎に調べ、列の全成分がtrueならtrue、そうでなければfalseを対応させ、行毎のbooleanからなる boolean行列を返します。 |
static boolean[][] |
allTrueRowWise(boolean[][] matrix)
成分を行毎に調べ、行の全成分がtrueならtrue、そうでなければfalseを対応させ、 行毎のbooleanからなるboolean行列を返します。 |
static boolean[][] |
andElementWise(boolean[][] matrix,
boolean scalar)
行列の各成分と scalar の論理積を成分にもつboolean行列を返します。 |
static boolean[][] |
andElementWise(boolean[][] a1,
boolean[][] a2)
a1 とa2 の各成分の論理積を成分にもつboolean行列を返します。 |
static boolean |
anyTrue(boolean[][] matrix)
全成分を調べtrueが1個でもあればtrue、そうでなければfalseを返します。 |
static boolean[] |
anyTrueColumnWise(boolean[][] matrix)
列毎の成分を調べ、行にtrueが1個でもあればtrue、そうでなければfalseを対応させ、 booleanを含むboolean行列を返します。 |
static boolean[][] |
anyTrueRowWise(boolean[][] matrix)
行毎の成分を調べ、行にtrueが1個でもあればtrue、そうでなければfalseを対応させ、 booleanを含むboolean行列を返します。 |
static boolean[][] |
appendDown(boolean[][] a1,
boolean[][] a2)
2個の行列を縦に接続した行列を生成します。 |
static boolean[][] |
appendRight(boolean[][] a1,
boolean[][] a2)
ベクトルの右側に行列を接続した行列を生成します。 |
static boolean[][] |
clone(boolean[][] matrix)
行列の複製を生成します。 |
static boolean[][] |
compareElements(boolean[][] a1,
String operator,
boolean[][] a2)
2個の行列を成分毎に operator で指定された演算子で比較し, 計算結果を成分とする行列を生成します。 |
static void |
copy(boolean[][] source,
boolean[][] destination)
行列 source の各成分を行列destination の各成分にコピーします。 |
static boolean[] |
diagonalToVector(boolean[][] matrix)
対角成分を取り出し縦ベクトルとして返します。 |
static boolean |
equals(boolean[][] a1,
boolean[][] a2)
2個の配列の成分が全て等しいか判定します。 |
static void |
exchangeColumn(boolean[][] matrix,
int column1,
int column2)
column1 列とcolumn2 列を入れ替えます。 |
static void |
exchangeRow(boolean[][] matrix,
int row1,
int row2)
row1 行とrow2 行を入れ替えます。 |
static boolean[][] |
exorElementWise(boolean[][] matrix,
boolean scalar)
行列の各成分と scalar の排他的論理和を成分にもつboolean行列を返します。 |
static boolean[][] |
exorElementWise(boolean[][] a1,
boolean[][] a2)
2個の行列の各成分の排他的論理和を成分にもつboolean行列を返します。 |
static int[] |
find(boolean[][] matrix)
各成分を調べ、trueの位置を順にも整数ベクトルを返します。 |
static int |
getNumberOfTrue(boolean[][] matrix)
成分のtrueの数を返します。 |
static boolean[][] |
getSubMatrix(boolean[][] matrix,
int[] rowIndex,
int column)
部分行列を生成します。 |
static boolean[][] |
getSubMatrix(boolean[][] matrix,
int[] rowIndex,
int[] columnIndex)
部分行列を生成します。 |
static boolean[][] |
getSubMatrix(boolean[][] matrix,
int[] rowIndex,
int columnMin,
int columnMax)
部分行列を生成します。 |
static boolean[][] |
getSubMatrix(boolean[][] matrix,
int row,
int[] columnIndex)
部分行列を生成します。 |
static boolean[][] |
getSubMatrix(boolean[][] matrix,
int rowMin,
int rowMax,
int[] columnIndex)
部分行列を生成します。 |
static boolean[][] |
getSubMatrix(boolean[][] matrix,
int rowMin,
int rowMax,
int columnMin,
int columnMax)
部分行列を生成します。 |
static boolean[] |
getSubVector(boolean[] matrix,
int[] index)
部分ベクトルを生成します。 |
static boolean |
isZero(boolean[][] matrix)
零行列(全ての成分がfalse)であるか判定します。 |
static boolean[][] |
multiply(boolean[][] a1,
boolean[][] a2)
2個の行列の積(成分毎の論理積)を求めます。 |
static boolean[][] |
notElementWise(boolean[][] matrix)
各成分の否定(trueならfalse、falseならtrue)を成分にもつboolean行列を返します。 |
static boolean[][] |
ones(int rowSize,
int columnSize)
rowSize *columnSize の全成分trueの行列を生成します。 |
static boolean[][] |
orElementWise(boolean[][] matrix,
boolean scalar)
行列の各成分と scalar の論理和を成分にもつboolean行列を返します。 |
static boolean[][] |
orElementWise(boolean[][] a1,
boolean[][] a2)
2個の行列の各成分の論理和を成分にもつboolean行列を返します。 |
static boolean[][] |
power(boolean[][] matrix,
int scalar)
scalar 乗(this
scalar )を返します。 |
static void |
print(boolean[][] matrix,
Writer output,
String format,
int maxColumnSize)
ライターに出力します。 |
static boolean[][] |
readMxFormat(DataInputStream input,
MxDataHead head)
データ入力ストリームから行列データ(MXフォーマット)を読み込みます。 |
static boolean[][] |
removeColumnVectors(boolean[][] matrix,
int[] index)
指定された列を削除した行列を生成します。 |
static boolean[][] |
removeColumnVectors(boolean[][] matrix,
int min,
int max)
指定された列を削除した行列を生成します。 |
static boolean[][] |
removeRowVectors(boolean[][] matrix,
int[] index)
指定された行を削除した行列を生成します。 |
static boolean[][] |
removeRowVectors(boolean[][] matrix,
int min,
int max)
指定された行を削除した行列を生成します。 |
static boolean[][] |
reshape(boolean[][] matrix,
int newRowSize,
int newColumnSize)
行列の成分を変えずに、行列の大きさ(行の数と列の数)を変形します。 |
static boolean[][] |
resize(boolean[][] matrix,
int newRowSize,
int newColumnSize)
newRowSize *newColumnSize にサイズ変更します。 |
static void |
setElements(boolean[][] destination,
int[] index,
boolean[][] source)
|
static void |
setSubMatrix(boolean[][] destination,
int[] rowIndex,
int[] columnIndex,
boolean[][] source)
|
static void |
setSubMatrix(boolean[][] destination,
int[] rowIndex,
int columnMin,
int columnMax,
boolean[][] source)
|
static void |
setSubMatrix(boolean[][] destination,
int rowTo,
int columnTo,
boolean[][] source,
int rowMin,
int rowMax,
int columnMin,
int columnMax)
配列 destination のrowTo 行columnTo列を始点として、
配列 |
static void |
setSubMatrix(boolean[][] destination,
int rowMin,
int rowMax,
int[] columnIndex,
boolean[][] source)
|
static void |
setZero(boolean[][] matrix)
行列の全ての成分に零(false)を代入します。 |
static String |
toMmString(boolean[][] matrix)
行列をMMフォーマットの文字列に変換します。 |
static boolean[][] |
transpose(boolean[][] matrix)
転置行列を生成します。 |
static boolean[][] |
unit(int rowSize,
int columnSize)
単位行列を生成します。 |
static boolean[][] |
vectorToDiagonal(boolean[] diagonalElements)
ベクトルの成分を対角成分とする対角行列を生成します。 |
static void |
writeMxFormat(boolean[][] matrix,
OutputStream output,
String name)
行列を出力ストリームにMXフォーマットで出力します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
メソッドの詳細 |
---|
public static final boolean[][] clone(boolean[][] matrix)
matrix
- 複製の元となる行列
public static final void exchangeColumn(boolean[][] matrix, int column1, int column2)
column1
列とcolumn2
列を入れ替えます。
matrix
- 対象の行列column1
- 指定列1column2
- 指定列2public static final void exchangeRow(boolean[][] matrix, int row1, int row2)
row1
行とrow2
行を入れ替えます。
matrix
- 対象の行列row1
- 指定行1row2
- 指定行2public static final boolean[][] resize(boolean[][] matrix, int newRowSize, int newColumnSize)
newRowSize
*newColumnSize
にサイズ変更します。
reshape(boolean[][], int, int)
とは異なり、成分位置の変更はせず、自身より大きなサイズに変更する時は、
0が埋められ、自身より小さなサイズに変更する時は余分な成分は切り取られます。
matrix
- 対象となる行列newRowSize
- 新しい行の数newColumnSize
- 新しいレスう
public static boolean[][] removeColumnVectors(boolean[][] matrix, int min, int max)
matrix
- 対象となる行列min
- 開始列max
- 終了列
public static boolean[][] removeColumnVectors(boolean[][] matrix, int[] index)
matrix
- 元の行列index
- 削除する列の番号
public static boolean[][] removeRowVectors(boolean[][] matrix, int min, int max)
matrix
- 対象となる行列min
- 開始行max
- 終了行
public static boolean[][] removeRowVectors(boolean[][] matrix, int[] index)
matrix
- 元の行列index
- 削除する行の番号
public static final boolean[][] getSubMatrix(boolean[][] matrix, int rowMin, int rowMax, int[] columnIndex)
matrix
- 元の行列rowMin
- 始まりの行rowMax
- 終わりの行columnIndex
- 該当する列の番号
public static final boolean[][] getSubMatrix(boolean[][] matrix, int[] rowIndex, int[] columnIndex)
matrix
- 元の行列rowIndex
- 該当する行の番号columnIndex
- 該当する列の番号
public static final boolean[][] getSubMatrix(boolean[][] matrix, int[] rowIndex, int columnMin, int columnMax)
matrix
- 元の行列rowIndex
- 該当する行の番号columnMin
- 始まりの列columnMax
- 終わりの列
public static final boolean[][] getSubMatrix(boolean[][] matrix, int[] rowIndex, int column)
matrix
- 元の行列rowIndex
- 該当する行の番号column
- 列番号
public static final boolean[][] getSubMatrix(boolean[][] matrix, int row, int[] columnIndex)
matrix
- 元の行列row
- 行の番号columnIndex
- 該当する列の番号
public static final boolean[] getSubVector(boolean[] matrix, int[] index)
matrix
- 元のベクトルindex
- 該当する行の番号
public static final String toMmString(boolean[][] matrix)
matrix
- 対象となる行列
public static void copy(boolean[][] source, boolean[][] destination)
source
の各成分を行列destination
の各成分にコピーします。
source
- コピー元行列destination
- コピー先行列public static boolean anyTrue(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean[][] anyTrueRowWise(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean[] anyTrueColumnWise(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean allTrue(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean[][] allTrueRowWise(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean[] allTrueColumnWise(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean[][] notElementWise(boolean[][] matrix)
matrix
- 対象となる行列
public static boolean[][] andElementWise(boolean[][] a1, boolean[][] a2)
a1
とa2
の各成分の論理積を成分にもつboolean行列を返します。
a1
- 演算の対象a2
- 演算の対象
public static boolean[][] multiply(boolean[][] a1, boolean[][] a2)
a1
- 掛けられる行列a2
- 掛ける行列
public static boolean[][] andElementWise(boolean[][] matrix, boolean scalar)
scalar
の論理積を成分にもつboolean行列を返します。
matrix
- 対象となる行列scalar
- 対象となるboolean値
public static boolean[][] orElementWise(boolean[][] a1, boolean[][] a2)
a1
- 対象となる行列a2
- 対象となる行列
public static boolean[][] orElementWise(boolean[][] matrix, boolean scalar)
scalar
の論理和を成分にもつboolean行列を返します。
matrix
- 対象となる行列scalar
- 全ての演算に用いるboolean
public static boolean[][] exorElementWise(boolean[][] a1, boolean[][] a2)
a1
- 対象となる行列a2
- 対象となる行列
public static boolean[][] exorElementWise(boolean[][] matrix, boolean scalar)
scalar
の排他的論理和を成分にもつboolean行列を返します。
matrix
- 対象となる行列scalar
- 全ての演算に用いるboolean
public static void print(boolean[][] matrix, Writer output, String format, int maxColumnSize)
matrix
- 対象となる行列output
- ライターformat
- 成分の出力フォーマットmaxColumnSize
- 最大列の数public static boolean[][] reshape(boolean[][] matrix, int newRowSize, int newColumnSize)
matrix
- 対象となる行列newRowSize
- 変更後の行の数newColumnSize
- 変更後の列の数
public static int getNumberOfTrue(boolean[][] matrix)
matrix
- booleanをもつ配列
public static int[] find(boolean[][] matrix)
matrix
- booleanをもつ配列
public static boolean[][] power(boolean[][] matrix, int scalar)
scalar
乗(this
scalar
)を返します。
matrix
- 対象となる行列scalar
- 指数
public static boolean[][] unit(int rowSize, int columnSize)
rowSize
- 行の数columnSize
- 列の数
public static boolean[][] ones(int rowSize, int columnSize)
rowSize
*columnSize
の全成分trueの行列を生成します。
rowSize
- 行の数columnSize
- 列の数
public static boolean[][] vectorToDiagonal(boolean[] diagonalElements)
diagonalElements
- 対象となるベクトル
public static void writeMxFormat(boolean[][] matrix, OutputStream output, String name) throws IOException
matrix
- 対象となる行列output
- 出力ストリームname
- 行列の名前
IOException
- ストリームに出力できない場合public static boolean[][] readMxFormat(DataInputStream input, MxDataHead head) throws IOException
input
- データ入力ストリームhead
- MXフォーマットのヘッダ情報
IOException
- ストリームに出力できない場合public static boolean equals(boolean[][] a1, boolean[][] a2)
a1
- 第一行列a2
- 第二行列
public static boolean[][] transpose(boolean[][] matrix)
matrix
- 元の行列
public static boolean[][] getSubMatrix(boolean[][] matrix, int rowMin, int rowMax, int columnMin, int columnMax)
matrix
- 元の行列rowMin
- 始まり行rowMax
- 終わり行columnMin
- 始まり列columnMax
- 終わり列
public static boolean[] diagonalToVector(boolean[][] matrix)
matrix
- 対象となる行列
public static void setSubMatrix(boolean[][] destination, int rowTo, int columnTo, boolean[][] source, int rowMin, int rowMax, int columnMin, int columnMax)
destination
のrowTo
行columnTo列を始点として、
配列source
のrowMin
行columnMin
列から
rowMax
行columnMax
列までの値をコピーします。
- パラメータ:
destination
- コピー先rowTo
- 変更開始行columnTo
- 変更開始列source
- コピー元rowMin
- コピー開始行rowMax
- コピー開始列columnMin
- コピー終了行columnMax
- コピー終了列
public static void setSubMatrix(boolean[][] destination, int[] rowIndex, int columnMin, int columnMax, boolean[][] source)
destination
- 値を設定する行列rowIndex
- 指定する行を含む指数columnMin
- 列の始まりcolumnMax
- 列の終りsource
- 代入する行列public static void setSubMatrix(boolean[][] destination, int rowMin, int rowMax, int[] columnIndex, boolean[][] source)
destination
- 値を設定する行列rowMin
- 行の始まりrowMax
- 行の終りcolumnIndex
- 指定する列を含む指数source
- 代入する行列public static void setSubMatrix(boolean[][] destination, int[] rowIndex, int[] columnIndex, boolean[][] source)
destination
- 値を設定する行列rowIndex
- 指定する行を含む指数columnIndex
- 指定する列を含む指数source
- 代入する行列public static void setElements(boolean[][] destination, int[] index, boolean[][] source)
destination
- 成分を代入する行列index
- 成分の番号を指定する指数source
- 代入するベクトルpublic static boolean[][] appendDown(boolean[][] a1, boolean[][] a2)
a1
- 上側の行列a2
- 下側の行列
public static boolean[][] appendRight(boolean[][] a1, boolean[][] a2)
a1
- 左側のベクトルa2
- 右側の行列
public static final boolean[][] compareElements(boolean[][] a1, String operator, boolean[][] a2)
operator
で指定された演算子で比較し, 計算結果を成分とする行列を生成します。
a1
- 第一行列operator
- 比較演算子(".==", ".!=")a2
- 第二行列
public static final boolean isZero(boolean[][] matrix)
matrix
- 調べる行列
public static final void setZero(boolean[][] matrix)
matrix
- 零(false)を代入する行列
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |