# Row Vector or Column Vector?

**URL:** <https://forums.imgtec.com/t/row-vector-or-column-vector/1256>\
**Category:** PowerVR Insider\
**Created:** [December 7, 2011, 7:33am UTC](https://forums.imgtec.com/t/row-vector-or-column-vector/1256 "2011-12-07T07:33:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yiwen](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/yiwen/32/129_2.png) [@yiwen](https://forums.imgtec.com/u/yiwen)\
**Post date:** [December 7, 2011, 7:33am UTC](https://forums.imgtec.com/t/row-vector-or-column-vector/1256/1 "2011-12-07T07:33:42Z")

</div>

OGLES\_WINDOWS\_X86EMULATION\_2.09.29.0649  
  
I would like to know the vector is deal with row vector or column vector in SDK?(You know it is very import to calculate vector with matrix).  
  
It seems the matrix is prepared for row vector since I read the following from “PVRTVector.h”:  
== BEGIN ==  
_/!  
**&nbsp;@Function&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Translation  
&nbsp;@Returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a PVRTMat4 corresponding to the requested translation  
&nbsp;@Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Calculates a 4x4 matrix corresponding to a transformation  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of tx, ty and tz distance in each axis.**  
**/  
&nbsp;&nbsp;&nbsp; static PVRTMat4 Translation(const VERTTYPE tx, const VERTTYPE ty, const VERTTYPE tz)  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return PVRTMat4(f2vt(1),0,0,0,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,f2vt(1),0,0,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,0,f2vt(1),0,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tx,ty,tz,f2vt(1));  
&nbsp;&nbsp;&nbsp; }**_  
== END ==  
So the translation matrix will be:  
**1.0&nbsp; 0.0&nbsp; 0.0&nbsp; 0.0  
0.0&nbsp; 1.0&nbsp; 0.0&nbsp; 0.0  
0.0&nbsp; 0.0&nbsp; 1.0&nbsp; 0.0  
tx&nbsp;&nbsp;&nbsp; ty&nbsp;&nbsp;&nbsp;&nbsp; tz&nbsp;&nbsp; 1.0**  
  
However another function I read from same file:  
== BEGIN ==  
_/!  
**&nbsp;@Function&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
&nbsp;@Input&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rhs a PVRTMat4  
&nbsp;@Returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result of multiplication  
&nbsp;@Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrix multiplication operator PVRTVec4 and PVRTMat4**  
/  
&nbsp;&nbsp;&nbsp; PVRTVec4 PVRTVec4::operator(const PVRTMat4& rhs) const  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PVRTVec4 out;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.x = VERTTYPEMUL(x,rhs.f[0])+VERTTYPEMUL(y,rhs.f[1])+VERTTYPEMUL(z,rhs.f[2])+VERTTYPEMUL(w,rhs.f[3]);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.y = VERTTYPEMUL(x,rhs.f[4])+VERTTYPEMUL(y,rhs.f[5])+VERTTYPEMUL(z,rhs.f[6])+VERTTYPEMUL(w,rhs.f[7]);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.z = VERTTYPEMUL(x,rhs.f[8])+VERTTYPEMUL(y,rhs.f[9])+VERTTYPEMUL(z,rhs.f[10])+VERTTYPEMUL(w,rhs.f[11]);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.w = VERTTYPEMUL(x,rhs.f[12])+VERTTYPEMUL(y,rhs.f[13])+VERTTYPEMUL(z,rhs.f[14])+VERTTYPEMUL(w,rhs.f[15]);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return out;  
&nbsp;&nbsp;&nbsp; }_  
== END ==  
Thus it seems vector is deal with column when PVRTVec4 \* PVRTMat4.  
E.g. there is PVRTVec4 V( **A, B, C, 1.0** ) and the above translation matrix M,  
so V \* M =  
(  
**A1.0 + B0.0 + C0.0 + 1.0_0.0,  
A_0.0 + B_1.0 + C_0.0 + 1.0_0.0,  
A_0.0 + B_0.0 + C_0.0 + 1.0_0.0,  
A_tx&nbsp;&nbsp; + B_ty&nbsp;&nbsp; + C_tz&nbsp;&nbsp; + 1.0\*1.0**  
)  
  
Observably they are contradictory and I always got wrong resultOuch.  
  
Please confirm that or correct me if I’m wrong.

---

<div class="post-metadata">

**Author:** ![GordonMaclachlan](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@GordonMaclachlan](https://forums.imgtec.com/u/GordonMaclachlan)\
**Post date:** [December 8, 2011, 10:07am UTC](https://forums.imgtec.com/t/row-vector-or-column-vector/1256/2 "2011-12-08T10:07:18Z")

</div>

Hi, I had a brief look at this and it does seem like there may be a problem. I’ve filed this as an issue in our system (BRN35318) for further investigation - you can look for this number in our release notes for a fix if there is no further post here.

---

<div class="post-metadata">

**Author:** ![yiwen](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/yiwen/32/129_2.png) [@yiwen](https://forums.imgtec.com/u/yiwen)\
**Post date:** [December 8, 2011, 12:39pm UTC](https://forums.imgtec.com/t/row-vector-or-column-vector/1256/3 "2011-12-08T12:39:30Z")

</div>

Thanks for your reply, I’ve modified the source on my side to get correct result. Could I access your bug trace system as customer to know more details?

---

<div class="post-metadata">

**Author:** ![GordonMaclachlan](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@GordonMaclachlan](https://forums.imgtec.com/u/GordonMaclachlan)\
**Post date:** [December 8, 2011, 1:20pm UTC](https://forums.imgtec.com/t/row-vector-or-column-vector/1256/4 "2011-12-08T13:20:08Z")

</div>

We don’t normally allow access to our bug tracking outside the company. If you are a customer of ours then you may have access to more details through the IPGear system.  
  
  
  
  
  
May I ask, which function did you change in your own code?

---

<div class="post-metadata">

**Author:** ![yiwen](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/yiwen/32/129_2.png) [@yiwen](https://forums.imgtec.com/u/yiwen)\
**Post date:** [December 20, 2011, 1:30am UTC](https://forums.imgtec.com/t/row-vector-or-column-vector/1256/5 "2011-12-20T01:30:31Z")

</div>

sorry for so late reply.
&nbsp;

I just modify the function&nbsp; _PVRTVec4 PVRTVec4::operator\*(const PVRTMat4& rhs) const,_ so that&nbsp;I can deal with vector and matrix correctly.

&nbsp;

I hope the developers will check all corresponding functions(for PVRTMat3 and PVRTMat4)&nbsp;similar as I posted in BRN35318.
