# What's the proper way of dealing with Adjoint?

**URL:** https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457
**Category:** General Usage
**Tags:** question
**Created:** [August 14, 2018, 6:49pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457 "2018-08-14T18:49:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![vpetukhov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vpetukhov/32/12954_2.png) [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)
#### Post date: [August 14, 2018, 6:49pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/1 "2018-08-14T18:49:58Z")

</div>

During upgrade of some libraries to Julia 0.7 I’ve met many situations where package developers use `DenseMatrix{T}` as an abstract class for a matrix data. But after new release, all code, which use `transpose` stopped working, as now it returns `Adjoint`, which is subtype of `AbstractArray{T,2}`. What is a proper way to upgrade such places?  
Replacement of all `DenseMatrix{T}` with `AbstractArray{T,2}` would significantly increase class of accepted subtypes. Wrapping each occurrence of transposition (`m'`) with `Array(m')` looks too verbose as well as replacement of `DenseMatrix` with `Union{DenseMatrix, Adjoint}`.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 14, 2018, 7:14pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/2 "2018-08-14T19:14:05Z")

</div>

`copy` to materialize the adjoint and it should work like before.

---

<div class="post-metadata">

### Author: ![vpetukhov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vpetukhov/32/12954_2.png) [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)
#### Post date: [August 14, 2018, 8:14pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/3 "2018-08-14T20:14:43Z")

</div>

Thanks for the reply!  
Isn’t it as long as `Array(m')`? Do you really mean to use it each time with `'` operator?

---

<div class="post-metadata">

### Author: ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)
#### Post date: [August 14, 2018, 8:22pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/4 "2018-08-14T20:22:50Z")

</div>

Before it was exactly doing this, creating a copy. So putting `copy` everywhere would kind of reproduce old behavior. However, by doing so, you might realize in some places why a lazy adjoint might be a better idea (performance wise).

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 14, 2018, 8:22pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/5 "2018-08-14T20:22:55Z")

</div>

You might not want to create an `Array`.

---

<div class="post-metadata">

### Author: ![vpetukhov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vpetukhov/32/12954_2.png) [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)
#### Post date: [September 1, 2018, 1:25pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/6 "2018-09-01T13:25:22Z")

</div>

Ok, got it, thank you!

---

<div class="post-metadata">

### Author: ![DiracFermion1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)
#### Post date: [August 23, 2021, 4:00pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457/7 "2021-08-23T16:00:37Z")

</div>

I am new to Julia, may I know what is the issue of creating an `Array` vs using `copy`?
