fix warnign in release mode
This commit is contained in:
parent
08fbedce38
commit
f7dd35f0dd
|
@ -83,19 +83,18 @@ void Matrix<N,M,T>::setIdentity() {
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
bool Matrix<N,M,T>::isIdentity() const {
|
bool Matrix<N,M,T>::isIdentity() const {
|
||||||
for(int i=0;i<N;++i) {
|
for(int i=0;i<N;++i)
|
||||||
for(int j=0;j<M;++j) {
|
for(int j=0;j<M;++j)
|
||||||
if((i==j && m[i][j] != 1.0f) || (i!=j && m[i][j] != 0.0f))
|
if((i==j && m[i][j] != 1.0f) || (i!=j && m[i][j] != 0.0f))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
void Matrix<N,M,T>::fill(T value) {
|
void Matrix<N,M,T>::fill(T value) {
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
m[0][i] = value;
|
for(int j=0;j<M;++j)
|
||||||
|
m[i][j] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
|
@ -104,15 +103,16 @@ Matrix<M,N,T> Matrix<N,M,T>::transposed() const {
|
||||||
for(int i=0;i<N;++i)
|
for(int i=0;i<N;++i)
|
||||||
for(int j=0;j<M;++j)
|
for(int j=0;j<M;++j)
|
||||||
result.m[j][i] = m[i][j];
|
result.m[j][i] = m[i][j];
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
template<typename U>
|
template<typename U>
|
||||||
Matrix<N,M,T>& Matrix<N,M,T>::operator=(const std::initializer_list<U>& values) {
|
Matrix<N,M,T>& Matrix<N,M,T>::operator=(const std::initializer_list<U>& values) {
|
||||||
auto it = values.begin();
|
auto it = values.begin();
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
m[0][i] = *(it++);
|
for(int j=0;j<M;++j)
|
||||||
|
m[i][j] = *(it++);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,53 +122,59 @@ Matrix<N,M,T>& Matrix<N,M,T>::operator=(const U *values) {
|
||||||
for(int i=0;i<N;++i)
|
for(int i=0;i<N;++i)
|
||||||
for(int j=0;j<M;++j)
|
for(int j=0;j<M;++j)
|
||||||
m[i][j] = values[i*N + j];
|
m[i][j] = values[i*N + j];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
Matrix<N,M,T>& Matrix<N,M,T>::operator+=(const Matrix<N,M,T>& other) {
|
Matrix<N,M,T>& Matrix<N,M,T>::operator+=(const Matrix<N,M,T>& other) {
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
m[0][i] += other.m[0][i];
|
for(int j=0;j<M;++j)
|
||||||
|
m[i][j] += other.m[i][j];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
Matrix<N,M,T>& Matrix<N,M,T>::operator-=(const Matrix<N,M,T>& other) {
|
Matrix<N,M,T>& Matrix<N,M,T>::operator-=(const Matrix<N,M,T>& other) {
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
m[0][i] -= other.m[0][i];
|
for(int j=0;j<M;++j)
|
||||||
|
m[i][j] -= other.m[i][j];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
Matrix<N,M,T>& Matrix<N,M,T>::operator*=(T factor) {
|
Matrix<N,M,T>& Matrix<N,M,T>::operator*=(T factor) {
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
m[0][i] *= factor;
|
for(int j=0;j<M;++j)
|
||||||
|
m[i][j] *= factor;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
Matrix<N,M,T>& Matrix<N,M,T>::operator/=(T divisor) {
|
Matrix<N,M,T>& Matrix<N,M,T>::operator/=(T divisor) {
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
m[0][i] /= divisor;
|
for(int j=0;j<M;++j)
|
||||||
|
m[i][j] /= divisor;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
bool Matrix<N,M,T>::operator==(const Matrix<N,M,T>& other) const
|
bool Matrix<N,M,T>::operator==(const Matrix<N,M,T>& other) const
|
||||||
{
|
{
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
if(m[0][i] != other.m[0][i])
|
for(int j=0;j<M;++j)
|
||||||
return false;
|
if(m[i][j] != other.m[i][j])
|
||||||
return true;
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
bool Matrix<N,M,T>::operator!=(const Matrix<N,M,T>& other) const
|
bool Matrix<N,M,T>::operator!=(const Matrix<N,M,T>& other) const
|
||||||
{
|
{
|
||||||
for(int i=0;i<N*M;++i)
|
for(int i=0;i<N;++i)
|
||||||
if(m[0][i] != other.m[0][i])
|
for(int j=0;j<M;++j)
|
||||||
|
if(m[i][j] != other.m[i][j])
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M, typename T>
|
template<int N, int M, typename T>
|
||||||
|
|
Loading…
Reference in New Issue