Tensor

A

Akyl Tulegenov

Dear All!

I faced a problem when implementing class Tensor. The idea is
simple - give a rank as an input to produce a tensor of rank n.
But how to do it programmatically w/o the use of any "if
then" statements? At the moment I have a large number of classes
Tensor_N, which doesn't look nice, and doesn't fit to the problem I'm
trying to solve.
for rank one I need *array, for 2 **array, for 3 ***array, etc.
Is there any way to make it as a black box?
For instance, create a string beginning with n stars and use it in
the code??? A tiny code-snippet would be extremely helpful to catch the
general idea. Certainly, if it is possible at all.

Cheers.
Akyl.
 
B

bartek

Dear All!

I faced a problem when implementing class Tensor. The idea is
simple - give a rank as an input to produce a tensor of rank n.
But how to do it programmatically w/o the use of any "if
then" statements? At the moment I have a large number of classes
Tensor_N, which doesn't look nice, and doesn't fit to the problem I'm
trying to solve.
for rank one I need *array, for 2 **array, for 3 ***array, etc.
Is there any way to make it as a black box?
For instance, create a string beginning with n stars and use it in
the code??? A tiny code-snippet would be extremely helpful to catch the
general idea. Certainly, if it is possible at all.

As I understand, you need a multi-dimensional array.
Here's the first hit I got from google on the subject:
http://www.codeproject.com/cpp/multi_array_using_TMP.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,458
Latest member
Chris#

Latest Threads

Top