returns np.dot(mat, mat.T), but faster for large 2D arrays of doubles.
178210
def tdot_blas(mat, out=None):
    """"""
    if (mat.dtype != 'float64') or (len(mat.shape) != 2):
        return np.dot(mat, mat.T)
    nn = mat.shape[0]
    if out is None:
        out = np.zeros((nn, nn))
    else:
        assert(out.dtype == 'float64')
        assert(out.shape == (nn, nn))
        # FIXME: should allow non-contiguous out, and copy output into it:
        assert(8 in out.strides)
        # zeroing needed because of dumb way I copy across triangular answer
        out[:] = 0.0

    # # Call to DSYRK from BLAS
    mat = np.asfortranarray(mat)
    out = blas.dsyrk(alpha=1.0, a=mat, beta=0.0, c=out, overwrite_c=1,
                     trans=0, lower=0)

    symmetrify(out, upper=True)
    return np.ascontiguousarray(out)
668687
def _nanstd(array, axis=None, ddof=0):
    """"""

    if isinstance(axis, tuple):
        array = _move_tuple_axes_first(array, axis=axis)
        axis = 0
    return bottleneck.nanstd(array, axis=axis, ddof=ddof)
788339
def lstsq(A, b):
    
    """
    A = asarray(A, float)
    b = asarray(b, float)

    if A.ndim == 1:
        A = A[:, newaxis]

    if A.shape[1] == 1:
        return dot(A.T, b) / squeeze(dot(A.T, A))

    rcond = finfo(double).eps * max(*A.shape)
    return npy_lstsq(A, b, rcond=rcond)[0]
712746
def translate_y(self, d):
        
        mat = numpy.array([
            [1, 0, 0, 0],
            [0, 1, 0, 0],
            [0, 0, 1, 0],
            [0, d, 0, 1]
        ])
        self.vectors = self.vectors.dot(mat)
        return self
498984
def get_pre_compute(self, s):
        '''
        
        '''
        hidden_dim = self.hidden_dim
        src_dim = s.get_shape().as_list()[-1]
        assert src_dim is not None, 'src dim must be defined'
        W = self._get_var('W', shape=[src_dim, hidden_dim])
        b = self._get_var('b', shape=[1, hidden_dim])
        return tf.tensordot(s, W, [[2], [0]]) + b
126663
public static double det( DMatrix2x2 mat ) {

        return mat.a11*mat.a22 - mat.a12*mat.a21;
    }
1115770
def as_2d(self):
        
        if not self.isdiagonal:
            return self.x
        return np.diag(self.x.flatten())
1293296
def give_dots(R, r, r_, resolution=2*PI/1000, spins=50):
    '''
    '''
    thetas = np.arange(0, 2*PI*spins, resolution)
    Rr = R - r
    x = Rr * np.cos(thetas) + r_*np.cos(Rr / r * thetas)
    y = Rr * np.sin(thetas) - r_*np.sin(Rr / r * thetas)
    return x, y
1160151
def dot_product(self, other):
        
        return self.x * other.x + self.y * other.y
1272472
def dot(vec1, vec2):
    """"""
    if isinstance(vec1, Vector3) and isinstance(vec2, Vector3):
        return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z)
    elif isinstance(vec1, Vector4) and isinstance(vec2, Vector4):
        return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z) + (vec1.w * vec2.w)
    else:
        raise TypeError("vec1 and vec2 must a Vector type")
859592
def dot(self, rhs):
    

    return self.x * rhs.x + self.y * rhs.y + self.z * rhs.z
226396
def obj(x):
    """"""
    
    j = np.arange(1, 6)
    tmp1 = np.dot(j, np.cos((j+1)*x[0] + j))
    tmp2 = np.dot(j, np.cos((j+1)*x[1] + j))
    return tmp1 * tmp2
448986
def dot(matrix, vector):
    
    matrix_weld_type = None
    vector_weld_type = None

    if isinstance(matrix, LazyOpResult):
        matrix_weld_type = matrix.weld_type
        matrix = matrix.expr
    elif isinstance(matrix, np.ndarray):
        matrix_weld_type = numpy_weld_impl.numpy_to_weld_type_mapping[
            str(matrix.dtype)]

    if isinstance(vector, LazyOpResult):
        vector_weld_type = vector.weld_type
        vector = vector.expr
    elif isinstance(vector, np.ndarray):
        vector_weld_type = numpy_weld_impl.numpy_to_weld_type_mapping[
            str(vector.dtype)]

    return NumpyArrayWeld(
        numpy_weld_impl.dot(
            matrix,
            vector,
            matrix_weld_type,
            vector_weld_type),
        WeldDouble())
1371287
private static double dot(int[] x, double[] w, int j, int p) {
        int pos = j * (p + 1);
        double dot = w[pos + p];

        for (int i : x) {
            dot += w[pos+i];
        }

        return dot;
    }
1214964
def _array_2d_repr(self):
        """"""

        sc_array = np.zeros((self.nmax + 1, 2 * self.mmax + 1),
                            dtype=np.complex128)

        lst = self._reshape_n_vecs()
        sc_array[0:self.nmax + 1, self.mmax] = lst[0]
        for m in xrange(1, self.mmax + 1):
            sc_array[m:self.nmax + 1, self.mmax - m] = lst[2 * m - 1]
            sc_array[m:self.nmax + 1, self.mmax + m] = lst[2 * m]

        return sc_array
103739
public int dot(LongIntVector y) {
        if (y instanceof LongIntSortedVector) {
            LongIntSortedVector other = ((LongIntSortedVector) y);
            int dot = 0;
            int oc = 0;
            for (int c = 0; c < used; c++) {
                while (oc < other.used) {
                    if (other.indices[oc] < indices[c]) {
                        oc++;
                    } else if (indices[c] == other.indices[oc]) {
                        dot += values[c] * other.values[oc];
                        break;
                    } else {
                        break;
                    }
                }
            }
            return dot;
        } else {
            int dot = 0;
            for (int c = 0; c < used; c++) {
                dot += this.values[c] * y.get(indices[c]);
            }
            return dot;
        }
    }
242446
def _scalar2array(d):
    """"""
    da = {}
    for k, v in d.items():
        if '_' not in k:
            da[k] = v
        else:
            name = ''.join(k.split('_')[:-1])
            ind = k.split('_')[-1]
            dim = len(ind)
            if name not in da:
                shape = tuple(3 for i in range(dim))
                da[name] = np.empty(shape, dtype=complex)
                da[name][:] = np.nan
            da[name][tuple(int(i) - 1 for i in ind)] = v
    return da