Skip to content

Commit

Permalink
.travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
apete committed Dec 19, 2017
1 parent 5f4852e commit 3b9631d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
1 change: 1 addition & 0 deletions .travis.yml
@@ -0,0 +1 @@
language: java
16 changes: 16 additions & 0 deletions src/org/ojalgo/matrix/transformation/MatrixTransformation.java
Expand Up @@ -24,12 +24,28 @@
import org.ojalgo.matrix.store.PhysicalStore;

/**
* <p>
* Represents an in-place matrix transformation – the matrix/vector operated on is mutated. A
* MatrixTransformation instance represents an implied transformation matrix (to be used as the input argument
* to the {@link PhysicalStore#multiply(org.ojalgo.matrix.store.MatrixStore)} or
* {@link PhysicalStore#premultiply(org.ojalgo.access.Access1D)} methods). But, this interface does not
* require you to disclose the size and shape of that matrix, nor to be able to explicitly access any of the
* individual elements.
* </p>
* <p>
* A vector transfomation is normally defind as:
*
* <pre>
* [transformed vector/matrix] = [transformation matrix] x [original vector/matrix]
* </pre>
*
* Here we make 2 changes to that definition (1 specialisation and 1 generalisation):
* <ol>
* <li>The target vector/matrix is transformed in-place.</li>
* <li>Not restricted to transformations that can be expressed as premultiplication by some matrix - you can
* transform the target vector/matrix any way you want.</li>
* </ol>
* </p>
*
* @author apete
*/
Expand Down
28 changes: 14 additions & 14 deletions src/org/ojalgo/scalar/Quaternion.java
Expand Up @@ -1073,28 +1073,28 @@ public void transform(final PhysicalStore<Double> matrix) {

} else if (matrix.countRows() == 3L) {

for (long j = 0L, limit = matrix.countColumns(); j < limit; j++) {
for (long c = 0L, limit = matrix.countColumns(); c < limit; c++) {

final double x = matrix.doubleValue(0, j);
final double y = matrix.doubleValue(1, j);
final double z = matrix.doubleValue(2, j);
final double x = matrix.doubleValue(0, c);
final double y = matrix.doubleValue(1, c);
final double z = matrix.doubleValue(2, c);

matrix.set(0, j, (r00 * x) + (r01 * y) + (r02 * z));
matrix.set(1, j, (r10 * x) + (r11 * y) + (r12 * z));
matrix.set(2, j, (r20 * x) + (r21 * y) + (r22 * z));
matrix.set(0, c, (r00 * x) + (r01 * y) + (r02 * z));
matrix.set(1, c, (r10 * x) + (r11 * y) + (r12 * z));
matrix.set(2, c, (r20 * x) + (r21 * y) + (r22 * z));
}

} else if (matrix.countColumns() == 3L) {

for (long i = 0L, limit = matrix.countRows(); i < limit; i++) {
for (long r = 0L, limit = matrix.countRows(); r < limit; r++) {

final double x = matrix.doubleValue(i, 0);
final double y = matrix.doubleValue(i, 1);
final double z = matrix.doubleValue(i, 2);
final double x = matrix.doubleValue(r, 0);
final double y = matrix.doubleValue(r, 1);
final double z = matrix.doubleValue(r, 2);

matrix.set(i, 0, (r00 * x) + (r01 * y) + (r02 * z));
matrix.set(i, 1, (r10 * x) + (r11 * y) + (r12 * z));
matrix.set(i, 2, (r20 * x) + (r21 * y) + (r22 * z));
matrix.set(r, 0, (r00 * x) + (r01 * y) + (r02 * z));
matrix.set(r, 1, (r10 * x) + (r11 * y) + (r12 * z));
matrix.set(r, 2, (r20 * x) + (r21 * y) + (r22 * z));
}

} else {
Expand Down

0 comments on commit 3b9631d

Please sign in to comment.