August 26, 2010
On Thu, Aug 26, 2010 at 22:41, bearophile <bearophileHUGS@lycos.com> wrote:

> Philippe Sigaud:
> > What you lose is the CT checking that can be done for multiplication or additions if all dimensions are exposed in the type.
>
> If you want, you may create a second nD array struct where sizes too are CT values, plus two methods/free functions to convert between the two array types.
>
>
But in the same way that you cannot always convert T[] into T[3], how could
you convert a Tensor!(int,2) (2D, runtime dims) into a Matrix!(int,4,4)?
(2D, CT dim: 4*4)


Philippe


August 26, 2010
Philippe Sigaud:
> But in the same way that you cannot always convert T[] into T[3], how could
> you convert a Tensor!(int,2) (2D, runtime dims) into a Matrix!(int,4,4)?
> (2D, CT dim: 4*4)

The conversion functions are written by you, so you can all things you want (with just few runtime tests). If they are both on the heap you may even avoid copying data.

Bye,
bearophile
1 2
Next ›   Last »