您的位置:首页 > 编程语言

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

2021-09-04 15:37 633 查看

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

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

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

方法二:正则表达式替换

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

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

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]    

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: