
#include <pw/core/matrix.hpp>
#include <pw/core/serialize.hpp>

#include <iostream>

int main(int argc,char **argv) {

    pw::matrix44d m;

    m.set_identity();

    std::cout << "m = " << pw::serialize::matrix(m) << std::endl;

    std::cout << "row_stride() : " << m.row_stride() << std::endl;
    std::cout << "col_stride() : " << m.col_stride() << std::endl;
    std::cout << "rows()       : " << m.rows() << std::endl;
    std::cout << "cols()       : " << m.cols() << std::endl;
    std::cout << "data()       : " << m.data() << std::endl;
    std::cout << "data()[0]    : " << m.data()[0] << std::endl;
    std::cout << "at(0,0)      : " << m.at(0,0) << std::endl;
    std::cout << "determinant(): " << m.determinant() << std::endl;


    pw::matrix44d mi = m.get_inverse();

    std::cout << "mi.at(0,0)   : " << mi.at(0,0) << std::endl;


    pw::matrix44d mscale = m * 4.2;


    std::cout << "mscale = " << pw::serialize::matrix(mscale) << std::endl;


    pw::matrix44d a;

    for (int r = 0; r < m.rows(); r++) {
        for (int c = 0; c < m.cols(); c++) {
            a.at(r,c) = r * m.cols() + c;
        }
    }
    std::cout << "a = " << pw::serialize::matrix(a) << std::endl;

    pw::matrix44d r = a * mscale;

    std::cout << "a * mscale = " << pw::serialize::matrix(r) << std::endl;


    return 0;
}
