0
A
回答
1
Google Apps腳本是Javascript的變體 - 所以,它可以支持矩陣操作或任何其他數學運算。也像Javascript一樣,它本身無法實現 - 您需要自己編寫函數,或者找到適合的函數庫。
對於特別是矩陣操作,這裏有一個選項。 Jos de Jong的mathjs用於Node.js的庫在Google Apps腳本中原樣使用。你可以閱讀它對矩陣here的支持。
複製最小化
math.js
source from github,並且將其粘貼到您想要的庫添加到腳本new script file。完成該操作後,該庫可作爲math
訪問,例如,math.someMethod()
試試下面的例子 - 評論表明您可以在日誌中會發生什麼:
/**
* Demonstrate mathjs array & matrix operations.
*/
function matrix_demo() {
var array = [[2, 0],[-1, 3]]; // Array
var matrix = math.matrix([[7, 1],[-2, 3]]); // Matrix
// perform a calculation on an array and matrix
print(math.square(array)); // Array, [[4, 0], [1, 9]]
print(math.square(matrix)); // Matrix, [[49, 1], [4, 9]]
// perform calculations with mixed array and matrix input
print(math.add(array, matrix)); // Matrix, [[9, 1], [-3, 6]]
print(math.multiply(array, matrix)); // Matrix, [[14, 2], [-13, 8]]
// create a matrix. Type of output of function ones is determined by the
// configuration option `matrix`
print(math.ones(2, 3)); // Matrix, [[1, 1, 1], [1, 1, 1]]
}
/**
* Helper function to output a value in the console. Value will be formatted.
* @param {*} value
*/
function print (value) {
var precision = 14;
Logger.log(math.format(value, precision));
}
相關問題
- 1. 矩陣操作?
- 2. 谷歌腳本中的矩陣操作跟進
- 3. MATLAB中的矩陣操作
- 4. CUDA中的矩陣操作
- 5. MatLab中的矩陣操作
- 6. 矩陣操作SciLab
- 7. 矩陣的Python exp操作
- 8. MySQL的矩陣操作
- 9. 本徵矩陣廣播操作
- 10. R中的行明智矩陣操作
- 11. Mirror.js中的矩陣操作(三個j)
- 12. python中的條件矩陣操作
- 13. c#中的高速矩陣操作?
- 14. 五維矩陣操作
- 15. Android imageview矩陣操作
- 16. 加速矩陣rowMeans操作
- 17. 陣列/矩陣操作出錯
- 18. 在Maxima中操作矩陣(wx)
- 19. 做多矩陣的矩陣乘法在一個操作
- 20. 有限存儲器上大矩陣上的矩陣操作
- 21. 矩陣上的Matlab邏輯操作
- 22. Android:ImageView上的矩陣操作,動畫?
- 23. 操作存儲在單元陣列中的矩陣 - Matlab
- 24. 製作在圖中的成本矩陣
- 25. CUDA中有矩陣和矩陣向量操作的內置類型的矩陣嗎?
- 26. 如何在Matlab上做矩陣操作?
- 27. 矩陣類C++如MATLAB操作過載
- 28. 蟒蛇組矩陣添加操作
- 29. 重載操作符+ =和+矩陣C++
- 30. iOS矩陣和矢量操作