版本比较
矩阵 总结
正文
增加 5 行删除 5 行
42 行未改动434445464747484950517 行未改动59606162636364656667676869707171727374747576777881 行未改动42 行未改动$$\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}=x\begin{bmatrix}a\\c\end{bmatrix}+y\begin{bmatrix}b\\d\end{bmatrix}=\begin{bmatrix}ax+by\\cx+dy\end{bmatrix}$$
矩阵的乘法则可以直接用这个公式表示:
若需要求 $C=AB$ 若需要求 $C=AB$
$$C_{i,j}=\sum^{L}_{k=1}(A_{i,k}\times B_{k,j})$$
但是,一般矩阵都是从右往左成的,这点需要注意。如下面的错误。7 行未改动 ll x; mint() : x(0) {} mint &operator = (const ll &o) { x = (o % mod + mod) % mod; return *this; } mint &operator = (const mint &o) { x = o.x; return *this; }
mint &operator += (const mint &o) { x += o.x; if(x >= mod) x -= mod; return *this; } mint &operator -= (const mint &o) { x -= o.x; if(x < 0) x += mod; return *this; } mint &operator *= (const mint &o) { x *= o.x, x %= mod; return *this;}
mint operator + (const mint &o)const { mint res = *this; return res += o; } mint operator - (const mint &o)const { mint res = *this; return res -= o; } mint operator * (const mint &o)const { mint res = *this; return res *= o; }
bool operator == (const mint &o)const { return x == o.x; } bool operator != (const mint &o)const { return x != o.x; }
bool operator < (const mint &o)const { return x < o.x; }};struct Matrix{81 行未改动