Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
linear_equation.hpp ファイル

[ソースコード]

関数

template<int MAX_COL>
int RowReduction (vector< bitset< MAX_COL > > &a, int col, vector< int > &where)
 F_2 上の連立線形方程式 https://mathlandscape.com/solution-sp/ https://yukicoder.me/submissions/1011997 verify: https://yukicoder.me/problems/no/2895 verify: https://yukicoder.me/problems/no/3229 verify: https://judge.yosupo.jp/problem/system_of_linear_equations_mod_2
 
template<int MAX_COL, bool ONE_KER = false>
int LinearEquation (vector< bitset< MAX_COL > > a, vector< bool > b, int col, vector< bool > &x0, vector< vector< bool > > &ker)
 連立線形方程式 Ax=b を解く
 

関数詳解

◆ RowReduction()

template<int MAX_COL>
int RowReduction ( vector< bitset< MAX_COL > > & a,
int col,
vector< int > & where )

F_2 上の連立線形方程式 https://mathlandscape.com/solution-sp/ https://yukicoder.me/submissions/1011997 verify: https://yukicoder.me/problems/no/2895 verify: https://yukicoder.me/problems/no/3229 verify: https://judge.yosupo.jp/problem/system_of_linear_equations_mod_2

掃き出し法

引数
a連立方程式 Ax=b の拡大係数行列
col拡大係数行列の列数
whereピボットとなる変数を記録するための配列
戻り値
A のランク

linear_equation.hpp16 行目に定義があります。

◆ LinearEquation()

template<int MAX_COL, bool ONE_KER = false>
int LinearEquation ( vector< bitset< MAX_COL > > a,
vector< bool > b,
int col,
vector< bool > & x0,
vector< vector< bool > > & ker )

連立線形方程式 Ax=b を解く

引数
col連立方程式の変数の数
x0特殊解(b=0 の場合は自明解になる)
kerAx=0 の解空間の基底
ONE_KER基底のサイズが巨大な場合、基底を1つだけ求められれば良いときはtrue
覚え書き
一般解は x0 と解空間の基底の任意の線形結合で表される
注意
A のサイズによっては基底のサイズが巨大になるので注意すること

linear_equation.hpp41 行目に定義があります。