mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Removed sum_of_squares() as it's redundant with sqr(vector)
This commit is contained in:
parent
37ae0cbba0
commit
23bcc1b806
3 changed files with 2 additions and 22 deletions
14
math.scad
14
math.scad
|
@ -552,18 +552,6 @@ function _cumsum(v,_i=0,_acc=[]) =
|
|||
);
|
||||
|
||||
|
||||
// Function: sum_of_squares()
|
||||
// Description:
|
||||
// Returns the sum of the square of each element of a vector.
|
||||
// Arguments:
|
||||
// v = The vector to get the sum of.
|
||||
// Example:
|
||||
// sum_of_squares([1,2,3]); // Returns: 14.
|
||||
// sum_of_squares([1,2,4]); // Returns: 21
|
||||
// sum_of_squares([-3,-2,-1]); // Returns: 14
|
||||
function sum_of_squares(v) = sum(vmul(v,v));
|
||||
|
||||
|
||||
// Function: sum_of_sines()
|
||||
// Usage:
|
||||
// sum_of_sines(a,sines)
|
||||
|
@ -760,7 +748,7 @@ function _qr_factor(A,Q,P, pivot, column, m, n) =
|
|||
column >= min(m-1,n) ? [Q,A,P] :
|
||||
let(
|
||||
swap = !pivot ? 1
|
||||
: _swap_matrix(n,column,column+max_index([for(i=[column:n-1]) sum_of_squares([for(j=[column:m-1]) A[j][i]])])),
|
||||
: _swap_matrix(n,column,column+max_index([for(i=[column:n-1]) sqr([for(j=[column:m-1]) A[j][i]])])),
|
||||
A = pivot ? A*swap : A,
|
||||
x = [for(i=[column:1:m-1]) A[i][column]],
|
||||
alpha = (x[0]<=0 ? 1 : -1) * norm(x),
|
||||
|
|
|
@ -472,14 +472,6 @@ module test_cumsum() {
|
|||
test_cumsum();
|
||||
|
||||
|
||||
module test_sum_of_squares() {
|
||||
assert_equal(sum_of_squares([1,2,3]), 14);
|
||||
assert_equal(sum_of_squares([1,2,4]), 21);
|
||||
assert_equal(sum_of_squares([-3,-2,-1]), 14);
|
||||
}
|
||||
test_sum_of_squares();
|
||||
|
||||
|
||||
module test_sum_of_sines() {
|
||||
assert_equal(sum_of_sines(0, [[3,4,0],[2,2,0]]), 0);
|
||||
assert_equal(sum_of_sines(45, [[3,4,0],[2,2,0]]), 2);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,433];
|
||||
BOSL_VERSION = [2,0,434];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue