zmij / math Goto Github PK
View Code? Open in Web Editor NEWSmall C++17 library for vector and matrix computations
License: Apache License 2.0
Small C++17 library for vector and matrix computations
License: Apache License 2.0
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.
In readme, it reads;
#include <psst/math/polar_coord.hpp>
#include <psst/math/spherical_coord.hpp>
#include <psst/math/cylindrical_coord.hpp>
using polar_c = psst::math::polar_coord<double>;
using spherical_c = psst::math::spherical_coord<double>;
using cylindrical_c = psst::math::cylindrical_coord<double>;
using vec3 = psst::math::vector<double, 3>;
using psst::math::operator "" _deg;
void a()
{
polar_c p{10, 180_deg};
spherical_c s = convert<spherical_c>(p);
s.inclination() = 45_deg;
cylindrical_c c = convert<cylindrical_c>(s);
vec3 v = convert<vec3>(c);
}
However, this does not compile on C++17, at least on GCC 12.2.0.
error: variable 'polar_c p' has initializer but incomplete type
error: variable 'spherical_c s' has initializer but incomplete type
error: variable 'cylindrical_c c' has initializer but incomplete type
error: variable 'vec3 v' has initializer but incomplete type
Did I understand something wrong or is this a bug?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.