Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1c327a9c authored by hhakim's avatar hhakim
Browse files

Minor changes in matfaust/pyfaust.poly code doc (dev argument) and useless 'if...

Minor changes in matfaust/pyfaust.poly code doc (dev argument) and useless 'if branch' (in pyfaust expm_multiply).
parent d16907ee
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
%> @param K the degree of the last polynomial, i.e. the K+1 first polynomials are built. %> @param K the degree of the last polynomial, i.e. the K+1 first polynomials are built.
%> @param basis_name 'chebyshev', and others yet to come. %> @param basis_name 'chebyshev', and others yet to come.
%> @param 'T0', matrix (optional): a sparse matrix to replace the identity as a 0-degree polynomial of the basis. %> @param 'T0', matrix (optional): a sparse matrix to replace the identity as a 0-degree polynomial of the basis.
%> @param 'dev', str (optional): the computation device ('cpu' or 'gpu'). %> @param 'dev', str (optional): the computing device ('cpu' or 'gpu').
%> %>
%> @retval F the Faust of the basis composed of the K+1 orthogonal polynomials. %> @retval F the Faust of the basis composed of the K+1 orthogonal polynomials.
%> %>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
%> @param t (real array) time points. %> @param t (real array) time points.
%> @param 'K', integer (default value is 10) the greatest polynomial degree of the Chebyshev polynomial basis. The greater it is, the better is the approximate accuracy but note that a larger K increases the computational cost. %> @param 'K', integer (default value is 10) the greatest polynomial degree of the Chebyshev polynomial basis. The greater it is, the better is the approximate accuracy but note that a larger K increases the computational cost.
%> @param 'tradeoff', str (optional): 'memory' or 'time' to specify what matters the most: a small memory footprint or a small time of execution. It changes the implementation of pyfaust.poly.poly used behind. It can help when the memory size is limited relatively to the value of rel_err or the size of A and B. %> @param 'tradeoff', str (optional): 'memory' or 'time' to specify what matters the most: a small memory footprint or a small time of execution. It changes the implementation of pyfaust.poly.poly used behind. It can help when the memory size is limited relatively to the value of rel_err or the size of A and B.
%> @param 'dev', str (optional): the computation device ('cpu' or 'gpu'). %> @param 'dev', str (optional): the computing device ('cpu' or 'gpu').
%> %>
%> %>
%> @retval C the approximate of e^{t_k A} B %> @retval C the approximate of e^{t_k A} B
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%> @param 'rel_err', real (optional): the targeted relative error between the approximate of the action and the action itself (if you were to compute it with inv(A)*x). %> @param 'rel_err', real (optional): the targeted relative error between the approximate of the action and the action itself (if you were to compute it with inv(A)*x).
%> @param 'tradeoff', str (optional): 'memory' or 'time' to specify what matters the most: a small memory footprint or a small time of execution. It changes the implementation of pyfaust.poly.poly used behind. It can help when the memory size is limited relatively to the value of rel_err or the size of A and B. %> @param 'tradeoff', str (optional): 'memory' or 'time' to specify what matters the most: a small memory footprint or a small time of execution. It changes the implementation of pyfaust.poly.poly used behind. It can help when the memory size is limited relatively to the value of rel_err or the size of A and B.
%> @param 'max_K', int (optional): the maximum degree of Chebyshev polynomial to use (useful to limit memory consumption). %> @param 'max_K', int (optional): the maximum degree of Chebyshev polynomial to use (useful to limit memory consumption).
%> @param 'dev', str (optional): the device to instantiate the returned Faust ('cpu' or 'gpu'). %> @param 'dev', str (optional): the computing device ('cpu' or 'gpu').
%> %>
%> @retval AinvB the array which is the approximate action of matrix inverse of A on B. %> @retval AinvB the array which is the approximate action of matrix inverse of A on B.
%> %>
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
%> @param coeffs the linear combination coefficients (vector). %> @param coeffs the linear combination coefficients (vector).
%> @param basis either the name of the polynomial basis to build on L or the basis if already built externally (as a Faust or an equivalent full array). %> @param basis either the name of the polynomial basis to build on L or the basis if already built externally (as a Faust or an equivalent full array).
%> @param 'L', matrix the sparse matrix on which the polynomial basis is built if basis is not already a Faust or a full array. %> @param 'L', matrix the sparse matrix on which the polynomial basis is built if basis is not already a Faust or a full array.
%> @param 'X', matrix if X is set, the linear combination of basis*X is computed (note that the memory space is optimized compared to the manual way of doing first B = basis*X and then calling poly on B witout X set). %> @param 'X', matrix if X is set, the linear combination of basis*X is computed (note that the memory space is optimized compared to the manual way of doing first B = basis*X and then calling poly on B without X set).
%> @param 'dev', str (optional): the computation device ('cpu' or 'gpu'). %> @param 'dev', str (optional): the computating device ('cpu' or 'gpu').
%> @retval LC The linear combination Faust or full array depending on if basis is itself a Faust or a np.ndarray. %> @retval LC The linear combination Faust or full array depending on if basis is itself a Faust or a np.ndarray.
%> %>
%> @b Example %> @b Example
......
...@@ -159,7 +159,7 @@ def poly(coeffs, basis='chebyshev', L=None, X=None, dev='cpu', out=None, ...@@ -159,7 +159,7 @@ def poly(coeffs, basis='chebyshev', L=None, X=None, dev='cpu', out=None,
is computed (note that the memory space is optimized compared to is computed (note that the memory space is optimized compared to
the manual way of doing first B = basis@X and then calling poly on the manual way of doing first B = basis@X and then calling poly on
B with X at None). B with X at None).
dev: the device to instantiate the returned Faust ('cpu' or 'gpu'). dev: the computing device ('cpu' or 'gpu').
out: (np.ndarray) if not None the function result is put into this out: (np.ndarray) if not None the function result is put into this
np.ndarray. Note that out.flags['F_CONTINUOUS'] must be True. Note that this can't work if the function returns a np.ndarray. Note that out.flags['F_CONTINUOUS'] must be True. Note that this can't work if the function returns a
Faust. Faust.
...@@ -574,12 +574,9 @@ def expm_multiply(A, B, t, K=10, tradeoff='time', dev='cpu', **kwargs): ...@@ -574,12 +574,9 @@ def expm_multiply(A, B, t, K=10, tradeoff='time', dev='cpu', **kwargs):
coeff[j] = coeff[j+2] - (2 * j + 2) / (-tau * phi) * coeff[j+1] coeff[j] = coeff[j+2] - (2 * j + 2) / (-tau * phi) * coeff[j+1]
coeff[0] /= 2 coeff[0] /= 2
if poly_meth == 2: if poly_meth == 2:
poly(coeff, TB, dev=dev, out=Y[i][:, :]) poly(coeff, TB, dev=dev, out=Y[i][:, :])
else: else:
if n == 1: poly(coeff, T, X=B, dev=dev, out=Y[i][:, :])
poly(coeff, T, X=B, dev=dev, out=Y[i][:, :])
else:
poly(coeff, T, X=B, dev=dev, out=Y[i][:, :])
if B.ndim == 1: if B.ndim == 1:
return squeeze(Y) return squeeze(Y)
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment