Skip to content
Snippets Groups Projects

David

Open david.carballo requested to merge david.carballo/poo2019numeric:David into master
2 files
+ 12
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -113,7 +113,7 @@ final public class Vector {
}
public static Vector of(List<Double> elements) {
return new Vector(elements);
return new Vector(elements);
}
public static Vector empty() {
@@ -137,8 +137,15 @@ final public class Vector {
return Vector.fill(nb,1.0);
}
public static Vector linespace(double from, double to, int nb) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
public static Vector linespace(double from, double to, int nb)
{
double step=to/(nb-1);
Vector v = Vector.zeros(nb);
for(int i=0;i<nb;i++)
{
v.set(i,step*i);
}
return v;
}
public static Vector tabulate(int nb, Function<Integer, Double> f) {
Loading