mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-30 03:50:34 +00:00
hyperpoint:: added dot_d function
This commit is contained in:
parent
3a9f81a248
commit
eed8ba49ab
@ -96,11 +96,15 @@ struct hyperpoint : array<ld, MAXMDIM> {
|
||||
);
|
||||
}
|
||||
|
||||
// inner product
|
||||
inline friend ld operator | (hyperpoint h1, hyperpoint h2) {
|
||||
friend ld dot_d(int c, hyperpoint h1, hyperpoint h2) {
|
||||
ld sum = 0;
|
||||
for(int i=0; i<MXDIM; i++) sum += h1[i] * h2[i];
|
||||
for(int i=0; i<c; i++) sum += h1[i] * h2[i];
|
||||
return sum;
|
||||
}
|
||||
|
||||
// Euclidean inner product
|
||||
inline friend ld operator | (hyperpoint h1, hyperpoint h2) {
|
||||
return dot_d(MXDIM, h1, h2);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user