Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Last active October 5, 2016 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thinkerbot/8699369 to your computer and use it in GitHub Desktop.
Save thinkerbot/8699369 to your computer and use it in GitHub Desktop.
MADlib install on ubuntu (partial)
create temporary sequence predictor_seq;
CREATE temporary TABLE linear_systems_test_data( id INTEGER NOT NULL, lhs DOUBLE PRECISION[], rhs DOUBLE PRECISION);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{352137.0,84.7067061967771,-150.185137392799,122.050417659229,-74.0884874537119,99.7911494563722,-3.7907455558484,181224.690513009,106938.029173016,69336.1362009346,18335.0,12.7007088793537,-250.440511627437,-62.5561474971013,-292.703374755409,-167.012940969203,-78.511449979818,9451.24681999999,5585.85191537643,3628.50938401}'::float[], 88920344.0 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{84.7067061967771,176105.544243727,61.0252088296143,-73.1971959184637,7.54222162981446,-48.6063990056131,-37.7170700467655,-11006.0678697046,-11871.4874441653,-10787.6157862104,12.7007088793537,9313.85168737771,-31.2780737485506,-85.9645308238089,-89.8568249242787,-78.6462830692247,10.8622991388217,-566.613529886409,-617.49619500345,-565.289335368564}'::float[], -13145292.0108605);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-150.185137392799,61.0252088296143,176031.455756273,92.2489278265701,-76.9879414743283,84.3333476124558,-25.4820884480566,-13956.5435528986,-15708.0417933261,-14654.2037276884,-250.440511627437,-31.2780737485506,9021.1483126223,-77.1561160449251,-164.475980803628,-51.6938483582801,-214.057091686182,-836.240725206375,-881.848989981731,-807.859502009072}'::float[], 1898932.5197653 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{122.050417659229,-73.1971959184637,92.2489278265701,176056.937844721,23.3081387828495,-78.3013073935213,-39.6458055782809,2284.51122615497,2926.23669007509,3063.0560226095,-62.5561474971013,-85.9645308238089,-77.1561160449251,9235.20540430848,-20.4157746097293,-33.0784604100794,-136.032443950019,128.092163094009,181.475038595339,191.440843746915}'::float[], -9353552.4864902 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-74.0884874537119,7.54222162981446,-76.9879414743283,23.3081387828495,176080.062155279,45.0609006184824,-71.8838299992101,3643.8105536523,3802.81999939308,3354.88154570073,-292.703374755409,-89.8568249242787,-164.475980803628,-20.4157746097293,9099.79459569152,-123.331735070666,-217.362051217354,76.7005847765573,149.130685682247,153.821442356972}'::float[], 44484.2690687988 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{99.7911494563722,-48.6063990056131,84.3333476124558,-78.3013073935213,45.0609006184824,176080.2655417,-0.594386799369262,823.606108487408,625.336937399352,383.40170387949,-167.012940969203,-78.6462830692247,-51.6938483582801,-33.0784604100794,-123.331735070666,9256.89685896493,72.6637751149791,-37.1715938195721,-12.3561329753323,-9.43756489730373}'::float[], -4390173.40911921);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-3.7907455558484,-37.7170700467655,-25.4820884480566,-39.6458055782809,-71.8838299992101,-0.594386799369262,176056.7344583,306.277425558405,479.877979771055,515.575514361862,-78.511449979818,10.8622991388217,-214.057091686182,-136.032443950019,-217.362051217354,72.6637751149791,9078.10314103507,-39.4915952614484,-12.4442074456118,1.82474415780702}'::float[], -578474.61071334 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{181224.690513009,-11006.0678697046,-13956.5435528986,2284.51122615497,3643.8105536523,823.606108487408,306.277425558405,106938.029173016,69336.1362009346,48085.2020935846,9451.24681999999,-566.613529886409,-836.240725206375,128.092163094009,76.7005847765573,-37.1715938195721,-39.4915952614484,5585.85191537643,3628.50938401,2521.96990177272}'::float[], 44507137.79863 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{106938.029173016,-11871.4874441653,-15708.0417933261,2926.23669007509,3802.81999939308,625.336937399352,479.877979771055,69336.1362009346,48085.2020935846,35047.3895436122,5585.85191537643,-617.49619500345,-881.848989981731,181.475038595339,149.130685682247,-12.3561329753323,-12.4442074456118,3628.50938401,2521.96990177272,1842.81831435334}'::float[], 25951081.5005107 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{69336.1362009346,-10787.6157862104,-14654.2037276884,3063.0560226095,3354.88154570073,383.40170387949,515.575514361862,48085.2020935846,35047.3895436122,26536.4701009535,3628.50938401,-565.289335368564,-807.859502009072,191.440843746915,153.821442356972,-9.43756489730373,1.82474415780702,2521.96990177272,1842.81831435334,1399.17229799236}'::float[], 16848804.598354 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{18335.0,12.7007088793537,-250.440511627437,-62.5561474971013,-292.703374755409,-167.012940969203,-78.511449979818,9451.24681999999,5585.85191537643,3628.50938401,18335.0,12.7007088793537,-250.440511627437,-62.5561474971013,-292.703374755409,-167.012940969203,-78.511449979818,9451.24681999999,5585.85191537643,3628.50938401}'::float[], 4570234.0 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{12.7007088793537,9313.85168737771,-31.2780737485506,-85.9645308238089,-89.8568249242787,-78.6462830692247,10.8622991388217,-566.613529886409,-617.49619500345,-565.289335368564,12.7007088793537,9313.85168737771,-31.2780737485506,-85.9645308238089,-89.8568249242787,-78.6462830692247,10.8622991388217,-566.613529886409,-617.49619500345,-565.289335368564}'::float[], -638917.316092659);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-250.440511627437,-31.2780737485506,9021.1483126223,-77.1561160449251,-164.475980803628,-51.6938483582801,-214.057091686182,-836.240725206375,-881.848989981731,-807.859502009072,-250.440511627437,-31.2780737485506,9021.1483126223,-77.1561160449251,-164.475980803628,-51.6938483582801,-214.057091686182,-836.240725206375,-881.848989981731,-807.859502009072}'::float[], 80910.9354257816 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-62.5561474971013,-85.9645308238089,-77.1561160449251,9235.20540430848,-20.4157746097293,-33.0784604100794,-136.032443950019,128.092163094009,181.475038595339,191.440843746915,-62.5561474971013,-85.9645308238089,-77.1561160449251,9235.20540430848,-20.4157746097293,-33.0784604100794,-136.032443950019,128.092163094009,181.475038595339,191.440843746915}'::float[], -526595.219744903);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-292.703374755409,-89.8568249242787,-164.475980803628,-20.4157746097293,9099.79459569152,-123.331735070666,-217.362051217354,76.7005847765573,149.130685682247,153.821442356972,-292.703374755409,-89.8568249242787,-164.475980803628,-20.4157746097293,9099.79459569152,-123.331735070666,-217.362051217354,76.7005847765573,149.130685682247,153.821442356972}'::float[], -45016.270987413 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-167.012940969203,-78.6462830692247,-51.6938483582801,-33.0784604100794,-123.331735070666,9256.89685896493,72.6637751149791,-37.1715938195721,-12.3561329753323,-9.43756489730373,-167.012940969203,-78.6462830692247,-51.6938483582801,-33.0784604100794,-123.331735070666,9256.89685896493,72.6637751149791,-37.1715938195721,-12.3561329753323,-9.43756489730373}'::float[], -241206.447392831);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{-78.511449979818,10.8622991388217,-214.057091686182,-136.032443950019,-217.362051217354,72.6637751149791,9078.10314103507,-39.4915952614484,-12.4442074456118,1.82474415780702,-78.511449979818,10.8622991388217,-214.057091686182,-136.032443950019,-217.362051217354,72.6637751149791,9078.10314103507,-39.4915952614484,-12.4442074456118,1.82474415780702}'::float[], -26814.1789769015);
insert into linear_systems_test_data values (nextval('predictor_seq'), '{9451.24681999999,-566.613529886409,-836.240725206375,128.092163094009,76.7005847765573,-37.1715938195721,-39.4915952614484,5585.85191537643,3628.50938401,2521.96990177272,9451.24681999999,-566.613529886409,-836.240725206375,128.092163094009,76.7005847765573,-37.1715938195721,-39.4915952614484,5585.85191537643,3628.50938401,2521.96990177272}'::float[], 2258007.3925 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{5585.85191537643,-617.49619500345,-881.848989981731,181.475038595339,149.130685682247,-12.3561329753323,-12.4442074456118,3628.50938401,2521.96990177272,1842.81831435334,5585.85191537643,-617.49619500345,-881.848989981731,181.475038595339,149.130685682247,-12.3561329753323,-12.4442074456118,3628.50938401,2521.96990177272,1842.81831435334}'::float[], 1297461.35069444 );
insert into linear_systems_test_data values (nextval('predictor_seq'), '{3628.50938401,-565.289335368564,-807.859502009072,191.440843746915,153.821442356972,-9.43756489730373,1.82474415780702,2521.96990177272,1842.81831435334,1399.17229799236,3628.50938401,-565.289335368564,-807.859502009072,191.440843746915,153.821442356972,-9.43756489730373,1.82474415780702,2521.96990177272,1842.81831435334,1399.17229799236}'::float[], 829945.021037315 );
SELECT madlib.linear_solver_dense( 'linear_systems_test_data',
'output_table',
'id',
'lhs',
'rhs'
);
select * from output_table;
#!/bin/bash
# https://github.com/madlib/madlib/wiki/Building-MADlib-from-Source
apt-get install -y cmake
apt-get install -y postgresql-server-dev-9.3
apt-get install -y postgresql-plpython-9.3
apt-get install -y libkrb5-dev
git clone git@github.com:madlib/madlib.git
./configure
cd build/
make
make install
createlang plpythonu db
bash /usr/local/madlib/bin/madpack -p postgres -c user@host/db install
@srinivasrk
Copy link

Hope someone mentions. we can download the .rpm packages and to install in Ubuntu just convert the package to .deb using "Alien command" it will work.

Let me know if you need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment