/* sq_dist - a mex function to compute a matrix of all pairwise squared
distances between two sets of vectors, stored in the columns of the two
matrices that are arguments to the function. The length of the vectors must
agree. If only a single argument is given, the missing argument is taken to
be identical to the first. If an optional third matrix argument Q is given,
it must be of the same size as the output, but in this case a vector of the
traces of the product of Q and the coordinatewise squared distances is
returned.
Copyright (c) 2003, 2004 Carl Edward Rasmussen. 2003-04-22. */
#include "mex.h"
#include <math.h>
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
double *a, *b, *C, *Q, z, t;
int D, n, m, i, j, k;
if (nrhs < 1 || nrhs > 3 || nlhs > 1)
mexErrMsgTxt("Usage: C = sq_dist(a,b)\n or: C = sq_dist(a)\n or: c = sq_dist(a,b,Q)\nwhere the b matrix may be empty.");
a = mxGetPr(prhs[0]);
m = mxGetN(prhs[0]);
D = mxGetM(prhs[0]);
if (nrhs == 1 || mxIsEmpty(prhs[1])) {
b = a;
n = m;
} else {
b = mxGetPr(prhs[1]);
n = mxGetN(prhs[1]);
if (D != mxGetM(prhs[1]))
mexErrMsgTxt("Error: column lengths must agree");
}
if (nrhs < 3) {
plhs[0] = mxCreateDoubleMatrix(m, n, mxREAL);
C = mxGetPr(plhs[0]);
for (i=0; i<m; i++) for (j=0; j<n; j++) {
z = 0.0;
for (k=0; k<D; k++) { t = a[D*i+k] - b[D*j+k]; z += t*t; }
C[i+j*m] = z;
}
} else {
Q = mxGetPr(prhs[2]);
if (mxGetN(prhs[2]) != n || mxGetM(prhs[2]) != m)
mexErrMsgTxt("Error: 3rd matrix argument has wrong dimensions");
plhs[0] = mxCreateDoubleMatrix(D, 1, mxREAL);
C = mxGetPr(plhs[0]);
for (k=0; k<D; k++) C[k] = 0.0;
for (i=0; i<m; i++) for (j=0; j<n; j++) {
t = Q[i+j*m];
for (k=0; k<D; k++) {
z = a[i*D+k] - b[j*D+k]; C[k] += t*z*z;
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
approx_for_gpc.rar_类概率_高斯过程 matlab
共85个文件
m:50个
gif:22个
html:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 119 浏览量
2022-07-14
02:32:45
上传
评论
收藏 839KB RAR 举报
温馨提示
高斯过程二分类中,后验概率的几种估计算法
资源推荐
资源详情
资源评论
收起资源包目录
approx_for_gpc.rar (85个子文件)
approx
gpml-matlab-v2.0-2007-06-25
gpml-matlab
gpml
covConst.m 758B
covRQiso.m 2KB
sq_dist.c 2KB
sq_dist.m 2KB
approximations.m 2KB
approxLA.m 3KB
cumGauss.m 3KB
covSum.m 2KB
covMatern3iso.m 1KB
logistic.m 3KB
solve_chol.c 1KB
covNoise.m 1KB
covRQard.m 2KB
binaryLaplaceGP.m 3KB
covMatern5iso.m 1KB
covProd.m 3KB
covFunctions.m 4KB
binaryEPGP.m 3KB
gprSRPP.m 3KB
covLINard.m 1KB
Contents.m 3KB
binaryGP.m 7KB
solve_chol.m 991B
approxEP.m 5KB
covSEiso.m 1KB
covLINone.m 984B
Copyright 776B
gpr.m 3KB
covSEard.m 2KB
Makefile 131B
minimize.m 9KB
likelihoods.m 1KB
covPeriodic.m 1KB
covNNone.m 2KB
README 5KB
doc
alg35.gif 65KB
fig2dl3.gif 37KB
fig2de3.gif 38KB
fig2dl2.gif 39KB
alg21.gif 31KB
figl1.gif 21KB
sparse-approx.html 8KB
alg52.gif 40KB
figepp.gif 17KB
fig2d.gif 36KB
figl.gif 6KB
index.html 3KB
figlf.gif 16KB
figepp2.gif 23KB
figlm.gif 16KB
fig2dl1.gif 33KB
figlapp2.gif 25KB
classification.html 34KB
alg31.gif 42KB
alg36.gif 31KB
figlapp.gif 17KB
alg32.gif 33KB
alg51.gif 59KB
style.css 77B
regression.html 16KB
fig2de1.gif 35KB
fig2de2.gif 42KB
gpml-demo
demo_ep_usps.m 6KB
data_boston.mat 56KB
demo_laplace_2d.m 7KB
demo_laplace_usps.m 6KB
demo_ep_2d.m 7KB
Contents.m 791B
demo_gprsparse.m 6KB
demo_gparm.m 8KB
demo_gpr.m 9KB
data_6darm.mat 22KB
approxTAP.m 2KB
approxLA.m 3KB
approxFV.m 2KB
approxTAPnaive.m 2KB
approxIVM.m 3KB
approxKL.m 8KB
approxSO.m 6KB
README 2KB
approxEP.m 5KB
approxOLEP.m 9KB
approxVB.m 9KB
approxEC.m 3KB
approxLR.m 2KB
共 85 条
- 1
资源评论
朱moyimi
- 粉丝: 65
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功