Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
GEOMETRY-126: replacing usage of commons-numbers LinearCombination wi…
…th Sum; adding VectorXD.Sum classes
- Loading branch information
Showing
28 changed files
with
535 additions
and
485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.commons.geometry.euclidean; | ||
|
||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
/** Class representing a sum of Euclidean vectors. | ||
* @param <V> Vector implementation type | ||
*/ | ||
public abstract class EuclideanVectorSum<V extends EuclideanVector<V>> | ||
implements Supplier<V>, Consumer<V> { | ||
|
||
/** Add a vector to this instance. This method is an alias for {@link #add(EuclideanVector)}. | ||
* @param vec vector to add | ||
*/ | ||
@Override | ||
public void accept(final V vec) { | ||
add(vec); | ||
} | ||
|
||
/** Add a vector to this instance. | ||
* @param vec vector to add | ||
* @return this instance | ||
*/ | ||
public abstract EuclideanVectorSum<V> add(V vec); | ||
|
||
/** Add a scaled vector to this instance. In general, the result produced by this method | ||
* will be more accurate than if the vector was scaled first and then added directly. In other | ||
* words, {@code sum.addScale(scale, vec)} will generally produce a better result than | ||
* {@code sum.add(vec.multiply(scale))}. | ||
* @param scale scale factor | ||
* @param vec vector to scale and add | ||
* @return this instance | ||
*/ | ||
public abstract EuclideanVectorSum<V> addScaled(double scale, V vec); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.