tomstewart89 / BasicLinearAlgebra

A library for using matrices and linear algebra on Arduino
MIT License
185 stars 38 forks source link

port to PC #49

Closed brand17 closed 2 years ago

brand17 commented 2 years ago

Make the library working on PC

tomstewart89 commented 2 years ago

Hey @brand17, thanks for the PR!

I actually have some code already that can be used to compile this library on a PC. You can find it here: Arduino.h. The idea is to set up the inclue directories such that BasicLinearAlgebra includes this file rather than Arduino's header file. That header then the Print and a few other things. This is how I run the unit tests for this repo (i.e these guys).

I'd rather stick with that system since it doesn't require any changes to the main library but I notice that it might not perfectly suit your use-case since it prints Serial output to a stringstream rather than stdout. Would you be interested in updating this PR to improve Arduino.h instead?

brand17 commented 2 years ago

Hi, @tomstewart89. Its great idea. I have made a few changes to Arduino.h : added println and endl. I ensured that my changes pass your tests. I am getting error namespace has no member max, so I added #include <algorithm>. I compiled with g++ on VSCode.

brand17 commented 2 years ago

@tomstewart89 Sorry, forgot to answer that the overloaded operator needs to use << endl. You are correct

tomstewart89 commented 2 years ago

Hey @brand17, did you mean to close this PR? I’m happy to merge it if you are

brand17 commented 2 years ago

Hi, @tomstewart89. Sorry - it was my first PR. I thought that I need to close to merge.