ee.Array.dotProduct

คำนวณผลคูณแบบดอทระหว่างอาร์เรย์ 1 มิติ 2 รายการ

การใช้งานค่าที่แสดงผล
Array.dotProduct(array2)ตัวเลข
อาร์กิวเมนต์ประเภทรายละเอียด
array1อาร์เรย์อาร์เรย์ 1 มิติแรก
array2อาร์เรย์อาร์เรย์ 1 มิติที่ 2

ตัวอย่าง

ตัวแก้ไขโค้ด (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

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้าสภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

display(ee.Array([1]).dotProduct(ee.Array([2])).getInfo())  # 2
display(ee.Array([1, 2]).dotProduct(ee.Array([3, 4])).getInfo())  # 1*3 + 2*4 = 11
display(ee.Array([0, 1, 2]).dotProduct(ee.Array([3, 4, 5])).getInfo())  # 0*3 + 1*4 + 2*5 = 14
display(ee.Array([-1, -2]).dotProduct(ee.Array([3, 4])).getInfo())  # -1*3 + -2*4 = -11
display(ee.Array([1.5, 2.5]).dotProduct(ee.Array([3, 4])).getInfo())  # 1.5*3 + 2.5*4 = 14.5