# Kronecker doesn't work, kron yes, in this case

**URL:** <https://discourse.julialang.org/t/kronecker-doesnt-work-kron-yes-in-this-case/109474>\
**Category:** New to Julia\
**Tags:** question, matrices\
**Created:** [January 30, 2024, 9:35pm UTC](https://discourse.julialang.org/t/kronecker-doesnt-work-kron-yes-in-this-case/109474 "2024-01-30T21:35:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [January 31, 2024, 3:41am UTC](https://discourse.julialang.org/t/kronecker-doesnt-work-kron-yes-in-this-case/109474/6 "2024-01-31T03:41:37Z")

</div>

Also, your pre-allocation of `matr_C` isn’t effective or needed, since that allocation is not used. Unlike in Fortran or Matlab, when you write `matr_C = ...`, this does not copy the right-hand side into `matr_C`. Instead, the label `matr_C` in effect is “re-pointed” to whatever is on the right-hand side, in this case a `KroneckerProduct` type as defined in the `Kronecker` package. So the memory you allocated for `matr_C` is discarded and eventually cleaned up by Julia’s garbage collector.

This is an important point to understand about Julia, and it is often discussed in this forum, e.g. [here](https://discourse.julialang.org/t/value-function-scoping-problem/20236/10).

---

_[View the full topic](https://discourse.julialang.org/t/kronecker-doesnt-work-kron-yes-in-this-case/109474)._
