/** * 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); }
/** * 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 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); }
/** * <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 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); }
/** * <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; }
/** * <p>Returns a vector with as many elements as resources, containing the currently occupied capacity (in the own resource capacity units), for each resource. * * @return The vector */ public DoubleMatrix1D getVectorResourceOccupiedCapacity() { DoubleMatrix1D res = DoubleFactory1D.dense.make(resources.size()); for (Resource e : resources) res.set(e.index, e.getOccupiedCapacity()); return res; }
/** * Constructs a matrix with uniformly distributed values in <tt>(0,1)</tt> * (exclusive). */ public DoubleMatrix1D random(int size) { return make(size).assign(cern.jet.math.tdouble.DoubleFunctions.random()); }
/** * Constructs a matrix with uniformly distributed values in <tt>(0,1)</tt> * (exclusive). */ public DoubleMatrix1D random(int size) { return make(size).assign(cern.jet.math.tdouble.DoubleFunctions.random()); }
/** Returns the carried traffic per link. * * @param x_de Demand-link routing in the form x_de (amount of traffic from demand d, transmitted through link e) * @return Carried traffic per link */ public static DoubleMatrix1D convert_xde2ye(DoubleMatrix2D x_de) { return x_de.zMult(DoubleFactory1D.dense.make(x_de.columns(), 1), null); }
private void computeBetweenessCentrality() { Graph<Node, Link> aux_graph = getGraph_JUNG(); BetweennessCentrality bc = new BetweennessCentrality(aux_graph, getCostTransformer()); nodeBetweenessCentrality = DoubleFactory1D.dense.make (N); for (Node node : this.nodes) nodeBetweenessCentrality.set(node.getIndex () , bc.getVertexScore(node)); linkBetweenessCentrality = DoubleFactory1D.dense.make (E); for (Link link : linkMap) linkBetweenessCentrality.set(link.getIndex (), bc.getEdgeScore(link)); }
/** * * @param x * @return [x(1)-x(0) x(2)-x(1) ... x(n)-x(n-1)] */ public static DoubleMatrix1D diff(DoubleMatrix1D x) { int size = (int) x.size() -1; DoubleMatrix1D d = DoubleFactory1D.dense.make(size); for (int i = 0; i < size; i++) d.set(i, dfunc.minus.apply(x.get(i+1), x.get(i))); return d; }
/** * * @param x * @return [x(1)-x(0) x(2)-x(1) ... x(n)-x(n-1)] */ public static DoubleMatrix1D diff(DoubleMatrix1D x) { int size = (int) x.size() -1; DoubleMatrix1D d = DoubleFactory1D.dense.make(size); for (int i = 0; i < size; i++) d.set(i, dfunc.minus.apply(x.get(i+1), x.get(i))); return d; }
/** * * @param x * @return [x(1)-x(0) x(2)-x(1) ... x(n)-x(n-1)] */ public static DoubleMatrix1D diff(DoubleMatrix1D x) { int size = (int) x.size() -1; DoubleMatrix1D d = DoubleFactory1D.dense.make(size); for (int i = 0; i < size; i++) d.set(i, dfunc.minus.apply(x.get(i+1), x.get(i))); return d; }
private DoubleMatrix1D computePe_restoration (DoubleMatrix2D x_rs) { DoubleMatrix2D p_es = A_er.zMult(x_rs, null); DoubleMatrix1D p_e = DoubleFactory1D.dense.make(Efm); for (int e = 0; e < Efm ; e ++) p_e.set(e , p_es.viewRow(e).getMaxLocation() [0]); // the maximum per state s p_e.assign(DoubleFunctions.div(tcfa_linkCapacity_numCirc.getInt ())).assign(DoubleFunctions.ceil); return p_e; }
/** * C = A||B; Constructs a new matrix which is the concatenation of two other * matrices. Example: <tt>0 1</tt> append <tt>3 4</tt> --> <tt>0 1 3 4</tt>. */ public DoubleMatrix1D append(DoubleMatrix1D A, DoubleMatrix1D B) { // concatenate DoubleMatrix1D matrix = make((int) (A.size() + B.size())); matrix.viewPart(0, (int) A.size()).assign(A); matrix.viewPart((int) A.size(), (int) B.size()).assign(B); return matrix; }
/** * C = A||B; Constructs a new matrix which is the concatenation of two other * matrices. Example: <tt>0 1</tt> append <tt>3 4</tt> --> <tt>0 1 3 4</tt>. */ public DoubleMatrix1D append(DoubleMatrix1D A, DoubleMatrix1D B) { // concatenate DoubleMatrix1D matrix = make((int) (A.size() + B.size())); matrix.viewPart(0, (int) A.size()).assign(A); matrix.viewPart((int) A.size(), (int) B.size()).assign(B); return matrix; }