Skip to content

Matrix by vector multiplication issues #10

Open
@jussihi

Description

Hello, when experimenting further with the library, I found that the following snippet:

#include <iostream>
#include <cassert>

#include <psst/math/vector.hpp>
#include <psst/math/matrix.hpp>
#include <psst/math/coordinate_conversion.hpp>
#include <psst/math/spherical_coord.hpp>


void test_psst_math()
{
  using vector3d = psst::math::vector<double, 3>;
  using matrix3x3 = psst::math::matrix<double, 3, 3>;

  vector3d v1 = {1, 2, 3};

  matrix3x3 m1 { { 1,  2,  3 },
                 { 4,  5,  6 },
                 { 7,  8,  9 } };

  vector3d v2 = m1 * psst::math::expr::as_col_matrix(v1);
  matrix3x3 m2 = psst::math::expr::transpose(m1);

}


int main(int argc, char *argv[])
{
  test_psst_math();
}

results in the following compiler error:

test.cpp: In function 'void test_psst_math()':
test.cpp:21:20: error: conversion from 'psst::math::expr::m::matrix_matrix_multiply<psst::math::matrix<double, 3, 3>, psst::math::expr::m::vector_as_col_matrix<psst::math::vector<double, 3> >&&>' to non-scalar type 'vector3d' {aka 'psst::math::vector<double, 3>'} requested
   21 |   vector3d v2 = m1 * psst::math::expr::as_col_matrix(v1);
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

However, this is almost completely copy&pasted from the git readme example, so one would assume that it should work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions