パッケージ library.ds.pair
クラス IntPair
- すべての実装されたインタフェース:
Cloneable,Comparable<Pair<Long,Long>>
整数型のPair特化クラス
便利なメソッドもある
-
フィールドの概要
フィールド -
メソッドの概要
修飾子とタイプメソッド説明final doubleabs()ユークリッドノルムを返すfinal IntPairPair同士を加算するfinal longクロス積を返すfinal IntPairPair同士を除算するfinal longドット積を返すfinal IntPairextgcd()拡張ユークリッドの互除法final longgcd()最大公約数を返すfinal doublegrad()second / firstを返すfinal longlcm()最小公倍数を返すfinal IntPair[maybe_unused] Pair同士の剰余演算final IntPairPair同士を乗算するstatic final IntPairof(long a, long b) IntPairを宣言するのに使う new IntPairと同等final IntPairrotate()IntPairを座標と見て90度回転させる rotate(90)より精確final FloatPairrotate(int ang) IntPairを座標と見てang度回転させるfinal longsqr()距離を返すfinal IntPairPair同士を減算するfinal IntPairswap()元のIntPairをswapしたものを返す
-
フィールド詳細
-
ZERO
(0, 0) -
ONE
(1, 1)
-
-
メソッドの詳細
-
of
IntPairを宣言するのに使う new IntPairと同等- パラメータ:
a- firstb- second
-
swap
元のIntPairをswapしたものを返す -
add
Pair同士を加算する- パラメータ:
p-
-
sub
Pair同士を減算する- パラメータ:
p-
-
mul
Pair同士を乗算する- パラメータ:
p-
-
div
Pair同士を除算する- パラメータ:
p-
-
mod
[maybe_unused] Pair同士の剰余演算- パラメータ:
p-
-
rotate
IntPairを座標と見て90度回転させる rotate(90)より精確 -
rotate
IntPairを座標と見てang度回転させる- パラメータ:
ang-
-
dot
ドット積を返す- パラメータ:
p-- 戻り値:
- ドット積
-
cross
クロス積を返す- パラメータ:
p-- 戻り値:
- クロス積
-
sqr
public final long sqr()距離を返す- 戻り値:
- IntPairを座標と見て距離
-
grad
public final double grad()second / firstを返す- 戻り値:
- IntPairの勾配
-
abs
public final double abs()ユークリッドノルムを返す- 戻り値:
- IntPairのユークリッドノルム
-
lcm
public final long lcm()最小公倍数を返す- 戻り値:
- IntPairの最小公倍数
-
gcd
public final long gcd()最大公約数を返す- 戻り値:
- IntPairの最大公約数
-
extgcd
拡張ユークリッドの互除法
-