Returns a suitable vector that can be altered for some function of the form a op b, where a = this @param other the other vector. May be null @return the mutable vector
(Vec other)
| 69 | * @return the mutable vector |
| 70 | */ |
| 71 | private Vec getThisSide(Vec other) |
| 72 | { |
| 73 | if (this.canBeMutated()) |
| 74 | return this.clone(); |
| 75 | if (other == null) |
| 76 | if (this.isSparse()) |
| 77 | return new SparseVector(this); |
| 78 | else |
| 79 | return new DenseVector(this); |
| 80 | if (this.isSparse() && other.isSparse()) |
| 81 | return new SparseVector(this); |
| 82 | else |
| 83 | return new DenseVector(this); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Computes the number of non zero values in this vector |
no test coverage detected