zholos / qml Goto Github PK
View Code? Open in Web Editor NEWmath library for kdb+
Home Page: http://althenia.net/qml
License: Other
math library for kdb+
Home Page: http://althenia.net/qml
License: Other
A simple test case:
a:500 500#250000?1.0
a:.qml.mm[a;flip a]
.qml.mchol[a]
In particular I get a matrix full of 0n for larger matrix
A simple solution I came up with borrows from J software's implementation of Cholesky. found here:
http://code.jsoftware.com/wiki/Essays/Cholesky_Decomposition
Here is the code I used which recursively calculates the cholesky for larger matrices using smaller matrices
The Code assumes upper triangular Cholesky: I added this function to .qml
.qml.mchollarge:{[m] $[100>l:count m;
.qml.mchol[m];
[a:.5*l;
A:m[b;b:til l-floor[a]];
B:m[c:ceiling[a]+til l-ceiling[a];b];
C:m[c;c];
L0:.qml.mchollarge A;
L1:.qml.mchollarge C-.qml.mm[T: .qml.mm[B;.qml.minv A];flip B];
Z:(count first L3;count L3:flip .qml.mm[T;L0])#0f;
(l;l)#raze (L0,'L3),(Z,'L1)]]};
It would be useful to have functions for sample skewness and kurtosis.
as title .
make -C cephes install
make[1]: Entering directory '/home/baichen/myQML/qml/cephes'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/baichen/myQML/qml/cephes'
make -C openblas install
make[1]: Entering directory '/home/baichen/myQML/qml/openblas'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/baichen/myQML/qml/openblas'
make -C lapack install
make[1]: Entering directory '/home/baichen/myQML/qml/lapack'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/baichen/myQML/qml/lapack'
make -C conmax install
make[1]: Entering directory '/home/baichen/myQML/qml/conmax'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/baichen/myQML/qml/conmax'
make -C nlopt install
make[1]: Entering directory '/home/baichen/myQML/qml/nlopt'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/baichen/myQML/qml/nlopt'
make -C q install
make[1]: Entering directory '/home/baichen/myQML/qml/q'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/baichen/myQML/qml/q'
make -C src build
make[1]: Entering directory '/home/baichen/myQML/qml/src'
gcc -m64 -fPIC -pipe -shared -o qml.so const.o alloc.o util.o opt.o libm.o cephes.o lapack.o conmin.o conmax.o nlopt.o \
../lib/libprob.a ../lib/libconmax.a ../lib/libnlopt.a ../lib/liblapack.a ../lib/librefblas.a \
\
\
-lgfortran \
-lm \
-Wl,--version-script,qml.mapfile
/usr/bin/ld: conmax.o:(.bss+0x0): multiple definition of `call'; conmin.o:(.bss+0x40): first defined here
/usr/bin/ld: nlopt.o:(.bss+0x0): multiple definition of `call'; conmin.o:(.bss+0x40): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [../mk/src.mk:43: qml.so] Error 1
make[1]: Leaving directory '/home/baichen/myQML/qml/src'
make: *** [Makefile:7: src_build] Error 2
As mentioned in README of KxSysrems/kdb :
- This is not a high-availability hosting service
- Updates to the repo may break your application
- Code refactoring might return 404s to your application
Therefore, I believe it's better to include the content of k.h in this repo instead of downloading during compilation.
Right now (2017.07.25), when I try to compile qml. It fails because the content of iniclude/k.h is "404 not found".
--disable-fortran
to allow building most of qml without gfortran.
--disable-lapack
for a fast and light build if linear algebra routines aren't needed.
All qml routines will still be available but return 'disabled
.
In file included from util.h:6:0,
from wrap.h:4,
from libm.c:3:
../include/k.h:85:0: error: "isnan" redefined [-Werror]
In file included from libm.c:1:0:
/usr/i686-pc-mingw32/sys-root/mingw/include/math.h:376:0: note: this is the location of the previous definition
isnan
(and finite
and log
) from math.h
are defined conditionally for WIN32
by k.h
.
Solutions:
k.h
to remove isnan
— unreliable since k.h
changes from time to timek.h
from code.kx.com
and apply precise patch#undef isnan
after including k.h
before including math.h
(check whether k.h
defines any reserved identifiers that could break math.h
)#undef WIN32
and _WIN32
before including k.h
(perhaps redefine afterwards)k.h
and math.h
aren't used in the same translation unit — overhead, especially in routines generated by wrap.h
Related:
nf
and wf
, which are defined differently for WIN32
, are used in code — consider replacing with NAN
and INFINITY
This issue isn't a problem as far as I can tell, but the behavior seems very strange to me, so I wanted to ask whether there is a simple explanation and whether it could be affecting other functions negatively.
In the example below, I
exp
function (first execution is slow because of cold-start).exp
function again and observe an unexpected and significant speed-up (1,710ms vs 2,511ms).qml.exp
and observe a further (slight) speed-up, suggesting exp
didn't simply get overridden by qml.exp
somehow.q)\t exp 100000000?1f
2776
q)\t exp 100000000?1f
2511
q)\t exp 100000000?1f
2511
q)\t exp 100000000?1f
2511
q)\l qml.q
q)\t exp 100000000?1f
1710
q)\t exp 100000000?1f
1710
q)\t exp 100000000?1f
1710
q)\t .qml.exp 100000000?1f
1698
q)\t .qml.exp 100000000?1f
1698
q)\t .qml.exp 100000000?1f
1698
As title
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.