Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adjugate_matrix #1270

Merged
merged 5 commits into from
Oct 28, 2024
Merged

Add adjugate_matrix #1270

merged 5 commits into from
Oct 28, 2024

Conversation

adamant-pwn
Copy link
Contributor

Resolves #1269.

I used matrix_inverse as a template, but also added the following generators:

  • almost_perm_max_random.cpp: Same as perm_max_random.cpp, but changes a random item into 0.
  • almost_identity.cpp: An identity matrix, but random item is changed into 0.
  • highrank_max_random.cpp: A random matrix, but with 50% chance a random row is changed into a linear combination of two other rows, and with an independent 50% chance same happens to columns.

I think I need some help with Japanese strings for task.md.

@maspypy
Copy link
Collaborator

maspypy commented Oct 28, 2024

Here is the Japanese statement.

@{lang.en}
Given $N \times N$ matrix $A = \lbrace a_{ij} \rbrace$ with entries in $\mathbb{Z}/@{param.MOD}\mathbb{Z}$, print $\operatorname{adj} A = \lbrace (-1)^{i+j}M_{ji} \rbrace$, where $M_{ij}$ is the determinant of the matrix that is obtained from $A$ by removing its $i$-th row and $j$-th column. 
@{lang.ja}
$\mathbb{Z}/@{param.MOD}\mathbb{Z}$ 成分の $N\times N$ 行列 $A = \lbrace a_{ij} \rbrace$ が与えられます.
$A$ の余因子行列 $\operatorname{adj} A = \lbrace (-1)^{i+j}M_{ji} \rbrace$ を出力してください.ただし $M_{ij}$ は $A$ から $i$ 行目,$j$ 列目を取り除くことによって得られる行列の行列式です.
@{lang.end}

@maspypy
Copy link
Collaborator

maspypy commented Oct 28, 2024

I implemented it as well, and I was able to confirm an AC!

How about adding a test case for nontrivial_frobenius_form for this problem as well? It can be added simply by copying it from characteristic_polynomial.

@maspypy
Copy link
Collaborator

maspypy commented Oct 28, 2024

I also suggest adding a test case for $n=1$.
I think it would be ok to simply add it as example_03.

@adamant-pwn
Copy link
Contributor Author

Thanks for the review! I have updated the PR.

Co-authored-by: maspypy <45988013+maspypy@users.noreply.github.com>
@maspypy
Copy link
Collaborator

maspypy commented Oct 28, 2024

Thank you! I will merge.

@maspypy maspypy merged commit c6bfe96 into yosupo06:master Oct 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Problem proposal] Adjugate matrix
2 participants