Earth Engine is introducing
noncommercial quota tiers to safeguard shared compute resources and ensure reliable performance for everyone. All noncommercial projects will need to select a quota tier by
April 27, 2026 or will use the Community Tier by default. Tier quotas will take effect for all projects (regardless of tier selection date) on
April 27, 2026.
Learn more.
ee.Array.dotProduct
Stay organized with collections
Save and categorize content based on your preferences.
Compute the dot product between two 1-D arrays.
| Usage | Returns | Array.dotProduct(array2) | Number |
| Argument | Type | Details | this: array1 | Array | The first 1-D array. |
array2 | Array | The second 1-D array. |
Examples
Code Editor (JavaScript)
print(ee.Array([1]).dotProduct(ee.Array([2]))); // 2
print(ee.Array([1, 2]).dotProduct(ee.Array([3, 4]))); // 1*3 + 2*4 = 11
print(ee.Array([0, 1, 2]).dotProduct(ee.Array([3, 4, 5]))); // 0*3 + 1*4 + 2*5 = 14
print(ee.Array([-1, -2]).dotProduct(ee.Array([3, 4]))); // -1*3 + -2*4 = -11
print(ee.Array([1.5, 2.5]).dotProduct(ee.Array([3, 4]))); // 1.5*3 + 2.5*4 = 14.5
Python setup
See the
Python Environment page for information on the Python API and using
geemap for interactive development.
import ee
import geemap.core as geemap
Colab (Python)
display(ee.Array([1]).dotProduct(ee.Array([2]))) # 2
display(ee.Array([1, 2]).dotProduct(ee.Array([3, 4]))) # 1*3 + 2*4 = 11
display(ee.Array([0, 1, 2]).dotProduct(ee.Array([3, 4, 5]))) # 0*3 + 1*4 + 2*5 = 14
display(ee.Array([-1, -2]).dotProduct(ee.Array([3, 4]))) # -1*3 + -2*4 = -11
display(ee.Array([1.5, 2.5]).dotProduct(ee.Array([3, 4]))) # 1.5*3 + 2.5*4 = 14.5
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],["The core functionality is to compute the dot product of two one-dimensional arrays. The `dotProduct` method, applied to `array1`, takes `array2` as an argument. Both arrays must be 1-D. It returns a single numerical value representing the dot product result. The function operates by multiplying corresponding elements from each array, and then summing the products.\n"]]