Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0004e5b2 authored by hhakim's avatar hhakim
Browse files

Rename RCG() to rcg() (matlab and py wrappers).

parent 7ba20186
Branches
Tags 2.2rc15
No related merge requests found
Pipeline #833831 skipped
......@@ -111,7 +111,7 @@ Neverthless, it could be useful to check that it really worked and set the envir
<p>Now call some functions on FAµST object A:</p>
<pre><code> &gt;&gt; RCG(A)
<pre><code> &gt;&gt; rcg(A)
&gt;&gt; density(A)
&gt;&gt; get_nb_factor(A)
</code></pre>
......@@ -151,7 +151,7 @@ Neverthless, it could be useful to check that it really worked and set the envir
&gt;&gt;&gt; import FaustPy
&gt;&gt;&gt; import FaustPy
&gt;&gt;&gt; A = FaustPy.Faust('@CMAKE_INSTALL_PREFIX@/python/A.mat') # A is the FAµST created through quickstart script
&gt;&gt;&gt; A.RCG()
&gt;&gt;&gt; A.rcg()
6.666666666666667
&gt;&gt;&gt; A.density()
0.15
......
......@@ -92,7 +92,7 @@ for i=1:nb_FAuST_MEG
facts = normalizeCol(facts,lambda); % normalization of the columns of the FAUST
MEG_FAuST=Faust(facts); % construct the FAuST from its factorscons15_row
MEG_list{i+1}=MEG_FAuST; % store the different FAuST approximationscons21_col
RCG_list(i)=RCG(MEG_FAuST); % compute the RCG of the given FAuST
RCG_list(i)=rcg(MEG_FAuST); % compute the RCG of the given FAuST
end
......
......@@ -83,7 +83,7 @@ for i=1:nb_mult
n=ns(k);
hadamard_dense=Hadamard_matrices{k};
hadamard_faust=Faust(Hadamard_facts{k});
RCGs(k)=RCG(hadamard_faust);
RCGs(k)=rcg(hadamard_faust);
%% 2-norm of the hadamard matrix
......
......@@ -149,7 +149,7 @@ classdef FaustTest < matlab.unittest.TestCase
disp('testrcg()')
ref_nlines = size(this.factors{1},1)
ref_ncols = size(this.factors{this.num_factors},2)
this.verifyEqual(ref_nlines*ref_ncols/FaustTest.nnzero_count(this.factors), RCG(this.test_faust), 'RelTol', 0.01)
this.verifyEqual(ref_nlines*ref_ncols/FaustTest.nnzero_count(this.factors), rcg(this.test_faust), 'RelTol', 0.01)
end
function testend(this)
......
......@@ -260,7 +260,7 @@ disp('Ok');
disp('TEST RCG : ');
expected_RCG = 1/expected_density;
rcg_F = RCG(F);
rcg_F = rcg(F);
if(rcg_F ~= expected_RCG)
rcg_F
expected_RCG
......@@ -268,7 +268,7 @@ if(rcg_F ~= expected_RCG)
end
expected_RCG2 = 1/expected_density2;
rcg2_F = RCG(F_nnz);
rcg2_F = rcg(F_nnz);
if(rcg2_F ~= expected_RCG2)
rcg2_F
......@@ -277,7 +277,7 @@ if(rcg2_F ~= expected_RCG2)
end
expected_RCG_empty_F = -1;
RCG_empty_F = RCG(empty_F);
RCG_empty_F = rcg(empty_F);
if(RCG_empty_F ~= expected_RCG_empty_F)
error('RCG : invalid value');
end
......
......@@ -132,7 +132,7 @@ class TestFaustPy(unittest.TestCase):
print("testRcg()")
ref_rcg = \
float(self.F.get_nb_rows()*self.F.get_nb_cols())/float(self.faust_nnz())
self.assertAlmostEqual(ref_rcg, self.F.RCG(), delta=.001)
self.assertAlmostEqual(ref_rcg, self.F.rcg(), delta=.001)
def mulFactors(self):
......
......@@ -40,7 +40,7 @@
%%
% ======================================================================
%> @brief FAµST class
%> @brief FAµST Matlab class
%>
%> This class represents a given dense matrix by a product of sparse matrices (i.e Faust).
%> The main goal of Faust representation is to speed up operations on that matrix, especially the multiplication. Besides the time optimization, a Faust can reduce the memory space size needed both for storage and loading.
......@@ -813,7 +813,7 @@ classdef Faust
%>
%> @endcode
%>
%> <p>@b See @b also Faust.nnz, Faust.RCG, Faust.size, Faust.get_fact
%> <p>@b See @b also Faust.nnz, Faust.rcg, Faust.size, Faust.get_fact
%>
%>
%======================================================================
......@@ -922,14 +922,14 @@ classdef Faust
%>
%> @retval nz The number of non-zeros.
%>
%> <p>@b See @b also Faust.RCG, Faust.density.
%> <p>@b See @b also Faust.rcg, Faust.density.
%===========================================================================================
function nz=nnz(F)
%% NNZ Number of nonzero elements in a Faust (overloaded Matlab built-in function).
%
% nz = nnz(F) is the number of nonzero elements in the Faust F.
%
% See also density, RCG.
% See also density, rcg.
if (F.isReal)
nz=mexFaustReal('nnz',F.matrix.objectHandle);
else
......@@ -954,7 +954,7 @@ classdef Faust
%> dens = density(F)
%> @endcode
%>
%> <p/>@b See @b also Faust.nnz, Faust.RCG
%> <p/>@b See @b also Faust.nnz, Faust.rcg
%======================================================================
function dens=density(F)
%% DENSITY Density of the Faust.
......@@ -965,7 +965,7 @@ classdef Faust
% In some degenerated case, dens can be greater than 1.
% If the Faust is empty, return -1.
%
% See also RCG, nnz.
% See also rcg, nnz.
prod_dim=prod(size(F));
if (prod_dim ~= 0)
......@@ -990,10 +990,10 @@ classdef Faust
%>
%> <p>@b See @b also Faust.density, Faust.nnz.
%===========================================================================================
function speed_up=RCG(F)
function speed_up=rcg(F)
%% RCG Relative Complexity Gain (inverse of the density)
%
% speed_up = RCG(F) when F is Faust, returns the
% speed_up = rcg(F) when F is Faust, returns the
% inverse of density of the Faust (i.e the theoretical gain
% both for storage and multiplication computation time between the Faust and its full storage
% equivalent full(F)).
......
......@@ -48,7 +48,7 @@ import FaustCorePy
class Faust:
"""FAµST class.
"""FAµST Python class.
This class represents a given dense matrix by a product of sparse matrices
(i.e Faust).
The main goal of Faust representation is to speed up operations on that
......@@ -310,7 +310,7 @@ class Faust:
>>> 1, 2, 50, 100, .5)
>>> F.display()
<b/>See also Faust.nnz, Faust.RCG, Faust.size, Faust.get_factor,
<b/>See also Faust.nnz, Faust.rcg, Faust.size, Faust.get_factor,
Faust.get_nb_factors
"""
......@@ -434,7 +434,7 @@ class Faust:
Returns:
the number of non-zeros.
<b/> See also Faust.RCG, Faust.density.
<b/> See also Faust.rcg, Faust.density.
"""
return F.m_faust.nnz()
......@@ -459,11 +459,11 @@ class Faust:
>>> 5, 50, 100, .5)
>>> dens = F.density()
<b/> See also Faust.nnz, Faust.RCG
<b/> See also Faust.nnz, Faust.rcg
"""
return float(F.nnz())/(F.get_nb_cols()*F.get_nb_rows())
def RCG(F):
def rcg(F):
"""
Computes the Relative Complexity Gain (inverse of Faust.density).
......@@ -480,7 +480,7 @@ class Faust:
If the density is negative it will be -1.
Examples:
>>> F.RCG()
>>> F.rcg()
<b/> See also: Faust.density, Faust.nnz.
"""
......
......@@ -109,7 +109,7 @@ print("multiplication SPEED-UP using Faust")
print("Faust is "+str(t_dense/t_faust)+" faster than a full matrix")
print("Faust nnz: "+str(A.nnz()))
print("Faust density: "+str(A.density()))
print("Faust RCG: "+str(A.RCG()))
print("Faust RCG: "+str(A.rcg()))
print("Faust norm: "+str(A.norm()))
print("Faust nb of factors: "+str(A.get_nb_factors()))
for i in range(0,A.get_nb_factors()):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment