File tree Expand file tree Collapse file tree 3 files changed +23
-21
lines changed
src/main/java/net/jamu/matrix Expand file tree Collapse file tree 3 files changed +23
-21
lines changed Original file line number Diff line number Diff line change 44 <groupId >net.sourceforge.streamsupport</groupId >
55 <artifactId >jamu</artifactId >
66 <packaging >jar</packaging >
7- <version >1.4.6 </version >
7+ <version >1.4.7-SNAPSHOT-1 </version >
88 <name >JAMU</name >
99 <description >Java Matrix Utilities built on top of Intel MKL</description >
1010 <url >https://github.com/stefan-zobel/JAMU/</url >
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2020, 2024 Stefan Zobel
2+ * Copyright 2020, 2025 Stefan Zobel
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -157,15 +157,16 @@ public ComplexMatrixD addInplace(ComplexMatrixD B) {
157157 @ Override
158158 public ComplexMatrixD addInplace (double alphar , double alphai , ComplexMatrixD B ) {
159159 Checks .checkEqualDimension (this , B );
160- if (alphar != 0.0 || alphai != 0.0 ) {
161- double [] _a = a ;
162- double [] _b = B .getArrayUnsafe ();
163- for (int i = 0 ; i < _b .length ; i += 2 ) {
164- double bi = _b [i ];
165- double bip1 = _b [i + 1 ]; // "lgtm[java/index-out-of-bounds]"
166- _a [i ] = _a [i ] + (bi * alphar - bip1 * alphai );
167- _a [i + 1 ] = _a [i + 1 ] + (bi * alphai + bip1 * alphar );
168- }
160+ if (alphar == 0.0 && alphai == 0.0 ) {
161+ return this ;
162+ }
163+ double [] _a = a ;
164+ double [] _b = B .getArrayUnsafe ();
165+ for (int i = 0 ; i < _b .length ; i += 2 ) {
166+ double bi = _b [i ];
167+ double bip1 = _b [i + 1 ]; // "lgtm[java/index-out-of-bounds]"
168+ _a [i ] += (bi * alphar - bip1 * alphai );
169+ _a [i + 1 ] += (bi * alphai + bip1 * alphar );
169170 }
170171 return this ;
171172 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2020, 2024 Stefan Zobel
2+ * Copyright 2020, 2025 Stefan Zobel
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -157,15 +157,16 @@ public ComplexMatrixF addInplace(ComplexMatrixF B) {
157157 @ Override
158158 public ComplexMatrixF addInplace (float alphar , float alphai , ComplexMatrixF B ) {
159159 Checks .checkEqualDimension (this , B );
160- if (alphar != 0.0f || alphai != 0.0f ) {
161- float [] _a = a ;
162- float [] _b = B .getArrayUnsafe ();
163- for (int i = 0 ; i < _b .length ; i += 2 ) {
164- float bi = _b [i ];
165- float bip1 = _b [i + 1 ]; // "lgtm[java/index-out-of-bounds]"
166- _a [i ] = _a [i ] + (bi * alphar - bip1 * alphai );
167- _a [i + 1 ] = _a [i + 1 ] + (bi * alphai + bip1 * alphar );
168- }
160+ if (alphar == 0.0f && alphai == 0.0f ) {
161+ return this ;
162+ }
163+ float [] _a = a ;
164+ float [] _b = B .getArrayUnsafe ();
165+ for (int i = 0 ; i < _b .length ; i += 2 ) {
166+ float bi = _b [i ];
167+ float bip1 = _b [i + 1 ]; // "lgtm[java/index-out-of-bounds]"
168+ _a [i ] += (bi * alphar - bip1 * alphai );
169+ _a [i + 1 ] += (bi * alphai + bip1 * alphar );
169170 }
170171 return this ;
171172 }
You can’t perform that action at this time.
0 commit comments