Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aschreyer
Created May 20, 2011 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aschreyer/983103 to your computer and use it in GitHub Desktop.
Save aschreyer/983103 to your computer and use it in GitHub Desktop.
Examples of the Eigen PostgreSQL extension
SELECT '{1,2,3,4,5}'::arrayxi & '{5,4,3,2,1}'::arrayxi;
?column?
---------------
'{0,0,3,0,0}'
(1 row)
Time: 0.290 ms
SELECT arrayxi_euclidean(ar, arrayxi_constant(128,5))
FROM dev.eigen ORDER BY 1 LIMIT 10;
arrayxi_euclidean
-------------------
62.393909959226
78.3326241102646
163.978657147813
215.900440018079
234.33736364481
314.625173817989
314.915861778984
322.172314142603
324.696781628645
363.395101783169
(10 rows)
Time: 169.806 ms
SELECT arrayxi_mean(ar)
FROM dev.eigen ORDER BY 1 LIMIT 10;
arrayxi_mean
--------------
77
187
346
375
409
462
487
565
722
750
(10 rows)
Time: 138.167 ms
SELECT COUNT(*) FROM dev.eigen;
count
--------
378675
(1 row)
Time: 143.626 ms
INSERT INTO dev.eigen
SELECT arrayxi_random(128)
FROM credo.aromatic_ring_atoms;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment