¡@

Home 

python Programming Glossary: a.t

Find unique rows in numpy.array

http://stackoverflow.com/questions/16970982/find-unique-rows-in-numpy-array

100 loops best of 3 3.17 ms per loop timeit ind np.lexsort a.T a np.concatenate True np.any a ind 1 a ind 1 axis 1 100 loops.. 10 loops best of 3 29.9 ms per loop timeit ind np.lexsort a.T a np.concatenate True np.any a ind 1 a ind 1 axis 1 10 loops..

more efficient way to calculate distance in numpy?

http://stackoverflow.com/questions/17527340/more-efficient-way-to-calculate-distance-in-numpy

loops best of 3 145 ms per loop In 15 timeit spdist.cdist a.T b.T 10 loops best of 3 124 ms per loop In 16 timeit deltas a..

Numpy ?˜smart??symmetric matrix

http://stackoverflow.com/questions/2572916/numpy-smart-symmetric-matrix

0 1 # True print a # 0 1 0 1 0 0 0 0 0 assert numpy.all a a.T # for any symmetric matrix An automatic Hermitian would also.. should be reasonably fast def symmetrize a return a a.T numpy.diag a.diagonal This works under reasonable assumptions..

Detecting thresholds in HSV color space (from RGB) using Python / PIL

http://stackoverflow.com/questions/4890373/detecting-thresholds-in-hsv-color-space-from-rgb-using-python-pil

i Image.open fp .convert 'RGB' a numpy.asarray i int R G B a.T m numpy.min a 2 .T M numpy.max a 2 .T C M m #chroma Cmsk C 0..

How to iterate over columns of a matrix?

http://stackoverflow.com/questions/5515181/how-to-iterate-over-columns-of-a-matrix

How about for i in a.transpose or shorter for i in a.T This may look expensive but is in fact very cheap it returns..

Removing duplicate columns and rows from a NumPy 2D array

http://stackoverflow.com/questions/8560440/removing-duplicate-columns-and-rows-from-a-numpy-2d-array

2d case. import numpy as np def unique a order np.lexsort a.T a a order diff np.diff a axis 0 ui np.ones len a 'bool' ui 1..