Hello!
I am new to Arduino, array multiplication in Arduino is quite confusing for me therefore I am trying to use BasicLinearAlgebra library.
here I tried to multiply (variable name: vReal) 4 x 1 array to defined matrix (variable name: B) 2 x 4 array, vReal and B are both a double) but I got errors:
Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"
D:\Chika\TA\ArduinoMindwave2\Mindwave\Mindwave.ino: In function 'void loop()':
Mindwave:59:37: error: no match for 'operator*' (operand types are 'BLA::Matrix<2, 4>' and 'double [4]')
BLA::Matrix<2, 1> D = B * vReal;
~~^~~~~~~
In file included from sketch\Toeplitz32x64.h:4:0,
from D:\Chika\TA\ArduinoMindwave2\Mindwave\Mindwave.ino:4:
D:\MyDocuments\Arduino\libraries\BasicLinearAlgebra/BasicLinearAlgebra.h:84:80: note: candidate: template<int operandCols, class opMemT> BLA::Matrix<rows, operandCols, BLA::Array<rows, operandCols, typename MemT::elem_t> > BLA::Matrix<rows, cols, MemT>::operator*(const BLA::Matrix<cols, operandCols, opMemT>&) const [with int operandCols = operandCols; opMemT = opMemT; int rows = 2; int cols = 4; MemT = BLA::Array<2, 4, float>]
Matrix<rows, operandCols, Array<rows, operandCols, typename MemT::elem_t>> operator*(
^~~~~~~~
D:\MyDocuments\Arduino\libraries\BasicLinearAlgebra/BasicLinearAlgebra.h:84:80: note: template argument deduction/substitution failed:
D:\Chika\TA\ArduinoMindwave2\Mindwave\Mindwave.ino:59:39: note: mismatched types 'const BLA::Matrix<4, operandCols, opMemT>' and 'double [4]'
BLA::Matrix<2, 1> D = B * vReal;
^~~~~
In file included from D:\MyDocuments\Arduino\libraries\BasicLinearAlgebra/BasicLinearAlgebra.h:140:0,
from sketch\Toeplitz32x64.h:4,
from D:\Chika\TA\ArduinoMindwave2\Mindwave\Mindwave.ino:4:
D:\MyDocuments\Arduino\libraries\BasicLinearAlgebra/impl/BasicLinearAlgebra.h:287:62: note: candidate: BLA::Matrix<rows, cols, BLA::Array<rows, cols, typename MemT::elem_t> > BLA::Matrix<rows, cols, MemT>::operator*(typename MemT::elem_t) const [with int rows = 2; int cols = 4; MemT = BLA::Array<2, 4, float>; typename MemT::elem_t = float; typename MemT::elem_t = float]
Matrix<rows, cols, Array<rows, cols, typename MemT::elem_t>> Matrix<rows, cols, MemT>::operator*(
^~~~~~~~~~~~~~~~~~~~~~~~
D:\MyDocuments\Arduino\libraries\BasicLinearAlgebra/impl/BasicLinearAlgebra.h:287:62: note: no known conversion for argument 1 from 'double [4]' to 'BLA::Array<2, 4, float>::elem_t {aka float}'
Multiple libraries were found for "arduinoFFT.h"
Used: D:\MyDocuments\Arduino\libraries\arduinoFFT
Not used: C:\Program Files (x86)\Arduino\libraries\arduinoFFT-1.5.6
exit status 1
no match for 'operator*' (operand types are 'BLA::Matrix<2, 4>' and 'double [4]')
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
the code itself is quite long, therefore I will just show the problems
here is the code for 2 x 4 matrix (matrix2x4.h)
#include <BasicLinearAlgebra.h>
using namespace BLA;
BLA::Matrix<2, 4,Array<2,4,double> > B = {-0.125, 0.125, -0.125, 0.125, -0.125, 0.125, -0.125, 0.125};
#endif
here is the main program
FFT.Compute(vReal, vImag, samples, FFT_FORWARD);
for (int r = 0; r < 4; r++){
BLA::Matrix<4,1> vReal[r];
BLA::Matrix<2,4>B;
BLA::Matrix<2, 1> D = B * vReal;
Serial << "D: " << D << '\n';
}
how to fix it? thank you in advance