# INDArray power method

**URL:** <https://community.konduit.ai/t/indarray-power-method/1751>\
**Category:** ND4J\
**Created:** [January 20, 2022, 5:21pm UTC](https://community.konduit.ai/t/indarray-power-method/1751 "2022-01-20T17:21:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hulk-us](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/hulk-us/32/706_2.png) [@hulk-us](https://community.konduit.ai/u/hulk-us)\
**Post date:** [January 20, 2022, 5:21pm UTC](https://community.konduit.ai/t/indarray-power-method/1751/1 "2022-01-20T17:21:27Z")

</div>

Hello,

Its my first question/post so I wanted to first thank the developers and maintainers of this awesome product.

I am new to ND4J. I am trying to learn DL4J. I was creating a linear regression model from scratch and I got stuck a little. I can see the INDArray interface defines most operations like add, subtract, divide etc. but I couldnt find a method that takes a scalar and raises all values in the array to the power of the value provided. Something like INDArray.pow(int).

I went through the javadoc and came across org.nd4j.linalg.api.ops.impl.scalar.Pow and PowPairwise but I dont think thats what I am looking for.

I can always recursively use the mul method but thought I would ask if I am missing something obvious.

Thanks in advance for your time.

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [January 20, 2022, 5:41pm UTC](https://community.konduit.ai/t/indarray-power-method/1751/2 "2022-01-20T17:41:46Z")

</div>

The method you are looking for is `Nd4j.math.pow(array, power)`.

See also: [Operation Namespaces - Deeplearning4j](https://deeplearning4j.konduit.ai/samediff/reference/operation-namespaces) and [https://deeplearning4j.konduit.ai/samediff/reference/operation-namespaces/math#pow](https://deeplearning4j.konduit.ai/samediff/reference/operation-namespaces/math#pow) in particular.

---

<div class="post-metadata">

**Author:** ![hulk-us](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/hulk-us/32/706_2.png) [@hulk-us](https://community.konduit.ai/u/hulk-us)\
**Post date:** [January 20, 2022, 5:55pm UTC](https://community.konduit.ai/t/indarray-power-method/1751/3 "2022-01-20T17:55:30Z")

</div>

Thank you @treo. Appreciate the help very much.
