Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/math3d/qgenericmatrix.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    199199Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other)
    200200{
    201     for (int index = 0; index < N * M; ++index)
    202         m[0][index] += other.m[0][index];
     201    for (int row = 0; row < M; ++row)
     202        for (int col = 0; col < N; ++col)
     203            m[col][row] += other.m[col][row];
    203204    return *this;
    204205}
     
    207208Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other)
    208209{
    209     for (int index = 0; index < N * M; ++index)
    210         m[0][index] -= other.m[0][index];
     210    for (int row = 0; row < M; ++row)
     211        for (int col = 0; col < N; ++col)
     212            m[col][row] -= other.m[col][row];
    211213    return *this;
    212214}
     
    215217Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor)
    216218{
    217     for (int index = 0; index < N * M; ++index)
    218         m[0][index] *= factor;
     219    for (int row = 0; row < M; ++row)
     220        for (int col = 0; col < N; ++col)
     221            m[col][row] *= factor;
    219222    return *this;
    220223}
     
    223226Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const
    224227{
    225     for (int index = 0; index < N * M; ++index) {
    226         if (m[0][index] != other.m[0][index])
    227             return false;
    228     }
     228    for (int row = 0; row < M; ++row)
     229        for (int col = 0; col < N; ++col)  {
     230            if (m[col][row] != other.m[col][row])
     231                return false;
     232        }
    229233    return true;
    230234}
     
    233237Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const
    234238{
    235     for (int index = 0; index < N * M; ++index) {
    236         if (m[0][index] != other.m[0][index])
    237             return true;
    238     }
     239    for (int row = 0; row < M; ++row)
     240        for (int col = 0; col < N; ++col) {
     241            if (m[col][row] != other.m[col][row])
     242                return true;
     243        }
    239244    return false;
    240245}
     
    243248Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor)
    244249{
    245     for (int index = 0; index < N * M; ++index)
    246         m[0][index] /= divisor;
     250    for (int row = 0; row < M; ++row)
     251        for (int col = 0; col < N; ++col)
     252            m[col][row] /= divisor;
    247253    return *this;
    248254}
     
    252258{
    253259    QGenericMatrix<N, M, T> result(1);
    254     for (int index = 0; index < N * M; ++index)
    255         result.m[0][index] = m1.m[0][index] + m2.m[0][index];
     260    for (int row = 0; row < M; ++row)
     261        for (int col = 0; col < N; ++col)
     262            result.m[col][row] = m1.m[col][row] + m2.m[col][row];
    256263    return result;
    257264}
     
    261268{
    262269    QGenericMatrix<N, M, T> result(1);
    263     for (int index = 0; index < N * M; ++index)
    264         result.m[0][index] = m1.m[0][index] - m2.m[0][index];
     270    for (int row = 0; row < M; ++row)
     271        for (int col = 0; col < N; ++col)
     272            result.m[col][row] = m1.m[col][row] - m2.m[col][row];
    265273    return result;
    266274}
     
    285293{
    286294    QGenericMatrix<N, M, T> result(1);
    287     for (int index = 0; index < N * M; ++index)
    288         result.m[0][index] = -matrix.m[0][index];
     295    for (int row = 0; row < M; ++row)
     296        for (int col = 0; col < N; ++col)
     297            result.m[col][row] = -matrix.m[col][row];
    289298    return result;
    290299}
     
    294303{
    295304    QGenericMatrix<N, M, T> result(1);
    296     for (int index = 0; index < N * M; ++index)
    297         result.m[0][index] = matrix.m[0][index] * factor;
     305    for (int row = 0; row < M; ++row)
     306        for (int col = 0; col < N; ++col)
     307            result.m[col][row] = matrix.m[col][row] * factor;
    298308    return result;
    299309}
     
    303313{
    304314    QGenericMatrix<N, M, T> result(1);
    305     for (int index = 0; index < N * M; ++index)
    306         result.m[0][index] = matrix.m[0][index] * factor;
     315    for (int row = 0; row < M; ++row)
     316        for (int col = 0; col < N; ++col)
     317            result.m[col][row] = matrix.m[col][row] * factor;
    307318    return result;
    308319}
     
    312323{
    313324    QGenericMatrix<N, M, T> result(1);
    314     for (int index = 0; index < N * M; ++index)
    315         result.m[0][index] = matrix.m[0][index] / divisor;
     325    for (int row = 0; row < M; ++row)
     326        for (int col = 0; col < N; ++col)
     327            result.m[col][row] = matrix.m[col][row] / divisor;
    316328    return result;
    317329}
Note: See TracChangeset for help on using the changeset viewer.