/*
 * Copyright (c) 2016 Jacob Rachiele
 * 
 */
package linear;

import java.util.ArrayList;
import java.util.List;

import math.Complex;

/**
 * Static methods for creating complex-valued vectors.
 * 
 *
 */
public final class ComplexVectors {

  private ComplexVectors() {}

  public static FieldVector<Complex> linearCombination(List<FieldVector<Complex>> vectors, List<Complex> scalars) {
    FieldVector<Complex> result = zeroVector(scalars.size());
    for (int i = 0; i < vectors.size(); i++) {
      result = result.plus(vectors.get(i).scaledBy(scalars.get(i)));
    }
    return result;
  }

  public static FieldVector<Complex> axpy(final FieldVector<Complex> x, final FieldVector<Complex> y,
      final Complex alpha) {
    return (x.scaledBy(alpha).plus(y));
  }

  public static FieldVector<Complex> zeroVector(final int size) {
    List<Complex> zeros = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
      zeros.add(new Complex(0, 0));
    }
    return new FieldVector<>(zeros);
  }

}

@@ -270,16 +270,304 @@
 s() %7B%7D%0A%0A
+  /**%0A   * Produce a linear combination from the given vectors and scalars.%0A   * @param vectors the vector components of the linear combination.%0A   * @param scalars the scalar components of the linear combination.%0A   * @return a linear combination of the given vectors and scalars.%0A   */%0A
   public
@@ -878,24 +878,300 @@
 esult;%0A  %7D%0A%0A
+  /**%0A   * Scale vector x by &alpha; then add y and return the result in a new vector.%0A   * @param x the vector to be scaled.%0A   * @param y the vector to be added to scaled x.%0A   * @param alpha the scalar to scale x by.%0A   * @return x scaled by &alpha; then added to y.%0A   */%0A
   public sta
@@ -1334,16 +1334,162 @@
 );%0A  %7D%0A%0A
+  /**%0A   * Create a new vector filled with zeros.%0A   * @param size the size of the new vector.%0A   * @return a new vector filled with zeros.%0A   */%0A
   public

Add javadoc for ComplexVectors