/** * Returns the imaginary parts of the eigenvalues. * * @return imag(diag(D)) */ public DoubleMatrix1D getImagEigenvalues() { return DoubleFactory1D.dense.make(e); }
/** * Constructs a matrix with cells having ascending values. For debugging * purposes. Example: <tt>0 1 2</tt> */ public DoubleMatrix1D ascending(int size) { return descending(size).assign(DoubleFunctions.chain(DoubleFunctions.neg, DoubleFunctions.minus(size))); }
public static void zdemo8(int size) { System.out.println("\n\n"); System.out.println("now initializing... "); final cern.jet.math.tdouble.DoubleFunctions F = cern.jet.math.tdouble.DoubleFunctions.functions; DoubleMatrix1D A = cern.colt.matrix.tdouble.DoubleFactory1D.dense.random(size); System.out.print("now quick sorting... "); cern.colt.Timer timer = new cern.colt.Timer().start(); quickSort.sort(A); timer.stop().display(); System.out.print("now merge sorting... "); timer.reset().start(); mergeSort.sort(A); timer.stop().display(); }
bin.addAllOf(DoubleFactory1D.dense.toList(vector)); return bin;
/** * Constructs a matrix with cells having ascending values. For debugging * purposes. Example: <tt>0 1 2</tt> */ public DoubleMatrix1D ascending(int size) { return descending(size).assign(DoubleFunctions.chain(DoubleFunctions.neg, DoubleFunctions.minus(size))); }
public static void zdemo8(int size) { System.out.println("\n\n"); System.out.println("now initializing... "); final cern.jet.math.tdouble.DoubleFunctions F = cern.jet.math.tdouble.DoubleFunctions.functions; DoubleMatrix1D A = cern.colt.matrix.tdouble.DoubleFactory1D.dense.random(size); System.out.print("now quick sorting... "); cern.colt.Timer timer = new cern.colt.Timer().start(); quickSort.sort(A); timer.stop().display(); System.out.print("now merge sorting... "); timer.reset().start(); mergeSort.sort(A); timer.stop().display(); }
bin.addAllOf(DoubleFactory1D.dense.toList(vector)); return bin;
/** * Returns the real parts of the eigenvalues. * * @return real(diag(D)) */ public DoubleMatrix1D getRealEigenvalues() { return DoubleFactory1D.dense.make(d); }
/** * Returns the imaginary parts of the eigenvalues. * * @return imag(diag(D)) */ public DoubleMatrix1D getImagEigenvalues() { return DoubleFactory1D.dense.make(e); }
/** * Returns the real parts of the eigenvalues. * * @return real(diag(D)) */ public DoubleMatrix1D getRealEigenvalues() { return DoubleFactory1D.dense.make(d); }
/** * Constructs a matrix with cells having descending values. For debugging * purposes. Example: <tt>2 1 0</tt> */ public DoubleMatrix1D descending(int size) { DoubleMatrix1D matrix = make(size); int v = 0; for (int i = size; --i >= 0;) { matrix.setQuick(i, v++); } return matrix; }
/** * Constructs a matrix with the given shape, each cell initialized with the * given value. */ public DoubleMatrix1D make(int size, double initialValue) { return make(size).assign(initialValue); }
/** * Constructs a matrix with cells having descending values. For debugging * purposes. Example: <tt>2 1 0</tt> */ public DoubleMatrix1D descending(int size) { DoubleMatrix1D matrix = make(size); int v = 0; for (int i = size; --i >= 0;) { matrix.setQuick(i, v++); } return matrix; }
/** * <p>Returns a vector with the up/down state of the nodes (1 up, 0 down). i-th vector corresponds to i-th index of the element</p> * * @return The vector with the up/down state of the nodes. */ public DoubleMatrix1D getVectorNodeUpState() { DoubleMatrix1D res = DoubleFactory1D.dense.make(nodes.size()); for (Node e : nodes) res.set(e.index, e.isUp ? 1 : 0); return res; }
/** * Constructs a matrix with the given shape, each cell initialized with the * given value. */ public DoubleMatrix1D make(int size, double initialValue) { return make(size).assign(initialValue); }
/** * <p>Returns a vector with the population of the nodes. i-th vector corresponds to i-th index of the element</p> * @return see above */ public DoubleMatrix1D getVectorNodePopulation() { DoubleMatrix1D res = DoubleFactory1D.dense.make(nodes.size()); for (Node e : nodes) res.set(e.index, e.population); return res; }
/** * <p>Returns a vector with as many elements as resources, containing a 1 in coordinate of index i if the resource of index i is of the given type, a 0 if not. * * @param type the resource type * @return The vector */ public DoubleMatrix1D getVectorResourceIsOfType(String type) { DoubleMatrix1D res = DoubleFactory1D.dense.make(resources.size()); SortedSet<Resource> resourcesThisType = cache_type2Resources.get(type); if (resourcesThisType == null) return res; for (Resource e : resourcesThisType) res.set(e.index, 1.0); return res; }
/** * <p>Returns a vector with the number of links per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.</p> * * @param optionalLayerParameter network layer (optional) * @return The vector with the number of links per multicast tree */ public DoubleMatrix1D getVectorMulticastTreeNumberOfLinks(NetworkLayer... optionalLayerParameter) { NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); DoubleMatrix1D res = DoubleFactory1D.dense.make(layer.multicastTrees.size()); for (MulticastTree e : layer.multicastTrees) res.set(e.index, e.linkSet.size()); return res; }
/** * <p>Returns a vector with the blocked traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.</p> * * @param optionalLayerParameter Network layer (optional) * @return The vector with the blocked traffic per demand */ public DoubleMatrix1D getVectorDemandBlockedTraffic(NetworkLayer... optionalLayerParameter) { NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); DoubleMatrix1D res = DoubleFactory1D.dense.make(layer.demands.size()); for (Demand e : layer.demands) res.set(e.index, Math.max(0, e.offeredTraffic - e.carriedTraffic)); return res; }
/** * <p>Returns a vector with as many elements as resources, containing the capacity (in the own resource capacity units), for each resource. * * @return The vector */ public DoubleMatrix1D getVectorResourceCapacity() { DoubleMatrix1D res = DoubleFactory1D.dense.make(resources.size()); for (Resource e : resources) res.set(e.index, e.getCapacity()); return res; }