mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-02 05:20:32 +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
|
friend ld dot_d(int c, hyperpoint h1, hyperpoint h2) {
|
||||||
inline friend ld operator | (hyperpoint h1, hyperpoint h2) {
|
|
||||||
ld sum = 0;
|
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;
|
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