# Kronecker product with arrays

User ForumKronecker product with arrays
sergiocampod asked 2 years ago

Hi,

I want to know if there is a way to compute kronecker product with arrays since the usual operator .*.  is not defined for arrays.

My problem is that of repeating values of an array across a certain dimension:

a[1,.,.]=1 |2|3; to b[1,.,.]=1 1 | 2 2 | 3 3;

and the same for every dimension of a (a[2,.,.], a[3,.,.] and so on)

Kronecker product seems to be a way to get this since:

b[1,.,.]=a[1,.,.].*.{1 1};

The command areshape seems to be working on similar lines, but it takes all the values of the original array at once and starts repeating in the same order (as if it vectorized it to then assign its values to a new array of the specified dimensions).

I'm sorry for how confusing my question is, I hope you can help me.

Sergio

1 Answers
aptech Staff answered 2 years ago

OK, if we want to create a that equals:

```plane [1,.,.]

1 1 1
2 2 2
3 3 3

plane [2,.,.]

1 1 1
2 2 2
3 3 3
```

Then I would do this:

```r = 3;
c = 3;
m = 2;

val = { 1, 2, 3 };
a = ones(r, c) .* val;

a = areshape(a, m|r|c);
```

or if I wanted to be more compact, I might do this:

```a = areshape(ones(3,3) .* seqa(1,1,3), 2|3|3)
```

• ### Aptech Systems, Inc. Worldwide Headquarters

Address:
Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286

Phone: 360.886.7100
FAX: 360.886.8922

Ready to Get Started?

• ### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

• ### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

• ### Have a Specific Question?

Get a real answer from a real person

• Need Support?
• ### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

• ### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

• ### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.