@@ -90,7 +90,7 @@ public override int Keep(Func<int, int, Complex, bool> func)
90
90
if ( AutoTrimStorage )
91
91
{
92
92
// Remove extra space.
93
- this . Resize ( 0 ) ;
93
+ Resize ( 0 ) ;
94
94
}
95
95
96
96
return nz ;
@@ -99,8 +99,6 @@ public override int Keep(Func<int, int, Complex, bool> func)
99
99
/// <inheritdoc />
100
100
public override double L1Norm ( )
101
101
{
102
- int nz = this . NonZerosCount ;
103
-
104
102
double sum , norm = 0.0 ;
105
103
106
104
for ( int j = 0 ; j < columns ; j ++ )
@@ -119,8 +117,6 @@ public override double L1Norm()
119
117
/// <inheritdoc />
120
118
public override double InfinityNorm ( )
121
119
{
122
- int nz = this . NonZerosCount ;
123
-
124
120
var work = new double [ rows ] ;
125
121
126
122
for ( int j = 0 ; j < columns ; j ++ )
@@ -144,9 +140,9 @@ public override double InfinityNorm()
144
140
/// <inheritdoc />
145
141
public override double FrobeniusNorm ( )
146
142
{
147
- int nz = this . NonZerosCount ;
143
+ int nz = NonZerosCount ;
148
144
149
- double sum = 0.0 , norm = 0.0 ;
145
+ double sum , norm = 0.0 ;
150
146
151
147
for ( int i = 0 ; i < nz ; i ++ )
152
148
{
@@ -164,9 +160,9 @@ public override double FrobeniusNorm()
164
160
/// <inheritdoc />
165
161
public override void Multiply ( ReadOnlySpan < Complex > x , Span < Complex > y )
166
162
{
167
- var ax = this . Values ;
168
- var ap = this . ColumnPointers ;
169
- var ai = this . RowIndices ;
163
+ var ax = Values ;
164
+ var ap = ColumnPointers ;
165
+ var ai = RowIndices ;
170
166
171
167
// Clear y.
172
168
for ( int i = 0 ; i < rows ; i ++ )
@@ -191,9 +187,9 @@ public override void Multiply(ReadOnlySpan<Complex> x, Span<Complex> y)
191
187
/// <inheritdoc />
192
188
public override void Multiply ( Complex alpha , ReadOnlySpan < Complex > x , Complex beta , Span < Complex > y )
193
189
{
194
- var ax = this . Values ;
195
- var ap = this . ColumnPointers ;
196
- var ai = this . RowIndices ;
190
+ var ax = Values ;
191
+ var ap = ColumnPointers ;
192
+ var ai = RowIndices ;
197
193
198
194
// Scale y by beta
199
195
for ( int j = 0 ; j < rows ; j ++ )
@@ -220,9 +216,9 @@ public override void Multiply(Complex alpha, ReadOnlySpan<Complex> x, Complex be
220
216
/// <inheritdoc />
221
217
public override void TransposeMultiply ( ReadOnlySpan < Complex > x , Span < Complex > y )
222
218
{
223
- var ax = this . Values ;
224
- var ap = this . ColumnPointers ;
225
- var ai = this . RowIndices ;
219
+ var ax = Values ;
220
+ var ap = ColumnPointers ;
221
+ var ai = RowIndices ;
226
222
227
223
Complex yi ;
228
224
@@ -244,9 +240,9 @@ public override void TransposeMultiply(ReadOnlySpan<Complex> x, Span<Complex> y)
244
240
/// <inheritdoc />
245
241
public override void TransposeMultiply ( Complex alpha , ReadOnlySpan < Complex > x , Complex beta , Span < Complex > y )
246
242
{
247
- var ax = this . Values ;
248
- var ap = this . ColumnPointers ;
249
- var ai = this . RowIndices ;
243
+ var ax = Values ;
244
+ var ap = ColumnPointers ;
245
+ var ai = RowIndices ;
250
246
251
247
Complex yi ;
252
248
@@ -334,8 +330,8 @@ public override void Add(Complex alpha, Complex beta, CompressedColumnStorage<Co
334
330
335
331
int p , j , nz = 0 ;
336
332
337
- int m = this . rows ;
338
- int n = this . columns ;
333
+ int m = rows ;
334
+ int n = columns ;
339
335
340
336
// check inputs
341
337
if ( m != other . RowCount || n != other . ColumnCount )
@@ -356,7 +352,7 @@ public override void Add(Complex alpha, Complex beta, CompressedColumnStorage<Co
356
352
for ( j = 0 ; j < n ; j ++ )
357
353
{
358
354
ci [ j ] = nz ; // column j of C starts here
359
- nz = this . Scatter ( j , alpha , w , x , j + 1 , result , nz ) ; // alpha*A(:,j)
355
+ nz = Scatter ( j , alpha , w , x , j + 1 , result , nz ) ; // alpha*A(:,j)
360
356
nz = other . Scatter ( j , beta , w , x , j + 1 , result , nz ) ; // beta*B(:,j)
361
357
362
358
for ( p = ci [ j ] ; p < nz ; p ++ )
@@ -394,18 +390,18 @@ public override void Multiply(CompressedColumnStorage<Complex> other, Compressed
394
390
int [ ] cp , ci ;
395
391
Complex [ ] cx ;
396
392
397
- int m = this . rows ;
393
+ int m = rows ;
398
394
int n = other . ColumnCount ;
399
395
400
- int anz = this . NonZerosCount ;
396
+ int anz = NonZerosCount ;
401
397
int bnz = other . NonZerosCount ;
402
398
403
- if ( this . ColumnCount != other . RowCount )
399
+ if ( ColumnCount != other . RowCount )
404
400
{
405
401
throw new ArgumentException ( Resources . MatrixDimensions , nameof ( other ) ) ;
406
402
}
407
403
408
- if ( ( m > 0 && this . ColumnCount == 0 ) || ( other . RowCount == 0 && n > 0 ) )
404
+ if ( ( m > 0 && ColumnCount == 0 ) || ( other . RowCount == 0 && n > 0 ) )
409
405
{
410
406
throw new Exception ( Resources . InvalidDimensions ) ;
411
407
}
@@ -436,7 +432,7 @@ public override void Multiply(CompressedColumnStorage<Complex> other, Compressed
436
432
cp [ j ] = nz ; // column j of C starts here
437
433
for ( p = bp [ j ] ; p < bp [ j + 1 ] ; p ++ )
438
434
{
439
- nz = this . Scatter ( bi [ p ] , bx [ p ] , w , x , j + 1 , result , nz ) ;
435
+ nz = Scatter ( bi [ p ] , bx [ p ] , w , x , j + 1 , result , nz ) ;
440
436
}
441
437
442
438
for ( p = cp [ j ] ; p < nz ; p ++ )
@@ -461,16 +457,16 @@ public override void Multiply(CompressedColumnStorage<Complex> other, Compressed
461
457
/// </summary>
462
458
public override bool IsSymmetric ( )
463
459
{
464
- int n = this . ColumnCount ;
460
+ int n = ColumnCount ;
465
461
466
- if ( this . RowCount != n )
462
+ if ( RowCount != n )
467
463
{
468
464
return false ;
469
465
}
470
466
471
- var ax = this . Values ;
472
- var ap = this . ColumnPointers ;
473
- var ai = this . RowIndices ;
467
+ var ax = Values ;
468
+ var ap = ColumnPointers ;
469
+ var ai = RowIndices ;
474
470
475
471
for ( var i = 0 ; i < n ; i ++ )
476
472
{
@@ -500,30 +496,30 @@ public override bool Equals(Matrix<Complex> other, double tolerance)
500
496
return false ;
501
497
}
502
498
503
- int nz = this . NonZerosCount ;
499
+ int nz = NonZerosCount ;
504
500
505
- if ( this . columns != o . ColumnCount || this . rows != o . RowCount || nz != o . NonZerosCount )
501
+ if ( columns != o . ColumnCount || rows != o . RowCount || nz != o . NonZerosCount )
506
502
{
507
503
return false ;
508
504
}
509
505
510
- for ( int i = 0 ; i < this . columns ; i ++ )
506
+ for ( int i = 0 ; i < columns ; i ++ )
511
507
{
512
- if ( this . ColumnPointers [ i ] != o . ColumnPointers [ i ] )
508
+ if ( ColumnPointers [ i ] != o . ColumnPointers [ i ] )
513
509
{
514
510
return false ;
515
511
}
516
512
}
517
513
518
514
for ( int i = 0 ; i < nz ; i ++ )
519
515
{
520
- if ( this . RowIndices [ i ] != o . RowIndices [ i ] )
516
+ if ( RowIndices [ i ] != o . RowIndices [ i ] )
521
517
{
522
518
return false ;
523
519
}
524
520
525
- if ( Math . Abs ( this . Values [ i ] . Real - o . Values [ i ] . Real ) > tolerance ||
526
- Math . Abs ( this . Values [ i ] . Imaginary - o . Values [ i ] . Imaginary ) > tolerance )
521
+ if ( Math . Abs ( Values [ i ] . Real - o . Values [ i ] . Real ) > tolerance ||
522
+ Math . Abs ( Values [ i ] . Imaginary - o . Values [ i ] . Imaginary ) > tolerance )
527
523
{
528
524
return false ;
529
525
}
@@ -566,12 +562,12 @@ internal override void Cleanup()
566
562
ColumnPointers [ i ] = q ; // Record start of row i
567
563
}
568
564
569
- this . ColumnPointers [ columns ] = nnz ;
565
+ ColumnPointers [ columns ] = nnz ;
570
566
571
567
if ( AutoTrimStorage )
572
568
{
573
569
// Remove extra space from arrays
574
- this . Resize ( 0 ) ;
570
+ Resize ( 0 ) ;
575
571
}
576
572
}
577
573
0 commit comments