I have a matrix of 3D points (`positions`), in which every column represents a 3D point expressed in a local frame at a specific time instance.

The `transforms` (row)vector contains the transformation matrix of the moving local frame at each time instance, i.e. the ith transformation matrix corresponds with the ith column of `positions`.

I want to calculate the position in the global frame (`transformed`) by applying the transformation matrixes to their corresponding point.

This can be done with a for loop as follows:

```c++
Eigen::Matrix<Eigen::Isometry3d, 1, Eigen::Dynamic> transforms;
Eigen::Matrix<double, 3, Eigen::Dynamic> positions, transformed;

for (int i = 0; i < positions.cols(); ++i)
    transformed.col(i) = transforms(i) * positions.col(i);

```

I was wondering if it is possible to perform the same operation avoiding the for loop. I tried the following two approaches, but they are giving me compilation errors:

* Apply the transformation columnwise:

```c++
transformed = transforms.colwise() * positions.colwise ();

```

> 
> error: invalid operands to binary expression (`ColwiseReturnType` (aka `VectorwiseOp<Eigen::Matrix<Eigen::Transform<double, 3, 1, 0>, 1, -1, 1, 1, -1>, Vertical>`) and `ColwiseReturnType` (aka `VectorwiseOp<Eigen::Matrix<double, 3, -1, 0, 3, -1>, Vertical>`))
> 
> 
>
* Apply the transformation using arrays:

```c++
transformed = transforms.array() * positions.array().colwise ();

```

> 
> error: invalid operands to binary expression (`ArrayWrapper<Eigen::Matrix<Eigen::Transform<double, 3, 1, 0>, 1, -1, 1, 1, -1> >` and `ColwiseReturnType` (aka `VectorwiseOp<Eigen::ArrayWrapper<Eigen::Matrix<double, 3, -1, 0, 3, -1> >, Vertical>`))
> 
> 
>

**Question**: How can I rewrite the for loop to eliminate the (explicit) for loop?