Mentions légales du service

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

Add matfaust first livescript (Faust creation), update the doxygen website...

Add matfaust first livescript (Faust creation), update the doxygen website markdown to publish it and the cmake script to make the zip archive (as it is already for jupyter notebooks).
parent 199f11c9
No related branches found
No related tags found
No related merge requests found
function (archive_tutos faust_pkg tuto_type file_ext)
# Creates a zip archive of notebooks/livescripts
#example 1: archive_tutos(pyfaust notebook ipynb)
#example 2: archive_tutos(matfaust livescript mlx)
#TODO: rename variable IPYNB_FILES etc
if(UNIX)
file(GLOB IPYNB_FILES "${FAUST_DOC_SRC_DIR}" "*.${file_ext}")
foreach(NB IN LISTS IPYNB_FILES)
get_filename_component(NB ${NB} NAME)
#message(STATUS ${NB})
if(${NB} MATCHES ".*[.]${file_ext}")
set(IPYNB_ZIP_ARG ${IPYNB_ZIP_ARG};${NB})
endif()
endforeach()
add_custom_target(zip_${tuto_type}s ALL zip ${faust_pkg}_${tuto_type}s.zip -b ${PROJECT_BINARY_DIR}/doc/html ${IPYNB_ZIP_ARG} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/html COMMENT "Archiving the ${tuto_type}s in a zip file" VERBATIM)
endif(UNIX)
endfunction()
##Generation of the documentation using doxygen
# add a target to generate API documentation with Doxygen
if(BUILD_DOCUMENTATION)
......@@ -29,7 +47,7 @@ if(BUILD_DOCUMENTATION)
if(WIN32)
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc COMMENT "Generating API documentation with Doxygen" VERBATIM)
else()
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile DEPENDS zip_notebooks WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc COMMENT "Generating API documentation with Doxygen" VERBATIM)
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile DEPENDS zip_notebooks zip_livescripts WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc COMMENT "Generating API documentation with Doxygen" VERBATIM)
if(BUILD_WRAPPER_MATLAB)
add_dependencies(doc PREPARE_MATFAUST_FOR_DOXYDOC)
endif()
......@@ -105,6 +123,7 @@ if(BUILD_DOCUMENTATION)
file(REMOVE ${PROJECT_BINARY_DIR}/doc/README_install_part.html)
configure_file(${FAUST_DOC_SRC_DIR}/bin_pkgs/README_template.md ${PROJECT_BINARY_DIR}/doc/README.md)
configure_file(${FAUST_DOC_SRC_DIR}/faq.md ${PROJECT_BINARY_DIR}/doc/faq.md)
# pyfaust jupyter notebooks (ipynb and html)
configure_file(${FAUST_DOC_SRC_DIR}/Faust_creation.ipynb ${PROJECT_BINARY_DIR}/doc/html/Faust_creation.ipynb COPYONLY)
configure_file(${FAUST_DOC_SRC_DIR}/Faust_creation.html ${PROJECT_BINARY_DIR}/doc/html/Faust_creation.html COPYONLY)
configure_file(${FAUST_DOC_SRC_DIR}/Faust_manipulation.ipynb ${PROJECT_BINARY_DIR}/doc/html/Faust_manipulation.ipynb COPYONLY)
......@@ -115,22 +134,12 @@ if(BUILD_DOCUMENTATION)
configure_file(${FAUST_DOC_SRC_DIR}/Use_of_Faust_objects_in_algorithms.html ${PROJECT_BINARY_DIR}/doc/html/Use_of_Faust_objects_in_algorithms.html COPYONLY)
configure_file(${FAUST_DOC_SRC_DIR}/faust_projectors.ipynb ${PROJECT_BINARY_DIR}/doc/html/faust_projectors.ipynb COPYONLY)
configure_file(${FAUST_DOC_SRC_DIR}/faust_projectors.html ${PROJECT_BINARY_DIR}/doc/html/faust_projectors.html COPYONLY)
# matfaust matlab livescripts (mlx and html)
configure_file(${FAUST_DOC_SRC_DIR}/Faust_creation.mlx ${PROJECT_BINARY_DIR}/doc/html/Faust_creation.mlx COPYONLY)
configure_file(${FAUST_DOC_SRC_DIR}/Faust_creation.mlx.html ${PROJECT_BINARY_DIR}/doc/html/Faust_creation.mlx.html COPYONLY)
configure_file(${FAUST_SRC_TEST_SRC_PYTHON_DIR}/test_svd_rc_vs_err.py ${PROJECT_BINARY_DIR}/doc/html/test_svd_rc_vs_err.py COPYONLY)
# create a zip archive for the notebooks
if(UNIX)
file(GLOB IPYNB_FILES "${FAUST_DOC_SRC_DIR}" "*.ipynb")
#message(STATUS "IPYNB_FILES=${IPYNB_FILES}")
foreach(NB IN LISTS IPYNB_FILES)
get_filename_component(NB ${NB} NAME)
#message(STATUS ${NB})
if(${NB} MATCHES ".*[.]ipynb")
set(IPYNB_ZIP_ARG ${IPYNB_ZIP_ARG};${NB})
endif()
endforeach()
#message(STATUS "IPYNB_ZIP_ARG=${IPYNB_ZIP_ARG}")
# set(IPYNB_ZIP_ARG Faust_creation.ipynb Faust_factorization.ipynb Faust_manipulation.ipynb Use_of_Faust_objects_in_algorithms.ipynb)
add_custom_target(zip_notebooks ALL zip pyfaust_notebooks.zip -b ${PROJECT_BINARY_DIR}/doc/html ${IPYNB_ZIP_ARG} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/html COMMENT "Archiving the notebook in a zip file" VERBATIM)
endif(UNIX)
archive_tutos(pyfaust notebook ipynb)
archive_tutos(matfaust livescript mlx)
# filter out the HTML tags in pyfaust doc strings
add_custom_target(filter_html_tag_in_pyfaust ALL ${PYTHON3_EXE} ${FAUST_DOC_SRC_DIR}/post_docgen_html_tags_filter.py ${FAUST_PYTHON_BIN_DIR}/pyfaust WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Filtering out HTML tags from pyfaust modules" VERBATIM)
endif(BUILD_DOCUMENTATION)
......
File added
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB R2018b"><title>Untitled</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left; }
.S1 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left; }
.S2 { margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left; }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S3 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234001159668px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; }
.S4 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234001159668px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; }
.S5 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 17.234001159668px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; }
.S6 { color: rgb(64, 64, 64); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234001159668px; }
.embeddedOutputsErrorElement {min-height: 18px; max-height: 250px; overflow: auto;}
.embeddedOutputsErrorElement.inlineElement {}
.embeddedOutputsErrorElement.rightPaneElement {}
.embeddedOutputsWarningElement{min-height: 18px; max-height: 250px; overflow: auto;}
.embeddedOutputsWarningElement.inlineElement {}
.embeddedOutputsWarningElement.rightPaneElement {}
.diagnosticMessage-wrapper {font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px;}
.diagnosticMessage-wrapper.diagnosticMessage-warningType {color: rgb(255,100,0);}
.diagnosticMessage-wrapper.diagnosticMessage-warningType a {color: rgb(255,100,0); text-decoration: underline;}
.diagnosticMessage-wrapper.diagnosticMessage-errorType {color: rgb(230,0,0);}
.diagnosticMessage-wrapper.diagnosticMessage-errorType a {color: rgb(230,0,0); text-decoration: underline;}
.diagnosticMessage-wrapper .diagnosticMessage-messagePart {white-space: pre-wrap;}
.diagnosticMessage-wrapper .diagnosticMessage-stackPart {white-space: pre;}
.embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {white-space: pre; word-wrap: initial; min-height: 18px; max-height: 250px; overflow: auto;}
.textElement,.rtcDataTipElement .textElement {padding-top: 3px;}
.embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {}
.inlineElement .textElement {}
.embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {min-height: 16px;}
.rightPaneElement .textElement {padding-top: 2px; padding-left: 9px;}
.S7 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left; }
.S8 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 17.234001159668px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; }
.S9 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 17.234001159668px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; }</style></head><body><div class = rtcContent><h2 class = 'S0'><span style=' font-weight: bold;'>How to Create a Faust</span></h2><div class = 'S1'><span style=' font-weight: bold;'></span></div><h3 class = 'S2'><span>1. Setting the Factors Manually</span></h3><div class = 'S1'><span style=' font-weight: bold;'></span></div><div class = 'S1'><span>Let's start by creating a </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html"><span>Faust</span></a><span> manually, that is factor by factor.</span></div><div class = 'S1'><span>Below is a creation of a </span><span style=' font-family: monospace;'>Faust</span><span> containing 5 factors, alternating sparse and dense factors</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre;"><span>import </span><span style="color: rgb(160, 32, 240);">matfaust.Faust</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span>factors = cell(1,5);</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span>is_sparse = false;</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span style="color: rgb(0, 0, 255);">for </span><span>i=1:5</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span> </span><span style="color: rgb(0, 0, 255);">if</span><span>(is_sparse) </span><span style="color: rgb(34, 139, 34);">% odd index factors are sparse matrices</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span> factors{i} = sprand(100, 100, 0.1);</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span> </span><span style="color: rgb(0, 0, 255);">else </span><span style="color: rgb(34, 139, 34);">% even index gives a dense matrix</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span> factors{i} = rand(100, 100);</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span> </span><span style="color: rgb(0, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span> is_sparse = ~ is_sparse; </span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span style="color: rgb(0, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div class = 'S4'><span style="white-space: pre;"><span style="color: rgb(34, 139, 34);">% define a Faust with those factors</span></span></div></div><div class="inlineWrapper outputs"><div class = 'S5'><span style="white-space: pre;"><span>F = Faust(factors)</span></span></div><div class = 'S6'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="5A59BA81" data-testid="output_0" data-width="934" data-height="104" data-hashorizontaloverflow="false" style="width: 964px; max-height: 261px;"><div class="textElement"><div><span class="variableNameElement">F = </span></div><div>Faust size 100x100, density 3.1909, nnz_sum 31909, 5 factor(s):
- FACTOR 0 (real) DENSE, size 100x100, density 1, nnz 10000
- FACTOR 1 (real) SPARSE, size 100x100, density 0.0951, nnz 951
- FACTOR 2 (real) DENSE, size 100x100, density 1, nnz 10000
- FACTOR 3 (real) SPARSE, size 100x100, density 0.0958, nnz 958
- FACTOR 4 (real) DENSE, size 100x100, density 1, nnz 10000</div></div></div></div></div></div><div class = 'S7'><span>As you noticed, the </span><span style=' font-family: monospace;'>Faust</span><span> output contains the list of factors and their features but also a header describing the </span><span style=' font-family: monospace;'>Faust</span><span> operator itself: its size, its density, the number of nonzeros it contains (</span><span style=' font-family: monospace;'>nnz_sum</span><span>) along with all its factors.</span></div><div class = 'S1'><span>You can also call </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html#a3132f572e58e6c312d5535d0e075735e"><span style=' font-family: monospace;'>disp(F)</span></a><span> to get these informations.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div class = 'S8'><span style="white-space: pre;"><span>disp(F)</span></span></div><div class = 'S6'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="DAD5F57D" data-testid="output_1" data-width="934" data-height="87" data-hashorizontaloverflow="false" style="width: 964px; max-height: 261px;"><div class="textElement">Faust size 100x100, density 3.1909, nnz_sum 31909, 5 factor(s):
- FACTOR 0 (real) DENSE, size 100x100, density 1, nnz 10000
- FACTOR 1 (real) SPARSE, size 100x100, density 0.0951, nnz 951
- FACTOR 2 (real) DENSE, size 100x100, density 1, nnz 10000
- FACTOR 3 (real) SPARSE, size 100x100, density 0.0958, nnz 958
- FACTOR 4 (real) DENSE, size 100x100, density 1, nnz 10000</div></div></div></div></div><div class = 'S7'><span style=' font-weight: bold;'></span></div><h3 class = 'S2'><span style=' font-weight: bold;'>2. Faust File Loading</span></h3><div class = 'S1'><span style=' font-weight: bold;'></span></div><div class = 'S1'><span>It's really handy to create a </span><span style=' font-family: monospace;'>Faust</span><span> and retrieve it from a file later. Let's see in the code below how to proceed.</span></div><div class = 'S1'><span>First save the Faust.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S9'><span style="white-space: pre;"><span>save(F, </span><span style="color: rgb(160, 32, 240);">'F.mat'</span><span>)</span></span></div></div></div><div class = 'S7'><span>Now let's get it back from file.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div class = 'S8'><span style="white-space: pre;"><span>file_F = Faust(</span><span style="color: rgb(160, 32, 240);">'F.mat'</span><span>)</span></span></div><div class = 'S6'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="CC54247E" data-testid="output_2" data-width="934" data-height="104" data-hashorizontaloverflow="false" style="width: 964px; max-height: 261px;"><div class="textElement"><div><span class="variableNameElement">file_F = </span></div><div>Faust size 100x100, density 3.1909, nnz_sum 31909, 5 factor(s):
- FACTOR 0 (real) DENSE, size 100x100, density 1, nnz 10000
- FACTOR 1 (real) SPARSE, size 100x100, density 0.0951, nnz 951
- FACTOR 2 (real) DENSE, size 100x100, density 1, nnz 10000
- FACTOR 3 (real) SPARSE, size 100x100, density 0.0958, nnz 958
- FACTOR 4 (real) DENSE, size 100x100, density 1, nnz 10000</div></div></div></div></div></div><div class = 'S7'><span>The file storage format used is matlab v7. This format allows the compatibility between matfaust and </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacepyfaust.html"><span>pyfaust</span></a><span>, the Python wrapper. You can easily reload the </span><span style=' font-family: monospace;'>F.mat</span><span> file from pyfaust.</span></div><div class = 'S1'><span></span></div><h3 class = 'S2'><span>3. Generating a Random Faust</span></h3><div class = 'S1'><span></span></div><div class = 'S1'><span>The matfaust package provides functions for generating </span><span style=' font-family: monospace;'>Faust</span><span> objects by many manners. One noticeable function of this package is </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacematfaust.html#adf468bdd261c93f719fd2ecc8d4a4254"><span>rand()</span></a><span>. This function allows to generate a random </span><span style=' font-family: monospace;'>Faust</span><span> satisfying certain constraints; the number of factors, the size of these factors, the density, the scalar type, etc.</span></div><div class = 'S1'><span>Below are examples of (pseudo-)random generations.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div class = 'S8'><span style="white-space: pre;"><span>F = matfaust.rand(10, 10, </span><span style="color: rgb(160, 32, 240);">'num_factors'</span><span>, 2, </span><span style="color: rgb(160, 32, 240);">'density'</span><span>, .5, </span><span style="color: rgb(160, 32, 240);">'field'</span><span>, </span><span style="color: rgb(160, 32, 240);">'complex'</span><span>)</span></span></div><div class = 'S6'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="10118B2C" data-testid="output_3" data-width="934" data-height="62" data-hashorizontaloverflow="false" style="width: 964px; max-height: 261px;"><div class="textElement"><div><span class="variableNameElement">F = </span></div><div>Faust size 10x10, density 1, nnz_sum 100, 2 factor(s):
- FACTOR 0 (complex) SPARSE, size 10x10, density 0.5, nnz 50
- FACTOR 1 (complex) SPARSE, size 10x10, density 0.5, nnz 50</div></div></div></div></div></div><div class = 'S7'><span>F is a complex </span><span style=' font-family: monospace;'>Faust</span><span>. Its rate of nonzeros, for each factor, is about 0.5. Since the </span><span style=' font-family: monospace;'>fac_type</span><span> argument is not set, each factor is sparse.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div class = 'S8'><span style="white-space: pre;"><span>G = matfaust.rand(14, 20, </span><span style="color: rgb(160, 32, 240);">'num_factors'</span><span>, [2, 5], </span><span style="color: rgb(160, 32, 240);">'dim_sizes'</span><span>, [14, 20], </span><span style="color: rgb(160, 32, 240);">'density'</span><span>, .5, </span><span style="color: rgb(160, 32, 240);">'fac_type'</span><span>, </span><span style="color: rgb(160, 32, 240);">'dense'</span><span>)</span></span></div><div class = 'S6'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="82AC4B62" data-testid="output_4" data-width="934" data-height="62" data-hashorizontaloverflow="false" style="width: 964px; max-height: 261px;"><div class="textElement"><div><span class="variableNameElement">G = </span></div><div>Faust size 14x20, density 0.85, nnz_sum 238, 2 factor(s):
- FACTOR 0 (real) DENSE, size 14x14, density 0.5, nnz 98
- FACTOR 1 (real) DENSE, size 14x20, density 0.5, nnz 140</div></div></div></div></div></div><div class = 'S7'><span>G is a real </span><span style=' font-family: monospace;'>Faust</span><span> (the default scalar type). In the </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacematfaust.html#adf468bdd261c93f719fd2ecc8d4a4254"><span>rand()</span></a><span> call </span><span style=' font-family: monospace;'>num_factors</span><span> value (</span><span style=' font-family: monospace;'>[2, 5]</span><span>) defines the bounds in which we want the number of factors to be and likewise the </span><span style=' font-family: monospace;'>dim_sizes</span><span> argument defines the bounds in which to randomly choose the sizes of the two dimensions of each intermediary factor composing the Faust. The sizes are chosen to keep G consistent though, this is a matrix product! </span></div><div class = 'S1'><span>The</span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacematfaust.html#adf468bdd261c93f719fd2ecc8d4a4254"><span> rand()</span></a><span> function will surely be of a great help if you want to test the </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html"><span style=' font-family: monospace;'>Faust</span></a><span> member functions. A second notebook might guide you in that road: </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/Faust_manipulation.mlx.html"><span>How to Manipulate a Faust</span></a><span>.</span></div><h3 class = 'S2'><span>4. Other Ways of Creation</span></h3><div class = 'S1'><span>There exist many ways to create a </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html"><span>Faust</span></a><span>, please look at the package documentation for more information. It would be the topic of another notebook! If you want, for example, to learn about </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html"><span>Faust</span></a><span> generation based on the FAµST's factorization algorithms, check this notebook: </span><a href = "https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/Faust_manipulation.mlx..html"><span>Using the FAµST Factorization Wrappers</span></a><span>.</span></div><div class = 'S1'><span style=' font-weight: bold;'>Note:</span><span> this livescript was executed using the following matfaust version:</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div class = 'S8'><span style="white-space: pre;"><span>matfaust.version()</span></span></div><div class = 'S6'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="E44C4CEE" data-testid="output_5" data-width="934" data-height="20" data-hashorizontaloverflow="false" style="width: 964px; max-height: 261px;"><div class="textElement"><div><span class="variableNameElement">ans = </span>'2.10.13'</div></div></div></div></div></div></div><br>
<!--
##### SOURCE BEGIN #####
%% *How to Create a Faust*
% **
%% 1. Setting the Factors Manually
% **
%
% Let's start by creating a <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html
% Faust> manually, that is factor by factor.
%
% Below is a creation of a |Faust| containing 5 factors, alternating sparse
% and dense factors
import matfaust.Faust
factors = cell(1,5);
is_sparse = false;
for i=1:5
if(is_sparse) % odd index factors are sparse matrices
factors{i} = sprand(100, 100, 0.1);
else % even index gives a dense matrix
factors{i} = rand(100, 100);
end
is_sparse = ~ is_sparse;
end
% define a Faust with those factors
F = Faust(factors)
%%
% As you noticed, the |Faust| output contains the list of factors and their
% features but also a header describing the |Faust| operator itself: its size,
% its density, the number of nonzeros it contains (|nnz_sum|) along with all its
% factors.
%
% You can also call |<https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html#a3132f572e58e6c312d5535d0e075735e
% disp(F)>| to get these informations.
disp(F)
%%
% **
%% *2. Faust File Loading*
% **
%
% It's really handy to create a |Faust| and retrieve it from a file later.
% Let's see in the code below how to proceed.
%
% First save the Faust.
save(F, 'F.mat')
%%
% Now let's get it back from file.
file_F = Faust('F.mat')
%%
% The file storage format used is matlab v7. This format allows the compatibility
% between matfaust and <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacepyfaust.html
% pyfaust>, the Python wrapper. You can easily reload the |F.mat| file from pyfaust.
%
%
%% 3. Generating a Random Faust
%
%
% The matfaust package provides functions for generating |Faust| objects
% by many manners. One noticeable function of this package is <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacematfaust.html#adf468bdd261c93f719fd2ecc8d4a4254
% rand()>. This function allows to generate a random |Faust| satisfying certain
% constraints; the number of factors, the size of these factors, the density,
% the scalar type, etc.
%
% Below are examples of (pseudo-)random generations.
F = matfaust.rand(10, 10, 'num_factors', 2, 'density', .5, 'field', 'complex')
%%
% F is a complex |Faust|. Its rate of nonzeros, for each factor, is about
% 0.5. Since the |fac_type| argument is not set, each factor is sparse.
G = matfaust.rand(14, 20, 'num_factors', [2, 5], 'dim_sizes', [14, 20], 'density', .5, 'fac_type', 'dense')
%%
% G is a real |Faust| (the default scalar type). In the <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacematfaust.html#adf468bdd261c93f719fd2ecc8d4a4254
% rand()> call |num_factors| value (|[2, 5]|) defines the bounds in which we
% want the number of factors to be and likewise the |dim_sizes| argument defines
% the bounds in which to randomly choose the sizes of the two dimensions of each
% intermediary factor composing the Faust. The sizes are chosen to keep G consistent
% though, this is a matrix product!
%
% The<https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/namespacematfaust.html#adf468bdd261c93f719fd2ecc8d4a4254
% rand()> function will surely be of a great help if you want to test the |<https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html
% Faust>| member functions. A second notebook might guide you in that road: <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/Faust_manipulation.mlx.html
% How to Manipulate a Faust>.
%% 4. Other Ways of Creation
% There exist many ways to create a <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html
% Faust>, please look at the package documentation for more information. It would
% be the topic of another notebook! If you want, for example, to learn about <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classmatfaust_1_1Faust.html
% Faust> generation based on the FAµST's factorization algorithms, check this
% notebook: <https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/Faust_manipulation.mlx..html
% Using the FAµST Factorization Wrappers>.
%
% *Note:* this livescript was executed using the following matfaust version:
matfaust.version()
##### SOURCE END #####
--></body></html>
\ No newline at end of file
......@@ -5,9 +5,15 @@ This documentation details the [API](annotated.html) of those frontends (a.k.a.
Please refer to this [README](./md_README.html) for a quick guide on how to install and use FAµST wrappers.
You might also be interested in this introduction to pyfaust through Jupyter Notebook:
- [How to Create a Faust](./Faust_creation.html)
- [How to Manipulate a Faust](./Faust_manipulation.html)
- [Using the FAµST API in Algorithms](./Use_of_Faust_objects_in_algorithms.html)
- [How to Create a Faust](./Faust_creation.html)
- [How to Manipulate a Faust](./Faust_manipulation.html)
- [Using the FAµST API in Algorithms](./Use_of_Faust_objects_in_algorithms.html)
- [Using The FAµST Projectors API](./faust_projectors.html)
Download all the notebooks (.ipynb) [here](./pyfaust_notebooks.zip).
Besides, if you're more familiar with Matlab, some livescripts are also available to introduce matfaust.
- [How to Create a Faust](./Faust_creation.mlx.html)
Download all the livescripts (.mlx) [here](./matfaust_livescripts.zip).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment