src/types/matrix.cpp

changeset 1065
c8ecddbd99e9
parent 1063
1f15c52c11f6
child 1068
283de3bd8b0e
equal deleted inserted replaced
1064:4c7a353cf583 1065:c8ecddbd99e9
55 * Constructs a matrix from an initializer list. 55 * Constructs a matrix from an initializer list.
56 * Note: the initializer list must have exactly 9 values. 56 * Note: the initializer list must have exactly 9 values.
57 */ 57 */
58 Matrix::Matrix (const std::initializer_list<double>& values) 58 Matrix::Matrix (const std::initializer_list<double>& values)
59 { 59 {
60 if (length(values) == 9) 60 if (countof(values) == 9)
61 memcpy (&m_values[0], values.begin(), sizeof m_values); 61 memcpy (&m_values[0], values.begin(), sizeof m_values);
62 } 62 }
63 63
64 /** 64 /**
65 * @brief Matrix::dump 65 * @brief Matrix::dump
142 * @param other 142 * @param other
143 * @return whether the two matrices are equal 143 * @return whether the two matrices are equal
144 */ 144 */
145 bool Matrix::operator==(const Matrix& other) const 145 bool Matrix::operator==(const Matrix& other) const
146 { 146 {
147 for (int i = 0; i < length(m_values); ++i) 147 for (int i = 0; i < countof(m_values); ++i)
148 { 148 {
149 if (not qFuzzyCompare(m_values[i], other.m_values[i])) 149 if (not qFuzzyCompare(m_values[i], other.m_values[i]))
150 return false; 150 return false;
151 } 151 }
152 return true; 152 return true;

mercurial