Mol(Math Object Library) fot .Net
二分木検索を実行します。 引数 x の要素は x[LBound] ~ x[UBound] まで昇順にソートされていなければなりません (ソートされていないと無意味な計算結果が返ります)。

名前空間: Mol
アッセンブリー: Mol.Net (in Mol.Net.dll)

構文

C#
public static int BinSearch(
	out int ix,
	double xt,
	VectorDenseDouble x,
	int LBound,
	int UBound
)
Visual Basic
Public Shared Function BinSearch ( 
	<OutAttribute> ByRef ix As Integer,
	xt As Double,
	x As VectorDenseDouble,
	LBound As Integer,
	UBound As Integer
) As Integer
Visual C++
public:
static int BinSearch(
	[OutAttribute] int% ix, 
	double xt, 
	VectorDenseDouble^ x, 
	int LBound, 
	int UBound
)
static member BinSearch : 
        ix : int byref * 
        xt : float * 
        x : VectorDenseDouble * 
        LBound : int * 
        UBound : int -> int 

Parameters

ix
タイプ: System..::..Int32%
x の要素位置。意味は戻り値の記述を参照してください。
xt
タイプ: System..::..Double
検索する値
x
タイプ: Mol..::..VectorDenseDouble
x 検索される点列
LBound
タイプ: System..::..Int32
要素 x[LBound] から検索が開始します。
UBound
タイプ: System..::..Int32
要素 x[UBound] まで検索します。

Return Value

タイプ: Int32
0 ... xt == x[ix]
-1 ... x[ix-1] < xt < x[ix]
+1 ... x[ix] < xt < x[ix+1]
ただし、xt が範囲外の ix==LBound (-1: xt < x[LBound])や ix==UBound (+1: xt > x[UBound])の場合もあります。

参照