RLPark 1.0.0
Reinforcement Learning Framework in Java

AbstractVector.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.math.vector.implementations;
00002 
00003 import rlpark.plugin.rltoys.math.vector.MutableVector;
00004 import rlpark.plugin.rltoys.math.vector.RealVector;
00005 import rlpark.plugin.rltoys.math.vector.SparseVector;
00006 
00007 public abstract class AbstractVector implements RealVector {
00008   private static final long serialVersionUID = 5863507432853349597L;
00009   public final int size;
00010 
00011   protected AbstractVector(int size) {
00012     this.size = size;
00013   }
00014 
00015   @Override
00016   public MutableVector add(RealVector other) {
00017     return copyAsMutable().addToSelf(other);
00018   }
00019 
00020   @Override
00021   public MutableVector mapMultiply(double d) {
00022     return copyAsMutable().mapMultiplyToSelf(d);
00023   }
00024 
00025   @Override
00026   public MutableVector subtract(RealVector other) {
00027     return copyAsMutable().subtractToSelf(other);
00028   }
00029 
00030   @Override
00031   public MutableVector ebeMultiply(RealVector other) {
00032     if (other instanceof SparseVector)
00033       return other.copyAsMutable().ebeMultiplyToSelf(this);
00034     return copyAsMutable().ebeMultiplyToSelf(other);
00035   }
00036 
00037   @Override
00038   public int getDimension() {
00039     return size;
00040   }
00041 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark