i dont have a scaling matrix, just a vector. i guess i need to multiply some elements of matrix with this scaling values such that, when a vector is multiplied with this matrix, scaling is applied. but which elements should i multiply ?

for your question, isnt it supposed to work so ? when you multiply a vector with a matrix, it's first rotated around origin then translated to new position. if matrix.rotate? methods modify the translation part, translation data will be corrupted and that behaviour will be broken, right ?