复制的代码左侧有一竖排行号的极简去除方法

方法一:Alt键,拖动矩形选框选中左侧的行号,删除即可

(1)先把复制下来的代码粘贴到Editplus或Notepad++

(2)按住Alt键,拖动矩形选框选中左侧的行号,删除即可

方法二:正则表达式替换

文本编辑器中正则表达式替换

 输入输入^[0-9]+[.] 或者输入^[0-9]0-9]0-9]   /    ^[0-9][0-9]     /    ^ [0-9]    /    ^  [0-9]  

2.1、 参考:

https://www.cnblogs.com/yi-ye/p/5626753.html

2.2、正则表达式语法

链接:https://www.runoob.com/regexp/regexp-syntax.html

特别字符描述
$ 匹配输入字符串的结尾位置。如果设置了 RegExp 对象的 Multiline 属性,则 $ 也匹配 '\n' 或 '\r'。要匹配 $ 字符本身,请使用 \$。
( ) 标记一个子表达式的开始和结束位置。子表达式可以获取供以后使用。要匹配这些字符,请使用 \( 和 \)。
* 匹配前面的子表达式零次或多次。要匹配 * 字符,请使用 \*。
+ 匹配前面的子表达式一次或多次。要匹配 + 字符,请使用 \+。
. 匹配除换行符 \n 之外的任何单字符。要匹配 . ,请使用 \. 。
[ 标记一个中括号表达式的开始。要匹配 [,请使用 \[。
? 匹配前面的子表达式零次或一次,或指明一个非贪婪限定符。要匹配 ? 字符,请使用 \?。
\ 将下一个字符标记为或特殊字符、或原义字符、或向后引用、或八进制转义符。例如, 'n' 匹配字符 'n'。'\n' 匹配换行符。序列 '\\' 匹配 "\",而 '\(' 则匹配 "("。
^ 匹配输入字符串的开始位置,除非在方括号表达式中使用,当该符号在方括号表达式中使用时,表示不接受该方括号表达式中的字符集合。要匹配 ^ 字符本身,请使用 \^。
{ 标记限定符表达式的开始。要匹配 {,请使用 \{。
| 指明两项之间的一个选择。要匹配 |,请使用 \|。

限定符

限定符用来指定正则表达式的一个给定组件必须要出现多少次才能满足匹配。有 * 或 + 或 ? 或 {n} 或 {n,} 或 {n,m} 共6种。

正则表达式的限定符有:

字符描述
* 匹配前面的子表达式零次或多次。例如,zo* 能匹配 "z" 以及 "zoo"。* 等价于{0,}。
+ 匹配前面的子表达式一次或多次。例如,'zo+' 能匹配 "zo" 以及 "zoo",但不能匹配 "z"。+ 等价于 {1,}。
? 匹配前面的子表达式零次或一次。例如,"do(es)?" 可以匹配 "do" 、 "does" 中的 "does" 、 "doxy" 中的 "do" 。? 等价于 {0,1}。
{n} n 是一个非负整数。匹配确定的 n 次。例如,'o{2}' 不能匹配 "Bob" 中的 'o',但是能匹配 "food" 中的两个 o。
{n,} n 是一个非负整数。至少匹配n 次。例如,'o{2,}' 不能匹配 "Bob" 中的 'o',但能匹配 "foooood" 中的所有 o。'o{1,}' 等价于 'o+'。'o{0,}' 则等价于 'o*'。
{n,m} m 和 n 均为非负整数,其中n <= m。最少匹配 n 次且最多匹配 m 次。例如,"o{1,3}" 将匹配 "fooooood" 中的前三个 o。'o{0,1}' 等价于 'o?'。请注意在逗号和两个数之间不能有空格。

以下正则表达式匹配一个正整数,[1-9]设置第一个数字不是 0,[0-9]* 表示任意多个数字:

/[1-9][0-9]*/

2.3、举例

  1     std::future<void> ft16 = async(std::launch::async,[&](){
  2 
  3         int count_maxtrix = 0; ////to store ---->size
  4 
  5         int it = 0;   //to store ---->rowArraySize
  6         int p = 0;    //to store ---->rowOffset
  7 
  8         int row = 0;  //to store ---->rowArray[x]
  9         int k = 0;    //to store ---->rowOffset*2
 10 
 11         int col = 0;    //to store ---->columnIndice
 12 
 13         double cond = 0; //to store ---->valueSpiceMatrix[k]
 14         double cap = 0; //to store ---->valueSpiceMatrix[k+1]
 15 
 16 
 17 
 18             /*
 19         function:Just for example ,for formula(7 8)
 20         Rnx1 = Dnx1 - Gnxn*Snx1
 21         Hnx1 = D'nx1 - Cnxn*Snx1
 22             */
 23         int kl = 0;     //to store ---->rowArray[]*2
 24         double current = 0;  //to store ---->D[kl]
 25         double charge = 0;   //to store ---->D[kl+1]
 26 
 27 
 28         // add here to enhance the speed
 29         int my_rowArraysize = 0;
 30         int my_rowOffset = 0;
 31         double my_s = 0;
 32 
 33         int maxtrix_begin  = size/16*7;
 34         int maxtrix_end = size/16*8;
 35 
 36 
 37         __m256d cond_m;
 38         __m256d cap_m;
 39         __m256d IG_Curr_m;
 40         __m256d IC_Char_m;
 41         __m256d A_m;
 42 
 43         double IG_Curr_array[4];
 44         double IC_Char_array[4];
 45         double A_m_array[4];
 46         int u_count;
 47         bool ready = 0;
 48 
 49         for (count_maxtrix = maxtrix_begin; count_maxtrix < maxtrix_end; ++count_maxtrix)
 50         {
 51 
 52                     //for (it = 0; it < (*(ptr+count_maxtrix))->rowArraySize; ++it)
 53             my_rowArraysize = (*(ptr+count_maxtrix))->rowArraySize;
 54             for (it = 0; it < my_rowArraysize; ++it)
 55             {
 56                 //…………………………………………formula(4 5)、(7 8)、(9) Share a for Loop………………………………………………………………
 57                 /*
 58                     Function:Just for example ,for formula(4 5)
 59                     IGnx1 = Gnxn*Snx1
 60                     ICnx1 = Cnxn*Snx1
 61                         */
 62                 row = (*(ptr+count_maxtrix))->rowArray[it];   //share
 63 
 64 
 65 
 66 
 67                 /*
 68                     function:Just for example ,for formula(7 8)
 69                     Rnx1 = Dnx1 - Gnxn*Snx1
 70                     Hnx1 = D'nx1 - Cnxn*Snx1
 71                     */
 72                 kl = row * 2;
 73 
 74                 current = (*(ptr+count_maxtrix))->D[kl];
 75                 charge = (*(ptr+count_maxtrix))->D[kl + 1];
 76 
 77 
 78 
 79                 //for (p = (*(ptr+count_maxtrix))->rowOffset[row]; p < (*(ptr+count_maxtrix))->rowOffset[row + 1]; ++p)
 80                 my_rowOffset = (*(ptr+count_maxtrix))->rowOffset[row + 1];
 81 
 82 
 83                 p = (*(ptr+count_maxtrix))->rowOffset[row];
 84                 //for (p = (*(ptr+count_maxtrix))->rowOffset[row]; p < my_rowOffset; ++p)
 85                 while((int)((my_rowOffset-p)/4) > 1)
 86                 {
 87                     //col = (*(ptr+count_maxtrix))->columnIndice[p];
 88                     k = p * 2;
 89                     //cond = (*(ptr+count_maxtrix))->valueSpiceMatrix[k];
 90                     //cap = (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1];
 91 
 92 
 93                     
 94                     /*
 95                     Function:Just for example ,for formula(4 5)
 96                     IGnx1 = Gnxn*Snx1
 97                     ICnx1 = Cnxn*Snx1
 98                         */
 99 
100                     //my_s = (*(ptr+count_maxtrix))->S[col];
101 
102                     //_mm256_blend_pd (__m256d a, __m256d b, const int imm8);
103 
104                     cond_m = _mm256_set_pd((*(ptr+count_maxtrix))->valueSpiceMatrix[k+6],
105                                             (*(ptr+count_maxtrix))->valueSpiceMatrix[k+4],
106                                             (*(ptr+count_maxtrix))->valueSpiceMatrix[k+2],
107                                             (*(ptr+count_maxtrix))->valueSpiceMatrix[k]);
108 
109                     
110                     cap_m = _mm256_set_pd((*(ptr+count_maxtrix))->valueSpiceMatrix[k + 7],
111                                     (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 5],
112                                     (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 3],
113                                     (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1]);
114                     /*
115                     alpha_m = _mm256_set_pd((*(ptr+count_maxtrix))->alpha,
116                                         (*(ptr+count_maxtrix))->alpha,
117                                         (*(ptr+count_maxtrix))->alpha,
118                                         (*(ptr+count_maxtrix))->alpha);
119 
120                     my_s_m =  _mm256_set_pd((*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+3]]
121                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+2]]
122                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+1]]
123                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p]]); */
124 
125                     IG_Curr_m = _mm256_mul_pd(cond_m
126                             ,_mm256_set_pd((*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+3]]
127                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+2]]
128                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+1]]
129                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p]]));
130                     IC_Char_m = _mm256_mul_pd(cap_m
131                                     ,_mm256_set_pd((*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+3]]
132                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+2]]
133                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p+1]]
134                                 ,(*(ptr+count_maxtrix))->S[(*(ptr+count_maxtrix))->columnIndice[p]]));
135 
136                     A_m = _mm256_add_pd(cond_m, _mm256_mul_pd(_mm256_set_pd((*(ptr+count_maxtrix))->alpha,
137                                         (*(ptr+count_maxtrix))->alpha,
138                                         (*(ptr+count_maxtrix))->alpha,
139                                         (*(ptr+count_maxtrix))->alpha)
140                                         ,cap_m));
141 
142         
143                     _mm256_storeu_pd(IG_Curr_array, IG_Curr_m);
144                     _mm256_storeu_pd(IC_Char_array, IC_Char_m);
145                     _mm256_storeu_pd(A_m_array, A_m);
146         
147 
148                     for(u_count = 0; u_count < 4; u_count++)
149                     {
150                             //(*(ptr+count_maxtrix))->Id[node] += ID_array[S_count];
151 
152                             (*(ptr+count_maxtrix))->IG[row] += IG_Curr_array[u_count];
153                             (*(ptr+count_maxtrix))->IC[row] += IC_Char_array[u_count];
154 
155                             /*                 
156                             current -= (*(ptr+count_maxtrix))->valueSpiceMatrix[k] * (*(ptr+count_maxtrix))->S[col];
157                             charge -= (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1] * (*(ptr+count_maxtrix))->S[col];
158                             */
159                             current -= IG_Curr_array[u_count];
160                             charge -= IC_Char_array[u_count];
161             
162 
163                             /*
164                             function:Just for example ,for formula(9)
165                             Anxn = Gnxn + alpha*Cnxn
166                                 */
167                             (*(ptr+count_maxtrix))->A[p+u_count] = A_m_array[u_count];
168                     }
169 
170 
171                     ready = 1;
172                     p += 4;
173 
174                 }
175 
176                 if(ready == 1)
177                 {
178                     //for (; j < my_rowOffset; ++j)
179                     while(p < my_rowOffset)
180                     {
181                         col = (*(ptr+count_maxtrix))->columnIndice[p];
182                         k = p * 2;
183                         cond = (*(ptr+count_maxtrix))->valueSpiceMatrix[k];
184                         cap = (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1];
185 
186 
187 
188                         /*
189                         Function:Just for example ,for formula(4 5)
190                         IGnx1 = Gnxn*Snx1
191                         ICnx1 = Cnxn*Snx1
192                             */
193 
194                         my_s = (*(ptr+count_maxtrix))->S[col];
195                         (*(ptr+count_maxtrix))->IG[row] += cond * my_s;
196                         (*(ptr+count_maxtrix))->IC[row] += cap * my_s;
197 
198 
199 
200 
201         /*                 current -= (*(ptr+count_maxtrix))->valueSpiceMatrix[k] * (*(ptr+count_maxtrix))->S[col];
202                         charge -= (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1] * (*(ptr+count_maxtrix))->S[col];
203         */
204                         current -= cond * my_s;
205                         charge -= cap * my_s;
206         
207 
208                         /*
209                         function:Just for example ,for formula(9)
210                         Anxn = Gnxn + alpha*Cnxn
211                             */
212                         (*(ptr+count_maxtrix))->A[p] = cond + (*(ptr+count_maxtrix))->alpha * cap;
213                         ++p;                    
214                     }
215                     ready = 0;
216                 }
217                 else
218                 {
219                     //for (; j < my_rowOffset; ++j)
220                     while(p < my_rowOffset)
221                     {
222                         col = (*(ptr+count_maxtrix))->columnIndice[p];
223                         k = p * 2;
224                         cond = (*(ptr+count_maxtrix))->valueSpiceMatrix[k];
225                         cap = (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1];
226 
227 
228 
229                         /*
230                         Function:Just for example ,for formula(4 5)
231                         IGnx1 = Gnxn*Snx1
232                         ICnx1 = Cnxn*Snx1
233                             */
234 
235                         my_s = (*(ptr+count_maxtrix))->S[col];
236                         (*(ptr+count_maxtrix))->IG[row] += cond * my_s;
237                         (*(ptr+count_maxtrix))->IC[row] += cap * my_s;
238 
239 
240 
241 
242         /*                 current -= (*(ptr+count_maxtrix))->valueSpiceMatrix[k] * (*(ptr+count_maxtrix))->S[col];
243                         charge -= (*(ptr+count_maxtrix))->valueSpiceMatrix[k + 1] * (*(ptr+count_maxtrix))->S[col];
244         */
245                         current -= cond * my_s;
246                         charge -= cap * my_s;
247         
248 
249                         /*
250                         function:Just for example ,for formula(9)
251                         Anxn = Gnxn + alpha*Cnxn
252                             */
253                         (*(ptr+count_maxtrix))->A[p] = cond + (*(ptr+count_maxtrix))->alpha * cap;
254                         
255                         ++p;
256                     }
257                 }
258 
259 
260                 /*
261                     function:Just for example ,for formula(7 8)
262                     Rnx1 = Dnx1 - Gnxn*Snx1
263                     Hnx1 = D'nx1 - Cnxn*Snx1
264                     */
265                 (*(ptr+count_maxtrix))->R[row] = current;
266                 (*(ptr+count_maxtrix))->H[row] = charge;
267 
268 
269 
270 
271             }
272         }
273     });
View Code

只需要在替换中输入正则表达式: ^  [0-9]     随后   ^ [0-9]    最后 ^[0-9]    

 

posted @ 2021-09-04 15:37  `Konoha  阅读(198)  评论(0编辑  收藏  举报