Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the Col Major ( Column Major ) code with SIMD using C + + . / / 1 . Vect _ Col _ SIMD.h

Complete the Col Major(Column Major) code with SIMD using C++.
//1. Vect_Col_SIMD.h
#ifndef Vect_Col_SIMD_H
#define Vect_Col_SIMD_H
#include
#include
class Matrix_Col_SIMD;
// Rules:
// No implementation in Header
// No inline keyword
class Vect_Col_SIMD
{
public:
Vect_Col_SIMD()= default;
Vect_Col_SIMD(const Vect_Col_SIMD &tmp)= default;
Vect_Col_SIMD &operator =(const Vect_Col_SIMD &tmp)= default;
~Vect_Col_SIMD()= default;
Vect_Col_SIMD(const float tx, const float ty, const float tz, const float tw);
public:
union
{
__m128_m;
struct
{
float x;
float y;
float z;
float w;
};
};
};
#endif
//--- End of File -----
//2. Vect_Col_SIMD.cpp
#include "Vect_Col_SIMD.h"
Vect_Col_SIMD::Vect_Col_SIMD(const float tx, const float ty, const float tz, const float tw)
: x(tx), y(ty), z(tz), w(tw)
{
}
//--- End of File -------
//3. Matrix_Col_SIMD.h
#ifndef Matrix_Col_SIMD_H
#define Matrix_Col_SIMD_H
#include "Vect_Col_SIMD.h"
// Rules:
// Implement for Col Major
// No implementation in Header
//
// Proxy (optional)
// Proxies are the only thing that can have the keyword "inline"
// inline only for subsitution resolving.. that's it
// No constructors or other operators... only proxy for substituion purpose
// example: (this is allowed)
// inline MM operator *(const Matrix_Col_SIMD &m, const Matrix_Col_SIMD &n)
// No proxy implementation in header
// conversion operator needs to be implemented in CPP file
// proxy constructors are allowed in header (only exception)
class Matrix_Col_SIMD
{
public:
Matrix_Col_SIMD()= default;
Matrix_Col_SIMD(const Matrix_Col_SIMD &tmp)= default;
Matrix_Col_SIMD &operator=(const Matrix_Col_SIMD &tmp)= default;
~Matrix_Col_SIMD()= default;
Matrix_Col_SIMD(const Vect_Col_SIMD &tV0,
const Vect_Col_SIMD &tV1,
const Vect_Col_SIMD &tV2,
const Vect_Col_SIMD &tV3);
Matrix_Col_SIMD operator *(const Matrix_Col_SIMD &n);
Vect_Col_SIMD operator *(const Vect_Col_SIMD &n);
union
{
struct
{
Vect_Col_SIMD v0;
Vect_Col_SIMD v1;
Vect_Col_SIMD v2;
Vect_Col_SIMD v3;
};
struct
{
float m0;
float m1;
float m2;
float m3;
float m4;
float m5;
float m6;
float m7;
float m8;
float m9;
float m10;
float m11;
float m12;
float m13;
float m14;
float m15;
};
};
};
#endif
//--- End of File ---
//4. Matrix_Col_SIMD.cpp
#include "Vect_Col_SIMD.h"
#include "Matrix_Col_SIMD.h"
Matrix_Col_SIMD::Matrix_Col_SIMD(const Vect_Col_SIMD &tV0, const Vect_Col_SIMD &tV1, const Vect_Col_SIMD &tV2, const Vect_Col_SIMD &tV3)
: v0(tV0), v1(tV1), v2(tV2), v3(tV3)
{
}
Vect_Col_SIMD Matrix_Col_SIMD::operator *(const Vect_Col_SIMD &vb)
{
// TODO : fix here
}
Matrix_Col_SIMD Matrix_Col_SIMD::operator *(const Matrix_Col_SIMD &mb)
{
// TODO : fix here
}
//--- End of File -----
Must can pass below test :
Matrix_Col_SIMD Rx(Vect_Col_SIMD(1.000000f,0.000000f,0.000000f,0.000000f),
Vect_Col_SIMD(0.000000f,-0.500000f,-0.866025f,0.000000f),
Vect_Col_SIMD(0.000000f,0.866025f,-0.500000f,0.000000f),
Vect_Col_SIMD(0.000000f,0.000000f,0.000000f,1.000000f));
Matrix_Col_SIMD Ry(Vect_Col_SIMD(0.707107f,0.000000f,0.707107f,0.000000f),
Vect_Col_SIMD(0.000000f,1.000000f,0.000000f,0.000000f),
Vect_Col_SIMD(-0.707107f,0.000000f,0.707107f,0.000000f),
Vect_Col_SIMD(0.000000f,0.000000f,0.000000f,1.000000f));
Matrix_Col_SIMD Rz(Vect_Col_SIMD(0.500000f,0.866025f,0.000000f,0.000000f),
Vect_Col_SIMD(-0.866025f,0.500000f,0.000000f,0.000000f),
Vect_Col_SIMD(0.000000f,0.000000f,1.000000f,0.000000f),
Vect_Col_SIMD(0.000000f,0.000000f,0.000000f,1.000000f));
Matrix_Col_SIMD T(Vect_Col_SIMD(1.000000f,0.000000f,0.000000f,4.000000f),
Vect_Col_SIMD(0.000000f,1.000000f,0.000000f,5.000000f),
Vect_Col_SIMD(0.000000f,0.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

Students also viewed these Databases questions

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago