Skip to content

Commit 1d14fba

Browse files
committed
code cosmetics
1 parent c17dd45 commit 1d14fba

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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>

src/main/java/net/jamu/matrix/ComplexMatrixDBase.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
}

src/main/java/net/jamu/matrix/ComplexMatrixFBase.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
}

0 commit comments

Comments
 (0)