ประกาศ: โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
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
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-10-20 UTC
[null,null,["อัปเดตล่าสุด 2025-10-20 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"]]