Source: tests/sparse/permute.cpp
30 #include <tests/myratest.h> 36 void test(
int I,
int J,
int N)
43 auto P = p.make_SparseMatrix<
double>();
46 auto Q = q.make_SparseMatrix<
double>();
48 auto PAQ = permute(p,A,q);
50 auto b1 = transpose(P)*(A*(Q*x));
52 double error = frobenius(b1-b2);
53 myra::out() <<
"|P'*(A*(Q*x)) - (P'*A*Q)*x| = " << error << std::endl;
58 ADD_TEST(
"permute",
"[sparse]")
Returns a transposed copy of a SparseMatrix.
Interface class for representing subranges of dense Vector's.
Routines for computing Frobenius norms of various algebraic containers.
static SparseMatrix< Number > random(int I, int J, int N)
Generates a random SparseMatrix with size IxJ and (approximately) N nonzeros.
Definition: SparseMatrix.cpp:493
General purpose compressed-sparse-column (CSC) container.
static Vector< Number > random(int N)
Generates a random Vector of specified size.
Definition: Vector.cpp:276
Routines related to swap sequences, often used during pivoting.
Signatures for sparse matrix * dense vector multiplies. All delegate to gemm() under the hood...
Returns a vector of int's, over [min,max)
Container for either a column vector or row vector (depends upon the usage context) ...
Given a SparseMatrix A and permutations P and Q, returns P'*A*Q.
Aggregates a (perm, iperm, swaps) triple into a vocabulary type.
static Permutation random(int N)
Generates a random Matrix of specified size.
Definition: Permutation.cpp:188
Range/Iterator types associated with SparseMatrix.
Results: [PASS]
|P'*(A*(Q*x)) - (P'*A*Q)*x| = 0
|P'*(A*(Q*x)) - (P'*A*Q)*x| = 0
|P'*(A*(Q*x)) - (P'*A*Q)*x| = 0
|P'*(A*(Q*x)) - (P'*A*Q)*x| = 0
|P'*(A*(Q*x)) - (P'*A*Q)*x| = 5.02725e-15
Go back to Summary of /test
programs.