Skip to content

Commit f4340dd

Browse files
committed
fixed the typo. Also check the output vector size
1 parent 3930cc6 commit f4340dd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

DirectProgramming/DPC++/DenseLinearAlgebra/complex_mult/src/complex_mult.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class CustomDeviceSelector : public device_selector {
4343
// are inputs to the parallel function
4444
void DpcppParallel(queue &q, std::vector<Complex2> &in_vect1,
4545
std::vector<Complex2> &in_vect2,
46-
std::vector<Complex2> &out_vect) {
46+
std::vector<Complex2> &out_vect) {
4747
auto R = range(in_vect1.size());
48-
if (in_vect1.size() != in_vect2.size()){
49-
std::cout << "ERROR: Vector sizes didnt match"<< "\n";
48+
if (in_vect2.size() != in_vect1.size() || out_vect.size() != in_vect1.size()){
49+
std::cout << "ERROR: Vector sizes do not match"<< "\n";
5050
return;
5151
}
5252
// Setup input buffers
@@ -76,8 +76,8 @@ void DpcppParallel(queue &q, std::vector<Complex2> &in_vect1,
7676
void DpcppScalar(std::vector<Complex2> &in_vect1,
7777
std::vector<Complex2> &in_vect2,
7878
std::vector<Complex2> &out_vect) {
79-
if (in_vect1.size() != in_vect2.size()){
80-
std::cout<<"ERROR: Vector sizes didnt match"<<"\n";
79+
if ((in_vect2.size() != in_vect1.size()) || (out_vect.size() != in_vect1.size())){
80+
std::cout<<"ERROR: Vector sizes do not match"<<"\n";
8181
return;
8282
}
8383
for (int i = 0; i < in_vect1.size(); i++) {

0 commit comments

Comments
 (0)