Get unit vectors pointing to the different pixels.

        *pos* and *vel* are column vectors, or matrices of column
        vectors. Returns vectors as stacked rows.
971000
def vectors(self, pos, vel, roll=0.0, pitch=0.0, yaw=0.0):
        
        # TODO: yaw steering mode !

        # Fake nadir: This is the intersection point between the satellite
        # looking down at the centre of the ellipsoid and the surface of the
        # ellipsoid. Nadir on the other hand is the point which vertical goes
        # through the satellite...
        # nadir = -pos / vnorm(pos)

        nadir = subpoint(-pos)
        nadir /= vnorm(nadir)

        # x is along track (roll)
        x = vel / vnorm(vel)

        # y is cross track (pitch)
        y = np.cross(nadir, vel, 0, 0, 0)
        y /= vnorm(y)

        # rotate first around x
        x_rotated = qrotate(nadir, x, self.fovs[0] + roll)
        # then around y
        xy_rotated = qrotate(x_rotated, y, self.fovs[1] + pitch)
        # then around z
        return qrotate(xy_rotated, nadir, yaw)
270718
private Vector3d getReferenceAxisCylic() {
		if (rotationGroup.getPointGroup().equals("C2")) {
			Vector3d vr = new Vector3d(subunits.getOriginalCenters().get(0));
			vr.sub(subunits.getCentroid());
			vr.normalize();
			return vr;
		}

		// get principal axis vector that is perpendicular to the principal
		// rotation vector
		Vector3d vmin = null;
		double dotMin = 1.0;
		for (Vector3d v: principalAxesOfInertia) {
			if (Math.abs(principalRotationVector.dot(v)) < dotMin) {
				dotMin = Math.abs(principalRotationVector.dot(v));
				vmin = new Vector3d(v);
			}
		}
		if (principalRotationVector.dot(vmin) < 0) {
			vmin.negate();
		}

		return vmin;
	}
1232933
def get_psd_product(self, vector, dtype=None):
    
    # For convenience, think of x as [\alpha, \beta]
    if dtype is None:
      dtype = self.nn_dtype
    vector = tf.cast(vector, self.nn_dtype)
    alpha = tf.reshape(vector[0], shape=[1, 1])
    beta = vector[1:]
    # Computing the product of matrix_h with beta part of vector
    # At first layer, h is simply diagonal
    h_beta = self.get_h_product(beta)

    # Constructing final result using vector_g
    result = tf.concat(
        [
            alpha * self.nu + tf.reduce_sum(tf.multiply(beta, self.vector_g)),
            tf.multiply(alpha, self.vector_g) + h_beta
        ],
        axis=0)
    return tf.cast(result, dtype)
1140499
def unit_vector(x):
    """"""
    y = np.array(x, dtype='float')
    return y/norm(y)
521515
def tocvx(B):
    
    Bcoo = B.tocoo()
    return spmatrix(Bcoo.data, Bcoo.row.tolist(), Bcoo.col.tolist())
145077
def dot(self, vec):
        """"""
        if not isinstance(vec, self.__class__):
            raise TypeError('Dot product operand must be a VectorArray')
        if self.nV != 1 and vec.nV != 1 and self.nV != vec.nV:
            raise ValueError('Dot product operands must have the same '
                             'number of elements.')
        return np.sum((getattr(self, d)*getattr(vec, d) for d in self.dims), 1)
275734
private static double[] toVector(Point3d src, Point3d dest) {
        return new double[]{dest.x - src.x, dest.y - src.y, dest.z - src.z};
    }
191714
@Override
	public Point3d[] getVertices() {
		double x = 0.5 * width;
		double y = 0.5 * height;
		double z = 0.5 * length;
		Point3d[] vertices = new Point3d[8];
		vertices[0] = new Point3d(-x, -y,  z);
		vertices[1] = new Point3d(-x,  y,  z);
		vertices[2] = new Point3d( x,  y,  z);
		vertices[3] = new Point3d( x, -y,  z);
		vertices[4] = new Point3d(-x, -y, -z);
		vertices[5] = new Point3d(-x,  y, -z);
		vertices[6] = new Point3d( x,  y, -z);
		vertices[7] = new Point3d( x, -y, -z);

		return vertices;
	}
818476
def cast opts={}
      dt = opts[:dtype]
      raise ArgumentError, "Unsupported dtype #{opts[:dtype]}" unless %i[array nmatrix gsl].include?(dt)

      @data = cast_vector_to dt unless @dtype == dt
    end
1349121
public Point3d[] getVertices() {
        Point3d[] vtxs = new Point3d[numVertices];
        for (int i = 0; i < numVertices; i++) {
            vtxs[i] = pointBuffer[vertexPointIndices[i]].pnt;
        }
        return vtxs;
    }
444702
def get_vec_lr(self):
        """"""

        return self.width * self.cos_a(), -self.width * self.sin_a()
394936
def getOrderVectors(self):
        

        orderVectors = []
        for preference in self.preferences:
            orderVectors.append(preference.getOrderVector())
        return orderVectors
55123
public List<Vec> getDataVectors()
    {
        List<Vec> vecs = new ArrayList<>(size());
        for(int i = 0; i < size(); i++)
            vecs.add(getDataPoint(i).getNumericalValues());
        return vecs;
    }
1176573
def _vector(x, type='row'):
    """"""
    if isinstance(x, (list, tuple)):
        x = np.array(x, dtype=np.float32)
    elif not isinstance(x, np.ndarray):
        x = np.array([x], dtype=np.float32)
    assert x.ndim == 1
    if type == 'column':
        x = x[:, None]
    return x
1272809
private Vector2i getCellOf(Point3D coordinate) {
        int xCell = (int) ((coordinate.x - indexRegion.minX()) / x_size);
        int yCell = (int) ((coordinate.y - indexRegion.minY()) / y_size);
        return new Vector2i(xCell, yCell);
    }
527887
def map_pixel_location(self, point_x, point_y):
        '''
        
        '''
        row, col = map_pixel(point_x, point_y, self.x_cell_size, self.y_cell_size,
                             self.xmin, self.ymax)
        return np.array([row, col])
1226982
def active_vectors(self):
        """"""
        field, name = self.active_vectors_info
        if name:
            if field is POINT_DATA_FIELD:
                return self.point_arrays[name]
            if field is CELL_DATA_FIELD:
                return self.cell_arrays[name]