mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-29 14:09:50 +02:00
make all_zero, etc, non-recursive, just work on vectors
This commit is contained in:
@@ -145,7 +145,7 @@ test_deduplicate_indexed();
|
||||
module test_all_zero() {
|
||||
assert(all_zero(0));
|
||||
assert(all_zero([0,0,0]));
|
||||
assert(all_zero([[0,0,0],[0,0]]));
|
||||
assert(!all_zero([[0,0,0],[0,0]]));
|
||||
assert(all_zero([EPSILON/2,EPSILON/2,EPSILON/2]));
|
||||
assert(!all_zero(1e-3));
|
||||
assert(!all_zero([0,0,1e-3]));
|
||||
@@ -215,7 +215,7 @@ module test_all_negative() {
|
||||
assert(!all_negative([3,-1,2]));
|
||||
assert(all_negative([-3,-1,-2]));
|
||||
assert(!all_negative([-3,1,-2]));
|
||||
assert(all_negative([[-5,-7],[-3,-1,-2]]));
|
||||
assert(!all_negative([[-5,-7],[-3,-1,-2]]));
|
||||
assert(!all_negative([[-5,-7],[-3,1,-2]]));
|
||||
assert(!all_negative([]));
|
||||
assert(!all_negative(true));
|
||||
@@ -256,7 +256,7 @@ module test_all_nonnegative() {
|
||||
assert(!all_nonnegative([[-5,-7],[-3,-1,-2]]));
|
||||
assert(!all_nonnegative([[-5,-7],[-3,1,-2]]));
|
||||
assert(!all_nonnegative([[5,7],[3,-1,2]]));
|
||||
assert(all_nonnegative([[5,7],[3,1,2]]));
|
||||
assert(!all_nonnegative([[5,7],[3,1,2]]));
|
||||
assert(!all_nonnegative([]));
|
||||
assert(!all_nonnegative(true));
|
||||
assert(!all_nonnegative(false));
|
||||
|
@@ -136,7 +136,7 @@ module test_null_space(){
|
||||
|
||||
function nullcheck(A,dim) =
|
||||
let(v=null_space(A))
|
||||
len(v)==dim && all_zero(A*transpose(v),eps=1e-12);
|
||||
len(v)==dim && all_zero(flatten(A*transpose(v)),eps=1e-12);
|
||||
|
||||
A = [[-1, 2, -5, 2],[-3,-1,3,-3],[5,0,5,0],[3,-4,11,-4]];
|
||||
assert(nullcheck(A,1));
|
||||
|
Reference in New Issue
Block a user