mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2025-02-05 18:16:13 +00:00
![Tim Allen](/assets/img/avatar_default.png)
byuu says: New update. Most of the work today went into eliminating hiro::Image from all objects in all ports, replacing with nall::image. That took an eternity. Changelog: - fixed crashing bug when loading games [thanks endrift!!] - toggling "show status bar" option adjusts window geometry (not supposed to recenter the window, though) - button sizes improved; icon-only button icons no longer being cut off
31 lines
787 B
C++
31 lines
787 B
C++
#pragma once
|
|
|
|
namespace nall {
|
|
|
|
namespace Matrix {
|
|
|
|
template<typename T> inline auto Multiply(T* output, const T* xdata, unsigned xrows, unsigned xcols, const T* ydata, unsigned yrows, unsigned ycols) -> void {
|
|
if(xcols != yrows) return;
|
|
|
|
for(unsigned y = 0; y < xrows; y++) {
|
|
for(unsigned x = 0; x < ycols; x++) {
|
|
T sum = 0;
|
|
for(unsigned z = 0; z < xcols; z++) {
|
|
sum += xdata[y * xcols + z] * ydata[z * ycols + x];
|
|
}
|
|
*output++ = sum;
|
|
}
|
|
}
|
|
}
|
|
|
|
template<typename T> inline auto Multiply(const T* xdata, unsigned xrows, unsigned xcols, const T* ydata, unsigned yrows, unsigned ycols) -> vector<T> {
|
|
vector<T> output;
|
|
output.resize(xrows * ycols);
|
|
Multiply(output.data(), xdata, xrows, xcols, ydata, yrows, ycols);
|
|
return output;
|
|
}
|
|
|
|
}
|
|
|
|
}
|