Need help for an array or matrix

arraysmatricesnicematrix

I am trying to make an array or matrix to represent this matrix:
enter image description here

But unfortunately, I don't manage to do it (I even don't know if I should do it with an array or a pmatrix).
So, if someone can help me…

Best Answer

This is a fairly faithful reproduction of the matrix using the nicematrix package.

The solid lines were drawn using the package's ability to insert tikz commands (with \CodeAfter) between the nodes it creates in the cells.

Requires compiling twice.

b

\documentclass[12pt,a4paper]{article}   

\usepackage{tikz} % needed <<<<<<<  
\usepackage{nicematrix} %    needed <<<<<<<

\begin{document}
    \setcounter{MaxMatrixCols}{20}
\[\tilde{A'} = \begin{pNiceMatrix}[first-row, cell-space-limits=5pt]
    &   &   &j_{1}  &   &       &   &j_{2}  &   &\cdots &       &j_{r-1}&       &\cdots &   &j_{r}  &   &       &   &\\
0   &-  &0  &1      &*  &\Cdots &*  &0      &*  &\Cdots &*      &0      &*      &\Cdots &*          &0      &*      &\Cdots &*      &b'_{1} \\
    &   &   &       &   &       &   &       &   &       &\Vdots &\Vdots &\Vdots &       &\Vdots     &\Vdots &\Vdots &       &\Vdots &       \\[-10pt]
    &   &0  &       &   &       &0  &1      &*  &       &       &       &       &       &           &       &       &       &       &b'_{2} \\
    &   &   &       &   &       &   &       &   &       &       &       &       &       &           &       &       &       &       &       \\[-10pt]
    &   &   &       &   &       &0  &       &   &       &       &       &       &       &           &       &       &       &       &b'_{3} \\
    &   &   &       &   &       &   &       &   &       &*      &0      &       &       &           &       &       &       &       &\Vdots \\
    &   &   &       &   &       &   &       &   &       &0      &1      &*      &\Cdots &*          &0      &       &       &       &b'_{r-1}\\
    &   &   &       &   &       &   &       &   &       &       &       &       &       &           &       &       &       &       &       \\[-10pt]       
    &   &   &       &   &       &   &       &   &       &0      &       &       &       &0          &1      &*      &\Cdots &*      &b'_{r} \\
    &   &   &       &   &       &   &       &   &       &       &       &       &       &           &       &       &       &       &       \\[-10pt]
    &   &   &       &   &       &   &       &   &       &       &       &       &       &0          &       &       &       &0      &b'_{r+1}\\
    &   &   &       &   &       &   &       &   &       &       &       &       &       &           &       &       &       &       &\Vdots \\
0   &   &   &       &   &       &   &       &   &       &       &       &       &       &           &       &       &       &0      &b'_{n} \\
\CodeAfter 
\tikz \draw  (2-|1.5) -- (13-|1.5); 
\tikz \draw  (3-|4) -- (3-|7); 
\tikz \draw  (5-|8) -- (5-|9); 
\tikz \draw  (7.5-|10) -- (7.5-|11); 
\tikz \draw  (9-|12) -- (9-|15); 
\tikz \draw  (11-|16) -- (11-|19); 
\tikz \draw  (13.5-|2) -- (13.5-|19); 
\tikz \draw  (2-|3.5) -- (2.5-|3.5); 
\tikz \draw  (4-|7.5) -- (4.5-|7.5); 
\tikz \draw  (8-|11.5) -- (8.5-|11.5); 
\tikz \draw  (10-|15.5) -- (10.5-|15.5); 
\tikz \draw  (12-|19.5) -- (13-|19.5); 
\end{pNiceMatrix}\]

\end{document}